Skip to content

Commit

Permalink
Fixed JS script test (it was passing for Rhino, but failing for Nasho…
Browse files Browse the repository at this point in the history
…rn).
  • Loading branch information
nmihajlovski committed Aug 3, 2015
1 parent d61a929 commit ba41d93
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion rapidoid-u/src/test/java/org/rapidoid/util/UTest.java
Expand Up @@ -274,7 +274,17 @@ public void testCompileJS() throws ScriptException {

Map<String, Object> map = U.cast(U.map("U", new U()));
SimpleBindings bindings = new SimpleBindings(map);
eq(U.compileJS("(function (x) { return U.capitalized(x); })('hey')").eval(bindings), "Hey");

Object res1;
try {
// Rhino style
res1 = U.compileJS("(function (x) { return U.capitalized(x); })('hey')").eval(bindings);
} catch (Exception e) {
// Nashorn style
res1 = U.compileJS("(function (x) { return U.class.static.capitalized(x); })('hey')").eval(bindings);
}

eq(res1, "Hey");
}

}

0 comments on commit ba41d93

Please sign in to comment.