public static void TestCompileProgramWithError(string compiland, string expectedError) { using (TestCompilerContext context = TestCompilerContext.Create(compiland, null, CompilationFlags.NoDebug)) { context.ParseProgram(); Assert.IsTrue(context.ErrorCount > 0, "Expecting compiler error"); Assert.AreEqual(expectedError, context.FirstError); } }
public static void TestStatementParserWithError(string compiland, GlobalSymbolList symbols, string expectedError) { using (TestCompilerContext context = TestCompilerContext.Create(compiland, symbols, CompilationFlags.NoDebug)) { context.ParseStatement(); Assert.IsTrue(context.ErrorCount > 0, "Expecting compiler error"); Assert.AreEqual(expectedError, context.FirstError); } }
public static string TestStatementParser(string compiland, GlobalSymbolList symbols = null) { using (TestCompilerContext context = TestCompilerContext.Create(compiland, symbols, CompilationFlags.NoDebug)) { context.ParseStatement(); Assert.AreEqual(0, context.ErrorCount, context.FirstError.ToString()); return(context.GetCompilerOutput()); } }
public static string TestCompileProgram(string compiland, bool writeDebugInfo = false) { CompilationFlags flags = writeDebugInfo ? CompilationFlags.None : CompilationFlags.NoDebug; using (TestCompilerContext context = TestCompilerContext.Create(compiland, null, flags)) { context.ParseProgram(); Assert.AreEqual(0, context.ErrorCount, context.FirstError.ToString()); return(context.GetCompilerOutput()); } }