/// <exception cref="System.Exception"></exception>
internal virtual void Run(JsDriver.Arguments arguments)
{
if (arguments.Help())
{
System.Console.Out.WriteLine("See mozilla/js/tests/README-jsDriver.html; note that some options are not supported.");
System.Console.Out.WriteLine("Consult the Java source code at testsrc/org/mozilla/javascript/JsDriver.java for details.");
System.Environment.Exit(0);
}
ShellContextFactory factory = new ShellContextFactory();
factory.SetOptimizationLevel(arguments.GetOptimizationLevel());
factory.SetStrictMode(arguments.IsStrict());
FilePath path = arguments.GetTestsPath();
if (path == null)
{
path = new FilePath("../tests");
}
if (!path.Exists())
{
throw new Exception("JavaScript tests not found at " + path.GetCanonicalPath());
}
JsDriver.Tests tests = new JsDriver.Tests(path, arguments.GetTestList(), arguments.GetSkipList());
JsDriver.Tests.Script[] all = tests.GetFiles();
arguments.GetConsole().Println("Running " + all.Length + " tests.");
JsDriver.Results results = new JsDriver.Results(factory, arguments, arguments.Trace());
results.Start();
for (int i = 0; i < all.Length; i++)
{
results.Run(all[i], new JsDriver.ShellTestParameters(arguments.GetTimeout()));
}
results.Finish();
}