Beispiel #1
0
        public async Task StepIntoAfterStepOver()
        {
            const string code =
                @"f <- function(x) {
    x + 1
  }
  x <- 1
  x <- f(1)
  print(x)";

            var tracer = await _session.TraceExecutionAsync();

            using (var sf = new SourceFile(code)) {
                await tracer.EnableBreakpointsAsync(true);

                var bp = await tracer.CreateBreakpointAsync(sf, 4);

                var bpHit = new BreakpointHitDetector(bp);

                await sf.Source(_session);

                await bpHit.ShouldBeHitAtNextPromptAsync();

                (await tracer.StepOverAsync()).Should().BeTrue();
                await _session.ShouldBeAtAsync(bp.Location, +1);

                (await tracer.StepIntoAsync()).Should().BeTrue();
                await _session.ShouldBeAtAsync(sf.FilePath, 1);
            }
        }
Beispiel #2
0
        public async Task SetBreakpointWhileRunning()
        {
            const string code =
                @"browser()
  f <- function() {
    NULL
  }
  while (TRUE) f()";

            var tracer = await _session.TraceExecutionAsync();

            using (var sf = new SourceFile(code)) {
                await tracer.EnableBreakpointsAsync(true);

                await sf.Source(_session);

                await _session.NextPromptShouldBeBrowseAsync();

                await tracer.ContinueAsync();

                await Task.Delay(100);

                var bp = await tracer.CreateBreakpointAsync(sf, 3);

                await _session.NextPromptShouldBeBrowseAsync();

                await _session.ShouldBeAtAsync(bp.Location);
            }
        }
Beispiel #3
0
 public static Task ShouldBeAtAsync(this IRSession session, RSourceLocation location, int offset = 0)
 {
     return(session.ShouldBeAtAsync(location.FileName, location.LineNumber + offset));
 }