本文整理汇总了C#中DefaultSprakRunner.getCompileTimeErrorHandler方法的典型用法代码示例。如果您正苦于以下问题:C# DefaultSprakRunner.getCompileTimeErrorHandler方法的具体用法?C# DefaultSprakRunner.getCompileTimeErrorHandler怎么用?C# DefaultSprakRunner.getCompileTimeErrorHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DefaultSprakRunner
的用法示例。
在下文中一共展示了DefaultSprakRunner.getCompileTimeErrorHandler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Assignment
public void Assignment()
{
StringReader programString = new StringReader("number a = 5");
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
}
示例2: AllowWhitespaceAsCommaInFunctionCall
public void AllowWhitespaceAsCommaInFunctionCall()
{
TextReader programString = File.OpenText("code83.txt");
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
program.printOutputToConsole();
program.getCompileTimeErrorHandler().printErrorsToConsole();
Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
Assert.AreEqual(0, program.getRuntimeErrorHandler().getErrors().Count);
Assert.AreEqual(1, program.Output.Count);
Assert.AreEqual("500", program.Output[0]);
}
示例3: BasicArrayCreation
public void BasicArrayCreation()
{
TextReader programString = File.OpenText("code55.txt");
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
program.printOutputToConsole();
Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
Assert.AreEqual("[3, 4, 5, 6]", program.Output[0]);
}
示例4: Bools
public void Bools()
{
TextReader programString = File.OpenText("code48.txt");
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
program.printOutputToConsole();
Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
Assert.AreEqual("true", program.Output[0]);
Assert.AreEqual("false", program.Output[1]);
}
示例5: AllowMissingTypesInArgumentDeclaration
public void AllowMissingTypesInArgumentDeclaration()
{
StringReader programString = new StringReader(
@"
void f(x)
end
"
);
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
program.printOutputToConsole ();
program.getCompileTimeErrorHandler().printErrorsToConsole ();
program.getRuntimeErrorHandler().printErrorsToConsole ();
Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
Assert.AreEqual(0, program.getRuntimeErrorHandler().getErrors().Count);
Assert.AreEqual(0, program.Output.Count);
}
示例6: AllowPlusSignBeforeNumbers
public void AllowPlusSignBeforeNumbers()
{
StringReader programString = new StringReader(
@"
var a = +10
var b = -2
print(a + b)
"
);
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
program.printOutputToConsole ();
program.getCompileTimeErrorHandler ().printErrorsToConsole ();
program.getRuntimeErrorHandler ().printErrorsToConsole ();
Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
Assert.AreEqual(0, program.getRuntimeErrorHandler().getErrors().Count);
Assert.AreEqual(1, program.Output.Count);
Assert.AreEqual("8", program.Output[0]);
}
示例7: AssigningToArray
public void AssigningToArray()
{
TextReader programString = File.OpenText("code62.txt");
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
program.printOutputToConsole();
Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
Assert.AreEqual("abc", program.Output[0]);
Assert.AreEqual("true", program.Output[1]);
Assert.AreEqual("false", program.Output[2]);
Assert.AreEqual("1", program.Output[3]);
Assert.AreEqual("[1, 2, 3]", program.Output[4]);
}
示例8: ReturnFromMain
public void ReturnFromMain()
{
TextReader programString = File.OpenText("code51.txt");
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
program.printOutputToConsole();
Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
Assert.AreEqual(0, program.Output.Count);
}
示例9: SimpleConditional
public void SimpleConditional()
{
TextReader programString = File.OpenText("code36.txt");
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
Assert.AreEqual("15", program.Output[0]);
Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
}
示例10: PrintingMathExpressions
public void PrintingMathExpressions()
{
TextReader programString = File.OpenText("code19.txt");
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
Assert.AreEqual("20", program.Output[0]);
Assert.AreEqual("-4", program.Output[1]);
Assert.AreEqual("11", program.Output[2]);
Assert.AreEqual("-20", program.Output[3]);
Assert.AreEqual("-1", program.Output[4]);
Assert.AreEqual("0.5", program.Output[5]);
Assert.AreEqual("-0.5", program.Output[6]);
Assert.AreEqual("100.1", program.Output[7]);
Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
}
示例11: ProgramThatShouldWorkButDoesnt
public void ProgramThatShouldWorkButDoesnt()
{
TextReader programString = File.OpenText("code40.txt");
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
}
示例12: HelloWorld
public void HelloWorld()
{
StringReader programString = new StringReader("print(\"Hello World!\")");
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
Assert.AreEqual("Hello World!", program.Output[0]);
Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
}
示例13: PlusplusAndMinusminus
public void PlusplusAndMinusminus()
{
TextReader programString = File.OpenText("code47.txt");
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
program.printOutputToConsole();
Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
Assert.AreEqual("11", program.Output[0]);
Assert.AreEqual("9", program.Output[1]);
}
示例14: SimpleVariableUsage
public void SimpleVariableUsage()
{
TextReader programString = File.OpenText("code21.txt");
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
Assert.AreEqual(4, program.Output.Count);
Assert.AreEqual("10", program.Output[0]);
Assert.AreEqual("20", program.Output[1]);
Assert.AreEqual("30", program.Output[2]);
Assert.AreEqual("40", program.Output[3]);
Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
}
示例15: LengthOfArray
public void LengthOfArray()
{
TextReader programString = File.OpenText("code59.txt");
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
program.printOutputToConsole();
Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
Assert.AreEqual("5", program.Output[0]);
}