vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java
brancharithmetic
changeset 582 8e546d108658
parent 276 aeb9fe11cd60
child 615 e3f671b50e93
     1.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java	Thu Dec 06 22:02:10 2012 +0100
     1.2 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java	Fri Jan 25 11:00:52 2013 +0100
     1.3 @@ -157,22 +157,10 @@
     1.4      }
     1.5  
     1.6      private static void assertExec(
     1.7 -        String msg, Class<?> clazz, String method, Object expRes, Object... args) throws Exception {
     1.8 -
     1.9 -        Object ret = null;
    1.10 -        try {
    1.11 -            ret = code.invokeFunction("bck2brwsr");
    1.12 -            ret = code.invokeMethod(ret, "loadClass", clazz.getName());
    1.13 -            ret = code.invokeMethod(ret, method, args);
    1.14 -        } catch (ScriptException ex) {
    1.15 -            fail("Execution failed in\n" + StaticMethodTest.dumpJS(codeSeq), ex);
    1.16 -        } catch (NoSuchMethodException ex) {
    1.17 -            fail("Cannot find method in\n" + StaticMethodTest.dumpJS(codeSeq), ex);
    1.18 -        }
    1.19 -        if (ret == null && expRes == null) {
    1.20 -            return;
    1.21 -        }
    1.22 -        if (expRes.equals(ret)) {
    1.23 +        String msg, Class<?> clazz, String method, Object expRes, Object... args) throws Exception
    1.24 +    {
    1.25 +        Object ret = TestUtils.execCode(code, codeSeq, msg, clazz, method, expRes, args);
    1.26 +        if (ret == null) {
    1.27              return;
    1.28          }
    1.29          if (expRes instanceof Double && ret instanceof Double) {