public void Can_evaluate_continue_and_evaluate_again() { var testDebugger = new TestDebuggerFacade(); testDebugger.Load(@" sub sub1() var x = 33 x = x + 1 x = x + 1 end sub"); testDebugger.AddBreakpoint(4); testDebugger.AddBreakpoint(5); testDebugger.CallSubrutineAsync("sub1"); testDebugger.WaitForBreakpointHit(); var result = testDebugger.EvaluateExpression("x"); result.Result.Value.Should().Be(33); testDebugger.Continue(); testDebugger.WaitForBreakpointHit(); result = testDebugger.EvaluateExpression("x"); result.Result.Value.Should().Be(34); testDebugger.Continue(); testDebugger.AssertSubrutineFinished(); }
public void Stops_debugging_when_script_cancelled() { var testDebugger = new TestDebuggerFacade(); testDebugger.Load(@" sub sub1() var x = 33 end sub"); testDebugger.AddBreakpoint(3); testDebugger.CallSubrutineAsync("sub1"); testDebugger.WaitForBreakHit(); testDebugger.ScriptCancellation.Cancel(); testDebugger.AssertSubrutineFinished(); }
public void Records_statement() { var testDebugger = new TestDebuggerFacade(); testDebugger.Load(@" sub sub1() var x = 33 end sub"); testDebugger.EnabledTracing(); testDebugger.CallSubrutine("sub1"); var trace = testDebugger.DumpTrace(); Assert.IsTrue(trace.Contains("varx=33")); }
public void Can_break_at_statement() { var testDebugger = new TestDebuggerFacade(); testDebugger.Load(@" sub sub1() var x = 33 end sub"); testDebugger.AddBreakpoint(3); testDebugger.CallSubrutineAsync("sub1"); testDebugger.WaitForBreakpointHit(); testDebugger.Continue(); testDebugger.AssertSubrutineFinished(); }
public void Can_step_to_next_statement() { var testDebugger = new TestDebuggerFacade(); testDebugger.Load(@" sub sub1() var x = 33 x = x + 1 end sub"); testDebugger.AddBreakpoint(3); testDebugger.CallSubrutineAsync("sub1"); testDebugger.WaitForBreakHit(); testDebugger.Step(); testDebugger.WaitForBreakHit(); testDebugger.LastBreak?.Location.Line.Should().Be(4); }
public void Can_evaluate() { var testDebugger = new TestDebuggerFacade(); testDebugger.Load(@" sub sub1() var x = 33 x = x + 1 end sub"); testDebugger.AddBreakpoint(4); testDebugger.CallSubrutineAsync("sub1"); testDebugger.WaitForBreakHit(); var result = testDebugger.EvaluateExpression("x"); result.Result.Value.Should().Be(33); }
public void Doesnt_stop_at_empty_line() { var testDebugger = new TestDebuggerFacade(); testDebugger.Load(@" sub sub1() var x = 33 x = x + 1 end sub"); testDebugger.AddBreakpoint(3); testDebugger.CallSubrutineAsync("sub1"); testDebugger.WaitForBreakHit(); testDebugger.Step(); testDebugger.WaitForBreakHit(); testDebugger.LastBreak?.Location.Line.Should().Be(5); }
public void Breakpoint_works_after_cancellation() { var testDebugger = new TestDebuggerFacade(); testDebugger.Load(@" sub sub1() var x = 33 end sub"); testDebugger.AddBreakpoint(3); testDebugger.CallSubrutineAsync("sub1"); testDebugger.WaitForBreakHit(); testDebugger.ScriptCancellation.Cancel(); testDebugger.AssertSubrutineFinished(); testDebugger.CallSubrutineAsync("sub1"); testDebugger.WaitForBreakHit(); testDebugger.Continue(); testDebugger.AssertSubrutineFinished(); }
public void Records_return_value() { var testDebugger = new TestDebuggerFacade(); testDebugger.Load(@" sub sub1() sub2() end sub sub sub2() return 'return value' end sub "); testDebugger.EnabledTracing(); testDebugger.CallSubrutine("sub1"); var trace = testDebugger.DumpTrace(); Assert.IsTrue(trace.Contains("return value")); }
public void Records_arguments() { var testDebugger = new TestDebuggerFacade(); testDebugger.Load(@" sub sub1() sub2('param1 value', 314) end sub sub sub2(param1, param2) var x = 1 end sub "); testDebugger.EnabledTracing(); testDebugger.CallSubrutine("sub1"); var trace = testDebugger.DumpTrace(); Assert.IsTrue(trace.Contains("param1 value")); Assert.IsTrue(trace.Contains("314")); }