use of org.nutz.lang.util.Context in project nutz by nutzam.
the class El2Test method testIssues87.
@Test
public void testIssues87() {
Context context = Lang.context();
context.set("a", new BigDecimal("7"));
context.set("b", new BigDecimal("3"));
assertEquals(10, El.eval(context, "a.add(b).intValue()"));
}
use of org.nutz.lang.util.Context in project nutz by nutzam.
the class El2Test method testIssue308.
@Test
public void testIssue308() {
Context context = Lang.context();
List<String> list = new ArrayList<String>();
list.add("jk");
context.set("list", list);
context.set("System", System.class);
El.eval(context, "System.getenv('PATH').getClass().getName()");
assertEquals("1", Mirror.me(String.class).invoke(String.class, "valueOf", 1));
assertEquals("jk", Mirror.me(String.class).invoke(String.class, "valueOf", "jk"));
}
use of org.nutz.lang.util.Context in project nutz by nutzam.
the class El2Test method testIssue307.
@Test
public void testIssue307() {
Context context = Lang.context();
List<String> list = new ArrayList<String>();
list.add("jk");
context.set("list", list);
context.set("System", System.class);
El.eval(context, "list.add(list.get(0))");
assertEquals(2, list.size());
}
use of org.nutz.lang.util.Context in project nutz by nutzam.
the class El2Test method testIssue277.
@Test
public void testIssue277() {
Context context = Lang.context();
context.set("strings", Strings.class);
assertEquals("a", El.eval(context, "strings.trim(\" a \")"));
}
use of org.nutz.lang.util.Context in project nutz by nutzam.
the class El2Test method test_el_issue1185.
@Test(timeout = 5000, expected = Exception.class)
public void test_el_issue1185() {
Context context = Lang.context();
El.eval(context, "a.b)*0.30");
}
Aggregations