Print test file name in ShellTest error message.

git-svn-id: svn://10.0.0.236/trunk@261658 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
hannes%helma.at 2010-12-15 10:21:22 +00:00
parent 4b594985c8
commit f451f9c462

View File

@ -51,7 +51,7 @@ import org.mozilla.javascript.tools.shell.Main;
import org.mozilla.javascript.tools.shell.ShellContextFactory; import org.mozilla.javascript.tools.shell.ShellContextFactory;
/** /**
* @version $Id: ShellTest.java,v 1.12 2009-05-15 12:30:45 nboyd%atg.com Exp $ * @version $Id: ShellTest.java,v 1.13 2010-12-15 10:21:22 hannes%helma.at Exp $
*/ */
public class ShellTest { public class ShellTest {
public static final FileFilter DIRECTORY_FILTER = new FileFilter() { public static final FileFilter DIRECTORY_FILTER = new FileFilter() {
@ -108,6 +108,14 @@ public class ShellTest {
} }
} }
public final void hadErrors(File jsFile, JsError[] errors) {
if (!negative && errors.length > 0) {
failed("JavaScript errors in " + jsFile + ":\n" + JsError.toString(errors));
} else if (negative && errors.length == 0) {
failed("Should have produced runtime error in " + jsFile + ".");
}
}
public abstract void running(File jsFile); public abstract void running(File jsFile);
public abstract void failed(String s); public abstract void failed(String s);
@ -311,7 +319,7 @@ public class ShellTest {
runFileIfExists(cx, global, new File(jsFile.getParentFile().getParentFile(), "shell.js")); runFileIfExists(cx, global, new File(jsFile.getParentFile().getParentFile(), "shell.js"));
runFileIfExists(cx, global, new File(jsFile.getParentFile(), "shell.js")); runFileIfExists(cx, global, new File(jsFile.getParentFile(), "shell.js"));
runFileIfExists(cx, global, jsFile); runFileIfExists(cx, global, jsFile);
status.hadErrors(testState.errors.errors.toArray(new Status.JsError[0])); status.hadErrors(jsFile, testState.errors.errors.toArray(new Status.JsError[0]));
} catch (ThreadDeath e) { } catch (ThreadDeath e) {
} catch (Throwable t) { } catch (Throwable t) {
status.threw(t); status.threw(t);