Пример #1
0
 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);
     }
 }
Пример #2
0
 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);
     }
 }
Пример #3
0
 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());
     }
 }
Пример #4
0
        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());
            }
        }