diff -r a83e16b8b825 rt/vm/src/test/java/org/apidesign/vm4brwsr/ExceptionsTest.java --- a/rt/vm/src/test/java/org/apidesign/vm4brwsr/ExceptionsTest.java Tue Sep 17 15:00:18 2013 +0200 +++ b/rt/vm/src/test/java/org/apidesign/vm4brwsr/ExceptionsTest.java Wed Oct 09 17:04:25 2013 +0200 @@ -94,12 +94,12 @@ { // 2nd invocation Object ret = code.invokeMethod(clazz, method, "java.lang.String"); - assertEquals(ret, Double.valueOf(2)); + assertEquals(ret, Integer.valueOf(2)); } { // 3rd invocation Object ret = code.invokeMethod(clazz, method, "java.lang.Integer"); - assertEquals(ret, Double.valueOf(3)); + assertEquals(ret, Integer.valueOf(3)); } } diff -r a83e16b8b825 rt/vm/src/test/java/org/apidesign/vm4brwsr/TestVM.java --- a/rt/vm/src/test/java/org/apidesign/vm4brwsr/TestVM.java Tue Sep 17 15:00:18 2013 +0200 +++ b/rt/vm/src/test/java/org/apidesign/vm4brwsr/TestVM.java Wed Oct 09 17:04:25 2013 +0200 @@ -64,13 +64,22 @@ if (expRes instanceof Number) { // in case of Long it is necessary convert it to number // since the Long is represented by two numbers in JavaScript - try { - ret = code.invokeMethod(ret, "toFP"); - ret = code.invokeFunction("Number", ret); - } catch (ScriptException ex) { - fail("Conversion to number failed in " + dumpJS(codeSeq) + ": " + ex.getMessage(), ex); - } catch (NoSuchMethodException ex) { - fail("Cannot find global Number(x) function in " + dumpJS(codeSeq) + ": " + ex.getMessage(), ex); + if (ret instanceof Number) { + Number n = (Number) ret; + if (expRes instanceof Double) { + ret = n.doubleValue(); + } else if (expRes instanceof Integer && n.intValue() == n.doubleValue()) { + ret = n.intValue(); + } + } else { + try { + ret = code.invokeMethod(ret, "toFP"); + ret = code.invokeFunction("Number", ret); + } catch (ScriptException ex) { + fail("Conversion to number failed in " + dumpJS(codeSeq) + ": " + ex.getMessage(), ex); + } catch (NoSuchMethodException ex) { + fail("Cannot find global Number(x) function in " + dumpJS(codeSeq) + ": " + ex.getMessage(), ex); + } } } return ret; diff -r a83e16b8b825 rt/vm/src/test/java/org/apidesign/vm4brwsr/VMLazyTest.java --- a/rt/vm/src/test/java/org/apidesign/vm4brwsr/VMLazyTest.java Tue Sep 17 15:00:18 2013 +0200 +++ b/rt/vm/src/test/java/org/apidesign/vm4brwsr/VMLazyTest.java Wed Oct 09 17:04:25 2013 +0200 @@ -58,7 +58,7 @@ } @Test public void invokeStaticMethod() throws Exception { - assertExec("Trying to get -1", "test", Double.valueOf(-1), + assertExec("Trying to get -1", "test", Integer.valueOf(-1), StaticMethod.class.getName(), "minusOne__I" ); }