public static void Test(string input, string output, IMessageSink sink, int maxExpand = 0xFFFF, params string[] preOpenedNamespaces) { var c = new TestCompiler(sink, new UString(input), preOpenedNamespaces); c.MaxExpansions = maxExpand; c.MacroProcessor.AbortTimeout = TimeSpan.Zero; // never timeout (avoids spawning a new thread) c.Run(); // uses ParsingService.Default and default LNode.Printer Assert.AreEqual(StripExtraWhitespace(output), StripExtraWhitespace(c.Output.ToString())); }
public static void Test(string input, string output, IMessageSink sink, int maxExpand = 0xFFFF) { using (LNode.PushPrinter(new EcsNodePrinter(null, null) { PreferPlainCSharp = true }.Print)) { var c = new TestCompiler(sink, new UString(input), ""); c.MaxExpansions = maxExpand; c.MacroProcessor.AbortTimeout = TimeSpan.Zero; // never timeout (avoids spawning a new thread) c.Run(); Assert.AreEqual(StripExtraWhitespace(output), StripExtraWhitespace(c.Output.ToString())); } }
public static void Test(string input, string output, IMessageSink sink, int maxExpand = 0xFFFF) { using (LNode.PushPrinter(Ecs.EcsNodePrinter.Printer)) { var c = new TestCompiler(sink, new UString(input), ""); c.MaxExpansions = maxExpand; c.MacroProcessor.AbortTimeout = TimeSpan.Zero; // never timeout (avoids spawning a new thread) c.Run(); Assert.AreEqual(StripExtraWhitespace(output), StripExtraWhitespace(c.Output.ToString())); } }
public static void Test(string input, string output, IMessageSink sink, int maxExpand = 0xFFFF, bool plainCS = true) { ILNodePrinter printer = plainCS ? EcsLanguageService.WithPlainCSharpPrinter : EcsLanguageService.Value; using (LNode.SetPrinter(printer)) { var c = new TestCompiler(sink, new UString(input), ""); c.MaxExpansions = maxExpand; c.MacroProcessor.AbortTimeout = TimeSpan.Zero; // never timeout (avoids spawning a new thread) c.Run(); Assert.AreEqual(StripExtraWhitespace(output), StripExtraWhitespace(c.Output.ToString())); } }
private void Test(string input, IParsingService inLang, string expected, IParsingService outLang, int maxExpand = 0xFFFF) { var lemp = NewLemp(maxExpand); var inputCode = new RVList <LNode>(inLang.Parse(input, _sink)); var results = lemp.ProcessSynchronously(inputCode); var expectCode = outLang.Parse(expected, _sink); if (!results.SequenceEqual(expectCode)) { // TEST FAILED, print error string resultStr = results.Select(n => outLang.Print(n, _sink)).Join("\n"); Assert.AreEqual(TestCompiler.StripExtraWhitespace(expected), TestCompiler.StripExtraWhitespace(resultStr)); } }
private void Test(string input, string output, int maxExpand = 0xFFFF) { TestCompiler.Test(input, output, _sink, maxExpand); }
private void Test(string input, string output, int maxExpand = 0xFFFF, IParsingService parser = null, ILNodePrinter printer = null, IMessageSink sink = null) { using (ParsingService.SetDefault(parser ?? Les2LanguageService.Value)) using (LNode.SetPrinter(printer ?? EcsLanguageService.WithPlainCSharpPrinter)) TestCompiler.Test(input, output, sink ?? _sink, maxExpand, "LeMP.les2.to.ecs"); }