1.1 --- a/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/Bck2BrwsrCase.java Fri Dec 28 12:35:32 2012 +0100
1.2 +++ b/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/Bck2BrwsrCase.java Sat Dec 29 19:42:47 2012 +0100
1.3 @@ -17,10 +17,12 @@
1.4 */
1.5 package org.apidesign.bck2brwsr.vmtest.impl;
1.6
1.7 +import java.io.File;
1.8 +import java.io.FileWriter;
1.9 +import java.io.IOException;
1.10 import java.lang.reflect.Method;
1.11 import java.util.Map;
1.12 import java.util.WeakHashMap;
1.13 -import javax.script.Invocable;
1.14 import org.apidesign.bck2brwsr.launcher.Launcher;
1.15 import org.apidesign.bck2brwsr.launcher.MethodInvocation;
1.16 import org.testng.ITest;
1.17 @@ -35,8 +37,6 @@
1.18 private final Launcher l;
1.19 private final String type;
1.20 Object value;
1.21 - private Invocable code;
1.22 - private CharSequence codeSeq;
1.23 private static final Map<Class, Object[]> compiled = new WeakHashMap<>();
1.24 private Object inst;
1.25
1.26 @@ -64,4 +64,11 @@
1.27 final String typeName() {
1.28 return type;
1.29 }
1.30 + static void dumpJS(StringBuilder sb, Bck2BrwsrCase c) throws IOException {
1.31 + File f = File.createTempFile(c.m.getName(), ".js");
1.32 + try (final FileWriter w = new FileWriter(f)) {
1.33 + w.append(c.l.toString());
1.34 + }
1.35 + sb.append("Path: ").append(f.getPath());
1.36 + }
1.37 }
2.1 --- a/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/CompareCase.java Fri Dec 28 12:35:32 2012 +0100
2.2 +++ b/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/CompareCase.java Sat Dec 29 19:42:47 2012 +0100
2.3 @@ -106,7 +106,14 @@
2.4 } else {
2.5 v1 = "null";
2.6 }
2.7 - Assert.assertEquals(v2, v1, "Comparing results");
2.8 + try {
2.9 + Assert.assertEquals(v2, v1, "Comparing results");
2.10 + } catch (AssertionError e) {
2.11 + StringBuilder sb = new StringBuilder();
2.12 + sb.append(e.getMessage());
2.13 + Bck2BrwsrCase.dumpJS(sb, second);
2.14 + throw new AssertionError(sb.toString());
2.15 + }
2.16 }
2.17
2.18 /** Test name.
2.19 @@ -116,12 +123,4 @@
2.20 public String getTestName() {
2.21 return m.getName() + "[Compare " + second.typeName() + "]";
2.22 }
2.23 -
2.24 - static StringBuilder dumpJS(CharSequence sb) throws IOException {
2.25 - File f = File.createTempFile("execution", ".js");
2.26 - try (FileWriter w = new FileWriter(f)) {
2.27 - w.append(sb);
2.28 - }
2.29 - return new StringBuilder(f.getPath());
2.30 - }
2.31 }