/*
 * BaseElRegexTest.java
 *
 * Created on 2007/03/19, 14:10
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package test.org.itscool.stylist.el;

import junit.framework.TestCase;
import org.itscool.stylist.el.BaseElRegex;

public class BaseElRegexTest extends TestCase{
   
    public void testReplaceFunction(){
        BaseElRegex regex = new BaseElRegex();
        String result = regex.replaceFunction(null, "1 + 2 = ${mathC.add(1, 2)} !");
        assertEquals("result", "1 + 2 = 3 !", result);
    }
    
    public void testReplaceFunction2(){
        BaseElRegex regex = new BaseElRegex();
        String result = regex.replaceFunction(null, "<div id=\"dummyId\">1 + 2 = ${mathC.add(1, 2)}</div> !");
        assertEquals("result", "<div id=\"dummyId\">1 + 2 = 3</div> !", result);
    }
    
    public void testReplaceFunction3(){
        BaseElRegex regex = new BaseElRegex();
        String result = regex.replaceFunction(null, "<input type=\"text\" name=\"dummy\" value=\"${mathC.add(1, 2)}\"");
        assertEquals("result", "<input type=\"text\" name=\"dummy\" value=\"3\"", result);
    }
}
