Commit c54a24f0 authored by Jesse McGrew's avatar Jesse McGrew
Browse files

Stop using obsolete non-async ZMachine methods in tests.

parent 1ebe962ef45d
......@@ -21,6 +21,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Zilf.Diagnostics;
......@@ -184,33 +185,33 @@ namespace Zilf.Tests.Integration
this.body = body;
}
public void Compiles()
public async Task CompilesAsync()
{
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);
var result = await ZlrHelper.RunAsync(testCode, null, compileOnly: true, wantDebugInfo: wantDebugInfo);
Assert.AreEqual(ZlrTestStatus.Finished, result.Status);
CheckWarnings(result);
}
public void DoesNotCompile()
public async Task DoesNotCompileAsync()
{
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);
var result = await ZlrHelper.RunAsync(testCode, null, compileOnly: true, wantDebugInfo: wantDebugInfo);
Assert.AreEqual(ZlrTestStatus.CompilationFailed, result.Status);
CheckWarnings(result);
}
public void DoesNotThrow()
public async Task DoesNotThrowAsync()
{
var testCode = $"{GlobalCode()}\r\n" +
$"<ROUTINE GO ({argSpec})\r\n" +
......@@ -221,7 +222,7 @@ namespace Zilf.Tests.Integration
try
{
result = ZlrHelper.Run(testCode, null, compileOnly: true, wantDebugInfo: wantDebugInfo);
result = await ZlrHelper.RunAsync(testCode, null, compileOnly: true, wantDebugInfo: wantDebugInfo);
}
catch (Exception ex)
{
......@@ -243,23 +244,23 @@ namespace Zilf.Tests.Integration
{
protected abstract string Expression();
public void GivesNumber(string expectedValue)
public async Task GivesNumberAsync(string expectedValue)
{
var testCode = $"{GlobalCode()}\r\n" +
$"<ROUTINE GO () <PRINTN {Expression()}>>";
ZlrHelper.RunAndAssert(testCode, input.ToString(), expectedValue, warningChecks);
await ZlrHelper.RunAndAssertAsync(testCode, input.ToString(), expectedValue, warningChecks);
}
public void Outputs(string expectedValue)
public async Task OutputsAsync(string expectedValue)
{
var testCode = $"{GlobalCode()}\r\n" +
$"<ROUTINE GO () {Expression()}>";
ZlrHelper.RunAndAssert(testCode, input.ToString(), expectedValue, warningChecks, wantCompileOutput);
await ZlrHelper.RunAndAssertAsync(testCode, input.ToString(), expectedValue, warningChecks, wantCompileOutput);
}
public void Implies(params string[] conditions)
public async Task ImpliesAsync(params string[] conditions)
{
var sb = new StringBuilder();
foreach (var c in conditions)
......@@ -275,10 +276,10 @@ namespace Zilf.Tests.Integration
$"<ROUTINE TEST-IMPLIES (\"AUX\" FAILS) {sb} .FAILS>\r\n" +
"<ROUTINE GO () <OR <TEST-IMPLIES> <PRINTI \"PASS\">>>";
ZlrHelper.RunAndAssert(testCode, input.ToString(), "PASS", warningChecks);
await ZlrHelper.RunAndAssertAsync(testCode, input.ToString(), "PASS", warningChecks);
}
public void DoesNotCompile(Predicate<ZlrHelperRunResult>? resultFilter = null,
public async Task DoesNotCompileAsync(Predicate<ZlrHelperRunResult>? resultFilter = null,
string? message = null)
{
var testCode =
......@@ -288,7 +289,7 @@ namespace Zilf.Tests.Integration
$"\t<SETG DUMMY?VAR {Expression()}>\r\n" +
"\t<QUIT>>";
var result = ZlrHelper.Run(testCode, null, compileOnly: true, wantDebugInfo: wantDebugInfo);
var result = await ZlrHelper.RunAsync(testCode, null, compileOnly: true, wantDebugInfo: wantDebugInfo);
Assert.AreEqual(ZlrTestStatus.CompilationFailed, result.Status);
CheckWarnings(result);
......@@ -299,9 +300,9 @@ namespace Zilf.Tests.Integration
}
}
public void DoesNotCompile(string diagnosticCode, Predicate<Diagnostic>? diagFilter = null)
public async Task DoesNotCompileAsync(string diagnosticCode, Predicate<Diagnostic>? diagFilter = null)
{
DoesNotCompile(res =>
await DoesNotCompileAsync(res =>
{
var diag = res.Diagnostics.FirstOrDefault(d => d.Code == diagnosticCode);
return diag != null && (diagFilter == null || diagFilter(diag));
......@@ -309,7 +310,7 @@ namespace Zilf.Tests.Integration
$"Expected diagnostic {diagnosticCode} was not produced");
}
public void Compiles()
public async Task CompilesAsync()
{
var testCode =
$"{GlobalCode()}\r\n" +
......@@ -318,40 +319,38 @@ namespace Zilf.Tests.Integration
$"\t<SETG DUMMY?VAR {Expression()}>\r\n" +
"\t<QUIT>>";
var result = ZlrHelper.Run(testCode, null, compileOnly: true, wantDebugInfo: wantDebugInfo);
var result = await ZlrHelper.RunAsync(testCode, null, compileOnly: true, wantDebugInfo: wantDebugInfo);
Assert.IsTrue(result.Status > ZlrTestStatus.CompilationFailed,
"Failed to compile");
CheckWarnings(result);
}
public CodeMatchingResult GeneratesCodeMatching(string pattern)
public async Task<CodeMatchingResult> GeneratesCodeMatchingAsync(string pattern)
{
return GeneratesCodeMatching(CheckOutputMatches(pattern));
return await GeneratesCodeMatchingAsync(output => CheckOutputMatches(output, pattern));
}
static Action<string> CheckOutputMatches(string pattern)
public static void CheckOutputMatches(string output, string pattern)
{
return output =>
Assert.IsTrue(
Regex.IsMatch(output, pattern, RegexOptions.Singleline | RegexOptions.Multiline),
"Output did not match. Expected pattern: " + pattern);
Assert.IsTrue(
Regex.IsMatch(output, pattern, RegexOptions.Singleline | RegexOptions.Multiline),
"Output did not match. Expected pattern: " + pattern);
}
public CodeMatchingResult GeneratesCodeNotMatching(string pattern)
public async Task<CodeMatchingResult> GeneratesCodeNotMatchingAsync(string pattern)
{
return GeneratesCodeMatching(CheckOutputDoesNotMatch(pattern));
return await GeneratesCodeMatchingAsync(output => CheckOutputDoesNotMatch(output, pattern));
}
static Action<string> CheckOutputDoesNotMatch(string pattern)
public static void CheckOutputDoesNotMatch(string output, string pattern)
{
return output =>
Assert.IsFalse(
Regex.IsMatch(output, pattern, RegexOptions.Singleline | RegexOptions.Multiline),
"Output should not have matched. Anti-pattern: " + pattern);
Assert.IsFalse(
Regex.IsMatch(output, pattern, RegexOptions.Singleline | RegexOptions.Multiline),
"Output should not have matched. Anti-pattern: " + pattern);
}
CodeMatchingResult GeneratesCodeMatching(Action<string> checkGeneratedCode)
Task<CodeMatchingResult> GeneratesCodeMatchingAsync(Action<string> checkGeneratedCode)
{
var testCode = $"{GlobalCode()}\r\n" +
"<ROUTINE GO ()\r\n" +
......@@ -371,7 +370,7 @@ namespace Zilf.Tests.Integration
SuppressedWarningCount = helper.SuppressedWarningCount,
});
return new CodeMatchingResult(output);
return Task.FromResult(new CodeMatchingResult(output));
}
public sealed class CodeMatchingResult
......@@ -382,18 +381,27 @@ namespace Zilf.Tests.Integration
{
this.Output = output;
}
}
}
public CodeMatchingResult AndMatching(string pattern)
{
CheckOutputMatches(pattern)(Output);
return this;
}
public static class CodeMatchingResultTaskExtensions
{
public static async Task<AbstractAssertionHelperWithEntryPoint<T>.CodeMatchingResult> AndMatching<T>(
this Task<AbstractAssertionHelperWithEntryPoint<T>.CodeMatchingResult> task, string pattern)
where T : AbstractAssertionHelperWithEntryPoint<T>
{
var result = await task;
AbstractAssertionHelperWithEntryPoint<T>.CheckOutputMatches(result.Output, pattern);
return result;
}
public CodeMatchingResult AndNotMatching(string pattern)
{
CheckOutputDoesNotMatch(pattern)(Output);
return this;
}
public static async Task<AbstractAssertionHelperWithEntryPoint<T>.CodeMatchingResult> AndNotMatching<T>(
this Task<AbstractAssertionHelperWithEntryPoint<T>.CodeMatchingResult> task, string pattern)
where T : AbstractAssertionHelperWithEntryPoint<T>
{
var result = await task;
AbstractAssertionHelperWithEntryPoint<T>.CheckOutputDoesNotMatch(result.Output, pattern);
return result;
}
}
......@@ -465,9 +473,9 @@ namespace Zilf.Tests.Integration
this.code = code;
}
public void Outputs(string expectedValue)
public async Task OutputsAsync(string expectedValue)
{
ZlrHelper.RunAndAssert(code, null, expectedValue);
await ZlrHelper.RunAndAssertAsync(code, null, expectedValue);
}
}
}
This diff is collapsed.
......@@ -24,6 +24,7 @@ using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Zilf.Tests.Integration
{
......@@ -82,7 +83,7 @@ namespace Zilf.Tests.Integration
[DataTestMethod]
[DynamicData(nameof(GetProjects), DynamicDataSourceType.Method)]
[Timeout(PerTestTimeoutMilliseconds)]
public void TestProjects(string baseName, string dir, string mainZilFile)
public async Task TestProjectsAsync(string baseName, string dir, string mainZilFile)
{
Console.WriteLine("Testing {0}", dir);
......@@ -102,7 +103,7 @@ namespace Zilf.Tests.Integration
if (testExecution)
{
var actualOutput = helper.Execute();
var actualOutput = await helper.ExecuteAsync();
var massagedActual = MassageText(actualOutput);
var massagedExpected = MassageText(File.ReadAllText(outputFile));
......
......@@ -30,7 +30,7 @@ namespace Zilf.Tests.Integration
[DataRow("YZIP", DisplayName = "V6")]
[DataRow("7", DisplayName = "V7")]
[DataRow("8", DisplayName = "V8")]
public void HelloWorld(string zversion)
public async System.Threading.Tasks.Task HelloWorldAsync(string zversion)
{
string code = $@"
<VERSION {zversion}>
......@@ -46,7 +46,7 @@ namespace Zilf.Tests.Integration
<QUIT>>";
const string expectedOutput = "Hello, world!\n";
AssertRaw(code).Outputs(expectedOutput);
await AssertRaw(code).OutputsAsync(expectedOutput);
}
}
}
......@@ -17,6 +17,7 @@
*/
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
namespace Zilf.Tests.Integration
{
......@@ -24,50 +25,50 @@ namespace Zilf.Tests.Integration
public class MacroTests : IntegrationTestClass
{
[TestMethod]
public void SPLICEs_Should_Work_Inside_Routines()
public async Task SPLICEs_Should_Work_Inside_Routines()
{
// void context
AssertRoutine("", "<VARIOUS-THINGS> T")
await AssertRoutine("", "<VARIOUS-THINGS> T")
.WithGlobal("<DEFMAC VARIOUS-THINGS () <CHTYPE '(<TELL \"hello\"> <TELL CR> <TELL \"world\">) SPLICE>>")
.Outputs("hello\nworld");
.OutputsAsync("hello\nworld");
// value context
AssertRoutine("", "<VARIOUS-THINGS>")
await AssertRoutine("", "<VARIOUS-THINGS>")
.WithGlobal("<DEFMAC VARIOUS-THINGS () <CHTYPE '(123 456) SPLICE>>")
.GivesNumber("456");
.GivesNumberAsync("456");
}
[TestMethod]
public void Macro_Call_With_Wrong_Argument_Count_Should_Raise_An_Error()
public async Task Macro_Call_With_Wrong_Argument_Count_Should_Raise_An_Error()
{
AssertRoutine("\"AUX\" S", "<SET S <FOO A>>")
await AssertRoutine("\"AUX\" S", "<SET S <FOO A>>")
.WithGlobal("<DEFMAC FOO ('X 'Y 'Z) <FORM TELL \"hello world\" CR>>")
.DoesNotCompile();
.DoesNotCompileAsync();
}
[TestMethod]
public void Macros_Can_Define_Globals_Inside_Routines()
public async Task Macros_Can_Define_Globals_Inside_Routines()
{
AssertRoutine("", "<PRINTN <MAKE-GLOBAL 123>>")
await AssertRoutine("", "<PRINTN <MAKE-GLOBAL 123>>")
.WithGlobal("<DEFMAC MAKE-GLOBAL (N) <EVAL <FORM GLOBAL NEW-GLOBAL .N>> ',NEW-GLOBAL>")
.Outputs("123");
.OutputsAsync("123");
}
[TestMethod]
public void Macros_Can_Be_Used_In_Local_Initializers()
public async Task Macros_Can_Be_Used_In_Local_Initializers()
{
AssertRoutine("\"AUX\" (X <MY-VALUE>)", ".X")
await AssertRoutine("\"AUX\" (X <MY-VALUE>)", ".X")
.WithGlobal("<DEFMAC MY-VALUE () 123>")
.GivesNumber("123");
.GivesNumberAsync("123");
}
[TestMethod, TestCategory("Reader Macros")]
public void MAKE_PREFIX_MACRO_Should_Work()
public async Task MAKE_PREFIX_MACRO_Should_Work()
{
AssertExpr(@"<TELL B @HELLO "" "" B @WORLD CR>")
await AssertExpr(@"<TELL B @HELLO "" "" B @WORLD CR>")
.WithGlobal(@"<USE ""READER-MACROS"">")
.WithGlobal(@"<MAKE-PREFIX-MACRO !\@ <FUNCTION (W:ATOM) <VOC <SPNAME .W> BUZZ>>>")
.Outputs("hello world\n");
.OutputsAsync("hello world\n");
}
}
......
......@@ -17,6 +17,7 @@
*/
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
using Zilf.Diagnostics;
namespace Zilf.Tests.Integration
......@@ -25,126 +26,126 @@ namespace Zilf.Tests.Integration
public class MetaTests : IntegrationTestClass
{
[TestMethod]
public void TestIFFLAG()
public async Task TestIFFLAG()
{
AssertRoutine("", "<IFFLAG (FOO 123) (ELSE 456)>")
await AssertRoutine("", "<IFFLAG (FOO 123) (ELSE 456)>")
.WithGlobal("<COMPILATION-FLAG FOO T>")
.GivesNumber("123");
.GivesNumberAsync("123");
AssertRoutine("", "<IFFLAG (FOO 123) (ELSE 456)>")
await AssertRoutine("", "<IFFLAG (FOO 123) (ELSE 456)>")
.WithGlobal("<COMPILATION-FLAG FOO <>>")
.GivesNumber("456");
.GivesNumberAsync("456");
AssertRoutine("", "<IFFLAG (\"FOO\" 123) (ELSE 456)>")
await AssertRoutine("", "<IFFLAG (\"FOO\" 123) (ELSE 456)>")
.WithGlobal("<COMPILATION-FLAG FOO <>>")
.GivesNumber("456");
.GivesNumberAsync("456");
}
[TestMethod]
public void Property_Names_Are_Shared_Across_Packages()
public async Task Property_Names_Are_Shared_Across_Packages()
{
AssertGlobals(
await AssertGlobals(
"<DEFINITIONS \"FOO\"> <OBJECT FOO-OBJ (MY-PROP 123)> <END-DEFINITIONS>",
"<DEFINITIONS \"BAR\"> <OBJECT BAR-OBJ (MY-PROP 456)> <END-DEFINITIONS>",
"<ROUTINE FOO () <GETP <> ,P?MY-PROP>>")
.Compiles();
.CompilesAsync();
}
[TestMethod]
public void Object_Names_Are_Shared_Across_Packages()
public async Task Object_Names_Are_Shared_Across_Packages()
{
AssertGlobals(
await AssertGlobals(
"<DEFINITIONS \"FOO\"> <OBJECT FOO-OBJ> <END-DEFINITIONS>",
"<DEFINITIONS \"BAR\"> <OBJECT BAR-OBJ (LOC FOO-OBJ)> <END-DEFINITIONS>",
"<ROUTINE FOO () <REMOVE ,FOO-OBJ>>")
.WithoutWarnings()
.Compiles();
.CompilesAsync();
AssertGlobals(
await AssertGlobals(
"<SET REDEFINE T>",
"<DEFINITIONS \"FOO\"> <OBJECT MY-OBJ> <END-DEFINITIONS>",
"<DEFINITIONS \"BAR\"> <OBJECT MY-OBJ> <END-DEFINITIONS>",
"<DEFINITIONS \"BAZ\"> <OBJECT MY-OBJ> <END-DEFINITIONS>")
.WithoutWarnings()
.Compiles();
.CompilesAsync();
}
[TestMethod]
public void Constant_Names_Are_Shared_Across_Packages()
public async Task Constant_Names_Are_Shared_Across_Packages()
{
AssertGlobals(
await AssertGlobals(
"<DEFINITIONS \"FOO\"> <CONSTANT MY-CONST 1> <END-DEFINITIONS>",
"<DEFINITIONS \"BAR\"> <CONSTANT MY-CONST 1> <END-DEFINITIONS>",
"<ROUTINE FOO () <PRINT ,MY-CONST>>")
.Compiles();
.CompilesAsync();
AssertGlobals(
await AssertGlobals(
"<DEFINITIONS \"FOO\"> <CONSTANT MY-CONST 1> <END-DEFINITIONS>",
"<DEFINITIONS \"BAR\"> <CONSTANT MY-CONST 2> <END-DEFINITIONS>",
"<ROUTINE FOO () <PRINT ,MY-CONST>>")
.DoesNotCompile();
.DoesNotCompileAsync();
}
[TestMethod]
public void Global_Names_Are_Shared_Across_Packages()
public async Task Global_Names_Are_Shared_Across_Packages()
{
AssertGlobals(
await AssertGlobals(
"<SET REDEFINE T>",
"<DEFINITIONS \"FOO\"> <GLOBAL MY-GLOBAL <TABLE 1 2 3>> <END-DEFINITIONS>",
"<DEFINITIONS \"BAR\"> <GLOBAL MY-GLOBAL <TABLE 1 2 3>> <END-DEFINITIONS>",
"<ROUTINE FOO () <PRINT ,MY-GLOBAL>>")
.Compiles();
.CompilesAsync();
AssertGlobals(
await AssertGlobals(
"<DEFINITIONS \"FOO\"> <GLOBAL MY-GLOBAL <TABLE 1 2 3>> <END-DEFINITIONS>",
"<DEFINITIONS \"BAR\"> <GLOBAL MY-GLOBAL <TABLE 1 2 3>> <END-DEFINITIONS>",
"<ROUTINE FOO () <PRINT ,MY-GLOBAL>>")
.DoesNotCompile();
.DoesNotCompileAsync();
}
[TestMethod]
public void Routine_Names_Are_Shared_Across_Packages()
public async Task Routine_Names_Are_Shared_Across_Packages()
{
AssertGlobals(
await AssertGlobals(
"<DEFINITIONS \"FOO\"> <ROUTINE FOO () <BAR>> <END-DEFINITIONS>",
"<ROUTINE BAR () <FOO>>")
.Compiles();
.CompilesAsync();
AssertGlobals(
await AssertGlobals(
"<SET REDEFINE T>",
"<DEFINITIONS \"FOO\"> <ROUTINE FOO () <BAR>> <END-DEFINITIONS>",
"<DEFINITIONS \"BAR\"> <ROUTINE FOO () <BAR>> <END-DEFINITIONS>",
"<ROUTINE BAR () <FOO>>")
.Compiles();
.CompilesAsync();
AssertGlobals(
await AssertGlobals(
"<SET REDEFINE T>",
"<DEFINITIONS \"FOO\"> <ROUTINE FOO () <BAR>> <END-DEFINITIONS>",
"<DEFINITIONS \"BAR\"> <ROUTINE FOO () <BAR>> <END-DEFINITIONS>",
"<DEFINITIONS \"BAZ\"> <ROUTINE FOO () <BAR>> <END-DEFINITIONS>",
"<ROUTINE BAR () <FOO>>")
.Compiles();
.CompilesAsync();
AssertGlobals(
await AssertGlobals(
"<SET REDEFINE T>",
"<DEFINITIONS \"FOO\"> <ROUTINE FOO () <BAR>> <END-DEFINITIONS>",
"<DEFINITIONS \"BAR\"> <ROUTINE FOO () <BAR>> <END-DEFINITIONS>",
"<DEFINITIONS \"BAZ\"> <ROUTINE FOO () <BAR>> <END-DEFINITIONS>",
"<DEFINITIONS \"QUUX\"> <ROUTINE FOO () <BAR>> <END-DEFINITIONS>",
"<ROUTINE BAR () <FOO>>")
.Compiles();
.CompilesAsync();
AssertGlobals(
await AssertGlobals(
"<DEFINITIONS \"FOO\"> <ROUTINE FOO () <BAR>> <END-DEFINITIONS>",
"<DEFINITIONS \"BAR\"> <ROUTINE FOO () <BAR>> <END-DEFINITIONS>",
"<ROUTINE BAR () <FOO>>")
.DoesNotCompile();
.DoesNotCompileAsync();
}
[TestMethod]
public void IN_ZILCH_Indicates_What_Macro_Expansions_Will_Be_Used_For()
public async Task IN_ZILCH_Indicates_What_Macro_Expansions_Will_Be_Used_For()
{
AssertRoutine("", "<HELLO \"Z-machine\">")
await AssertRoutine("", "<HELLO \"Z-machine\">")
.WithGlobal(@"
<DEFMAC HELLO (WHENCE)
<FORM BIND '()
......@@ -153,11 +154,11 @@ namespace Zilf.Tests.Integration
<FORM CRLF>>>")
.WithGlobal("<HELLO \"MDL\">")
.CapturingCompileOutput()
.Outputs("Hello from MDL\nHello from Z-machine\n");
.OutputsAsync("Hello from MDL\nHello from Z-machine\n");
}
[TestMethod]
public void ROUTINE_REWRITER_Can_Rewrite_Routines()
public async Task ROUTINE_REWRITER_Can_Rewrite_Routines()
{
const string SMyRewriter = @"
<DEFINE MY-REWRITER (NAME ARGS BODY)
......@@ -167,17 +168,17 @@ namespace Zilf.Tests.Integration
<FORM BIND ((RES <FORM PROG '() !.BODY>)) <FORM TELL ""Return: "" N '.RES CR> '.RES>)>
<LIST .ARGS !.BODY>)>>";
AssertRoutine("NAME", "<TELL \"Hello, \" .NAME \".\" CR>")
await AssertRoutine("NAME", "<TELL \"Hello, \" .NAME \".\" CR>")
.WithGlobal(SMyRewriter)
.WithGlobal("<SETG REWRITE-ROUTINE!-HOOKS!-ZILF ,MY-REWRITER>")
.WhenCalledWith("\"world\"")
.Outputs("Arg: world\nHello, world.\nReturn: 1\n");
.OutputsAsync("Arg: world\nHello, world.\nReturn: 1\n");
// TODO: make sure rewritten routine has the same routine flags as the original
}
[TestMethod]
public void PRE_COMPILE_Hook_Can_Add_To_Compilation_Environment()
public async Task PRE_COMPILE_Hook_Can_Add_To_Compilation_Environment()
{
const string SMyHook = @"
<DEFINE MY-PRE-COMPILE (""AUX"" ROUTINES)
......@@ -200,25 +201,25 @@ namespace Zilf.Tests.Integration
<FUNCTION (A) <FORM TELL <SPNAME .A> CR>>
<SORT <> .ROUTINES>>>>>";
AssertRoutine("", "<LIST-ROUTINES>")
await AssertRoutine("", "<LIST-ROUTINES>")
.WithGlobal(SMyHook)
.WithGlobal("<SETG PRE-COMPILE!-HOOKS!-ZILF ,MY-PRE-COMPILE>")
.Outputs("GO\nTEST?ROUTINE\n");
.OutputsAsync("GO\nTEST?ROUTINE\n");
}
[DataTestMethod]
[DataRow(3), DataRow(4), DataRow(5), DataRow(6), DataRow(7), DataRow(8)]
public void RELEASEID_Is_Optional(int zversion)
public async Task RELEASEID_Is_Optional(int zversion)
{
string code =
$"<VERSION {zversion}>\n" +
"<ROUTINE GO () <PRINTN <GET 2 0>> <CRLF> <QUIT>>";
AssertRaw(code).Outputs("0\n");
await AssertRaw(code).OutputsAsync("0\n");
}
[TestMethod]
public void Compilation_Stops_After_100_Errors()
public async Task Compilation_Stops_After_100_Errors()
{
var builder = AssertRoutine("", "T");
......@@ -227,46 +228,46 @@ namespace Zilf.Tests.Integration
builder = builder.WithGlobal($"<ROUTINE DUMMY-{i} () <THIS-IS-INVALID>>");