public static void RunNormalAndStepByStep( string script, Action<RuntimeObj> test, GlobalContext ctx = null ) { var e = ExprAnalyser.AnalyseString( script ); // Tests the empty, default, visitor: no change must have been made to the AST. var emptyVisitor = new ExprVisitor(); Assert.That( emptyVisitor.VisitExpr( e ), Is.SameAs( e ) ); // Evaluates result directly. RuntimeObj syncResult = ScriptEngine.Evaluate( e, ctx ); test( syncResult ); // Step-by-step evaluation. ScriptEngine engine = new ScriptEngine( ctx ); engine.Breakpoints.BreakAlways = true; ExecAsync( script, test, null, e, syncResult, engine, true ); }
static public void RunNormalAndStepByStep(string script, Action <RuntimeObj> test, GlobalContext ctx = null) { var e = Analyzer.AnalyseString(script); // Tests the empty, default, visitor: no change must have been made to the AST. var emptyVisitor = new ExprVisitor(); emptyVisitor.VisitExpr(e).Should().BeSameAs(e); // Evaluates result directly. RuntimeObj syncResult = ScriptEngine.Evaluate(e, ctx); test(syncResult); // Step-by-step evaluation. ScriptEngine engine = new ScriptEngine(ctx); engine.Breakpoints.BreakAlways = true; ExecAsync(script, test, null, e, syncResult, engine, true); }
static public void RunNormalAndStepByStepWithFirstChanceError(string script, Action <RuntimeObj> test, int expectedFirstChanceError, GlobalContext ctx = null) { var e = ExprAnalyser.AnalyseString(script); // Tests the empty, default, visitor: no change must have been made to the AST. var emptyVisitor = new ExprVisitor(); Assert.That(emptyVisitor.VisitExpr(e), Is.SameAs(e)); // Evaluates result directly. RuntimeObj syncResult = ScriptEngine.Evaluate(e, ctx); test(syncResult); // Evaluates result without break points but with EnabledFirstChanceError set. ScriptEngine engine = new ScriptEngine(ctx); engine.EnableFirstChanceError = true; ExecAsync(script, test, expectedFirstChanceError, e, syncResult, engine, false); // Step-by-step evaluation (with EnabledFirstChanceError set). engine.Breakpoints.BreakAlways = true; ExecAsync(script, test, expectedFirstChanceError, e, syncResult, engine, true); }