From f451f9c4626f9fc7645faeb4491fec2c6de42ea9 Mon Sep 17 00:00:00 2001 From: "hannes%helma.at" Date: Wed, 15 Dec 2010 10:21:22 +0000 Subject: [PATCH] Print test file name in ShellTest error message. git-svn-id: svn://10.0.0.236/trunk@261658 18797224-902f-48f8-a5cc-f745e15eee43 --- .../org/mozilla/javascript/drivers/ShellTest.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mozilla/js/rhino/testsrc/org/mozilla/javascript/drivers/ShellTest.java b/mozilla/js/rhino/testsrc/org/mozilla/javascript/drivers/ShellTest.java index 3c14ae38074..1eb6f87e00c 100644 --- a/mozilla/js/rhino/testsrc/org/mozilla/javascript/drivers/ShellTest.java +++ b/mozilla/js/rhino/testsrc/org/mozilla/javascript/drivers/ShellTest.java @@ -51,7 +51,7 @@ import org.mozilla.javascript.tools.shell.Main; 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 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 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(), "shell.js")); 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 (Throwable t) { status.threw(t);