当前位置: 首页>>代码示例>>C#>>正文


C# DefaultSprakRunner.getRuntimeErrorHandler方法代码示例

本文整理汇总了C#中DefaultSprakRunner.getRuntimeErrorHandler方法的典型用法代码示例。如果您正苦于以下问题:C# DefaultSprakRunner.getRuntimeErrorHandler方法的具体用法?C# DefaultSprakRunner.getRuntimeErrorHandler怎么用?C# DefaultSprakRunner.getRuntimeErrorHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DefaultSprakRunner的用法示例。


在下文中一共展示了DefaultSprakRunner.getRuntimeErrorHandler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:21,代码来源:DefaultSprakRunner_TEST.cs

示例2: 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]);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:22,代码来源:DefaultSprakRunner_TEST.cs

示例3: 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]);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:16,代码来源:DefaultSprakRunner_TEST.cs

示例4: CrashbugWithElseifWithoutEnd

        public void CrashbugWithElseifWithoutEnd()
        {
            TextReader programString = File.OpenText("code80.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);

            program.run();

            program.printOutputToConsole();
            program.getCompileTimeErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getCompileTimeErrorHandler().getErrors().Count);
            Assert.AreEqual(0, program.getRuntimeErrorHandler().getErrors().Count);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:13,代码来源:DefaultSprakRunner_TEST.cs

示例5: ConcatenatingArrays

        public void ConcatenatingArrays()
        {
            TextReader programString = File.OpenText("code63.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();
            program.printOutputToConsole();
            program.getCompileTimeErrorHandler().printErrorsToConsole();
            program.getRuntimeErrorHandler().printErrorsToConsole();

            Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
            Assert.AreEqual("a: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]", program.Output[0]);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:12,代码来源:DefaultSprakRunner_TEST.cs

示例6: NamedLoopVariableWithRange

        public void NamedLoopVariableWithRange()
        {
            StringReader programString = new StringReader(
                @"loop a from 10 to 13
                     print(a)
                  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(4, program.Output.Count);
            Assert.AreEqual("10", program.Output[0]);
            Assert.AreEqual("11", program.Output[1]);
            Assert.AreEqual("12", program.Output[2]);
            Assert.AreEqual("13", program.Output[3]);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:25,代码来源:DefaultSprakRunner_TEST.cs

示例7: ForgettingReturn

        public void ForgettingReturn()
        {
            TextReader programString = File.OpenText("code57.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();
            program.printOutputToConsole();
            program.getRuntimeErrorHandler().printErrorsToConsole();

            Assert.AreEqual(1, program.getRuntimeErrorHandler().getErrors().Count);
        }
开发者ID:substans,项目名称:Sprak,代码行数:10,代码来源:DefaultSprakRunner_TEST.cs

示例8: InfiniteLoop

        public void InfiniteLoop()
        {
            StringReader programString = new StringReader(
                @"
            loop

            end
            "
                );

            DefaultSprakRunner sprakRunner = new DefaultSprakRunner(programString);
            sprakRunner.run(30);

            GC.Collect();
            GC.WaitForPendingFinalizers();

            sprakRunner.printOutputToConsole ();
            sprakRunner.getCompileTimeErrorHandler().printErrorsToConsole ();
            sprakRunner.getRuntimeErrorHandler().printErrorsToConsole ();

            Assert.AreEqual(0, sprakRunner.getCompileTimeErrorHandler().getErrors().Count);
            Assert.AreEqual(0, sprakRunner.getRuntimeErrorHandler().getErrors().Count);

            Console.WriteLine("MemorySpace.nrOfMemorySpacesInMemory = " + MemorySpace.nrOfMemorySpacesInMemory);
            Console.WriteLine("InterpreterTwo.nrOfScopes = " + InterpreterTwo.nrOfScopes);

            //Assert.AreEqual(1, InterpreterTwo.nrOfScopes);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:28,代码来源:DefaultSprakRunner_TEST.cs

示例9: PlusEqualsInArray

        public void PlusEqualsInArray()
        {
            StringReader programString = new StringReader(
                @"
            array a = [10,20,30]
            a[1] += 5
            print(a)
            "
            );

            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("[10, 25, 30]", program.Output[0]);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:22,代码来源:DefaultSprakRunner_TEST.cs

示例10: EbbesArrayTrouble

        public void EbbesArrayTrouble()
        {
            StringReader programString = new StringReader(
                @"
            array a
            loop i from 0 to 9
            a[i] = ['hej', 'svej']
            end

            print('count: ' + Count(a))

            var a0 = a[0]

            print(a0[0])
            print(a0[1])
            "
            );

            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(3, program.Output.Count);
            Assert.AreEqual("count: 10", program.Output[0]);
            Assert.AreEqual("hej", program.Output[1]);
            Assert.AreEqual("svej", program.Output[2]);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:32,代码来源:DefaultSprakRunner_TEST.cs

示例11: UseRangeTypeInLoop

        public void UseRangeTypeInLoop()
        {
            StringReader programString = new StringReader(
                @"number sum = 0
                  loop from 1 to 100
                     sum += @
                  end
                  print(sum)
                  print([1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9])
                 "
            );

            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("5050", program.Output[0]);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:24,代码来源:DefaultSprakRunner_TEST.cs

示例12: SimpleArrayPrint

        public void SimpleArrayPrint()
        {
            StringReader programString = new StringReader(
                @"var l = [10, 20, 30]
                  print(l)"
            );

            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();

            program.printOutputToConsole ();

            Assert.AreEqual("[10, 20, 30]", program.Output[0]);
            Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
            Assert.AreEqual(0, program.getRuntimeErrorHandler().getErrors().Count);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:16,代码来源:DefaultSprakRunner_TEST.cs

示例13: SimpleAndStatements

        public void SimpleAndStatements()
        {
            TextReader programString = File.OpenText("code81.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("yep", program.Output[0]);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:16,代码来源:DefaultSprakRunner_TEST.cs

示例14: SetIndexInRange

        public void SetIndexInRange()
        {
            StringReader programString = new StringReader(
                @"var r = from 1 to 100
                  print(r)
                  r[0] = 100
                 "
            );

            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();

            program.printOutputToConsole ();
            program.getCompileTimeErrorHandler ().printErrorsToConsole ();
            program.getRuntimeErrorHandler ().printErrorsToConsole ();

            Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
            Assert.AreEqual(1, program.getRuntimeErrorHandler().getErrors().Count);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:19,代码来源:DefaultSprakRunner_TEST.cs

示例15: RootAprox

        public void RootAprox()
        {
            TextReader programString = File.OpenText("code43.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();
            program.printOutputToConsole();
            program.getRuntimeErrorHandler ().printErrorsToConsole ();

            Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
            Assert.AreEqual("3", program.Output[0]);
            Assert.AreEqual("4", program.Output[1]);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:12,代码来源:DefaultSprakRunner_TEST.cs


注:本文中的DefaultSprakRunner.getRuntimeErrorHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。