public void DoesNotThrow() { var testCode = $"{GlobalCode()}\r\n" + $"<ROUTINE GO ({argSpec})\r\n" + $"\t{body}\r\n" + "\t<QUIT>>"; ZlrHelperRunResult result; try { result = ZlrHelper.Run(testCode, null, compileOnly: true, wantDebugInfo: wantDebugInfo); } catch (Exception ex) { Assert.Fail("Expected no exception, but caught {0}", ex); // can't get here, but the compiler doesn't know that... // ReSharper knows, but we still can't remove the return // ReSharper disable once HeuristicUnreachableCode return; } CheckWarnings(result); }
public void DoesNotCompile() { var testCode = $"{GlobalCode()}\r\n" + $"<ROUTINE GO ({argSpec})\r\n" + $"\t{body}\r\n" + "\t<QUIT>>"; var result = ZlrHelper.Run(testCode, null, compileOnly: true, wantDebugInfo: wantDebugInfo); Assert.AreEqual(ZlrTestStatus.CompilationFailed, result.Status); CheckWarnings(result); }
public void Compiles() { var testCode = $"{GlobalCode()}\r\n" + "<GLOBAL DUMMY?VAR <>>\r\n" + "<ROUTINE GO ()\r\n" + $"\t<SETG DUMMY?VAR {Expression()}>\r\n" + "\t<QUIT>>"; var result = ZlrHelper.Run(testCode, null, compileOnly: true, wantDebugInfo: wantDebugInfo); Assert.IsTrue(result.Status > ZlrTestStatus.CompilationFailed, "Failed to compile"); CheckWarnings(result); }
public void DoesNotCompile([CanBeNull] Predicate <ZlrHelperRunResult> resultFilter = null, [CanBeNull] string message = null) { var testCode = $"{GlobalCode()}\r\n" + "<GLOBAL DUMMY?VAR <>>\r\n" + "<ROUTINE GO ()\r\n" + $"\t<SETG DUMMY?VAR {Expression()}>\r\n" + "\t<QUIT>>"; var result = ZlrHelper.Run(testCode, null, compileOnly: true, wantDebugInfo: wantDebugInfo); Assert.AreEqual(ZlrTestStatus.CompilationFailed, result.Status); CheckWarnings(result); if (resultFilter != null) { Assert.IsTrue(resultFilter(result), message ?? "Result filter failed"); } }