internal virtual void Run(JsDriver.Tests.Script script, ShellTest.Parameters parameters) { string path = script.GetPath(); FilePath test = script.GetFile(); JsDriver.ConsoleStatus cStatus = new JsDriver.ConsoleStatus(arguments.GetConsole(), trace); JsDriver.HtmlStatus hStatus = new JsDriver.HtmlStatus(arguments.GetLxrUrl(), arguments.GetBugUrl(), path, html, (XmlElement)failureHtml.CloneNode(true)); JsDriver.XmlStatus xStatus = new JsDriver.XmlStatus(path, this.xml.DocumentElement); ShellTest.Status status = ShellTest.Status.Compose(new ShellTest.Status[] { cStatus, hStatus, xStatus }); try { ShellTest.Run(factory, test, parameters, status); } catch (Exception e) { throw new Exception(e); } tests++; if (hStatus.Failed()) { failures++; } hStatus.Finish(); }
public _ContextAction_280(ShellTest.Status status, FilePath jsFile, ShellTest.TestState testState, Global global) { this.status = status; this.jsFile = jsFile; this.testState = testState; this.global = global; }
public void HadErrors(ShellTest.Status.JsError[] errors) { if (!negative && errors.Length > 0) { Failed("JavaScript errors:\n" + ShellTest.Status.JsError.ToString(errors)); } else { if (negative && errors.Length == 0) { Failed("Should have produced runtime error."); } } }
public _Runnable_274(ShellContextFactory shellContextFactory, Exception[] thrown, ShellTest.TestState testState, ShellTest.Status status, FilePath jsFile, Global global) { this.shellContextFactory = shellContextFactory; this.thrown = thrown; this.testState = testState; this.status = status; this.jsFile = jsFile; this.global = global; }
/// <exception cref="System.Exception"></exception> public static void Run(ShellContextFactory shellContextFactory, FilePath jsFile, ShellTest.Parameters parameters, ShellTest.Status status) { Global global = new Global(); MemoryStream @out = new MemoryStream(); TextWriter p = new TextWriter(@out); global.SetOut(p); global.SetErr(p); global.DefineFunctionProperties(new string[] { "options" }, typeof(ShellTest), ScriptableObject.DONTENUM | ScriptableObject.PERMANENT | ScriptableObject.READONLY); // test suite expects keywords to be disallowed as identifiers shellContextFactory.SetAllowReservedKeywords(false); ShellTest.TestState testState = new ShellTest.TestState(); if (jsFile.GetName().EndsWith("-n.js")) { status.SetNegative(); } Exception[] thrown = new Exception[] { null }; Sharpen.Thread t = new Sharpen.Thread(new _Runnable_274(shellContextFactory, thrown, testState, status, jsFile, global), jsFile.GetPath()); t.SetDaemon(true); t.Start(); t.Join(parameters.GetTimeoutMilliseconds()); lock (testState) { if (!testState.finished) { CallStop(t); status.TimedOut(); } } int expectedExitCode = 0; p.Flush(); status.OutputWas(Sharpen.Runtime.GetStringForBytes(@out.ToArray())); BufferedReader r = new BufferedReader(new StreamReader(new MemoryStream(@out.ToArray()))); string failures = string.Empty; for (; ; ) { string s = r.ReadLine(); if (s == null) { break; } if (s.IndexOf("FAILED!") != -1) { failures += s + '\n'; } int expex = s.IndexOf("EXPECT EXIT CODE "); if (expex != -1) { expectedExitCode = s[expex + "EXPECT EXIT CODE ".Length] - '0'; } } if (thrown[0] != null) { status.Threw(thrown[0]); } status.ExitCodesWere(expectedExitCode, testState.exitCode); if (failures != string.Empty) { status.Failed(failures); } }
internal static string ToString(ShellTest.Status.JsError[] e) { string rv = string.Empty; for (int i = 0; i < e.Length; i++) { rv += e[i].ToString(); if (i + 1 != e.Length) { rv += "\n"; } } return rv; }
public _Status_96(ShellTest.Status[] array) { this.array = array; }
internal static ShellTest.Status Compose(ShellTest.Status[] array) { return new _Status_96(array); }