vm/src/test/java/org/apidesign/vm4brwsr/VMLazyTest.java
branchemul
changeset 708 59d5596a9c6c
parent 594 035fcbd7a33c
     1.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/VMLazyTest.java	Mon Jan 28 00:15:38 2013 +0100
     1.2 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/VMLazyTest.java	Mon Feb 11 12:46:43 2013 +0100
     1.3 @@ -17,7 +17,6 @@
     1.4   */
     1.5  package org.apidesign.vm4brwsr;
     1.6  
     1.7 -import javax.script.Invocable;
     1.8  import javax.script.ScriptContext;
     1.9  import javax.script.ScriptEngine;
    1.10  import javax.script.ScriptException;
    1.11 @@ -30,10 +29,7 @@
    1.12   * @author Jaroslav Tulach <jtulach@netbeans.org>
    1.13   */
    1.14  public class VMLazyTest {
    1.15 -
    1.16 -    
    1.17 -    private static CharSequence codeSeq;
    1.18 -    private static Invocable code;
    1.19 +    private static TestVM code;
    1.20  
    1.21      @BeforeClass
    1.22      public void compileTheCode() throws Exception {
    1.23 @@ -50,11 +46,10 @@
    1.24          sb.append("\n}");
    1.25         
    1.26          ScriptEngine[] arr = { null };
    1.27 -        code = StaticMethodTest.compileClass(sb, arr,
    1.28 +        code = TestVM.compileClass(sb, arr,
    1.29              new String[]{"org/apidesign/vm4brwsr/VM", "org/apidesign/vm4brwsr/StaticMethod"}
    1.30          );
    1.31          arr[0].getContext().setAttribute("loader", new BytesLoader(), ScriptContext.ENGINE_SCOPE);
    1.32 -        codeSeq = sb;
    1.33      }
    1.34      
    1.35      @Test public void invokeStaticMethod() throws Exception {
    1.36 @@ -83,9 +78,9 @@
    1.37          try {
    1.38              ret = code.invokeFunction(methodName, args);
    1.39          } catch (ScriptException ex) {
    1.40 -            fail("Execution failed in\n" + StaticMethodTest.dumpJS(codeSeq), ex);
    1.41 +            fail("Execution failed in\n" + code.toString(), ex);
    1.42          } catch (NoSuchMethodException ex) {
    1.43 -            fail("Cannot find method in\n" + StaticMethodTest.dumpJS(codeSeq), ex);
    1.44 +            fail("Cannot find method in\n" + code.toString(), ex);
    1.45          }
    1.46          if (ret == null && expRes == null) {
    1.47              return;
    1.48 @@ -93,6 +88,6 @@
    1.49          if (expRes.equals(ret)) {
    1.50              return;
    1.51          }
    1.52 -        assertEquals(ret, expRes, msg + "was: " + ret + "\n" + StaticMethodTest.dumpJS(codeSeq));
    1.53 +        assertEquals(ret, expRes, msg + "was: " + ret + "\n" + code.toString());
    1.54      }
    1.55  }