diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-09-10 19:22:27 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-09-10 19:22:27 -0700 |
commit | 8beff53e5a65ac23411221fdcf6e9607b6c2a715 (patch) | |
tree | 2989d80113058c3dafaaeff682780ecf2a535392 | |
parent | 42b3a2f820e92e7fefab54321f62aa9edf75bd81 (diff) | |
download | mu-8beff53e5a65ac23411221fdcf6e9607b6c2a715.tar.gz |
2180 - render the trace even if there's warnings
-rw-r--r-- | edit/009-sandbox-trace.mu | 1 | ||||
-rw-r--r-- | edit/010-warnings.mu | 53 |
2 files changed, 53 insertions, 1 deletions
diff --git a/edit/009-sandbox-trace.mu b/edit/009-sandbox-trace.mu index a2b35ac0..1091981e 100644 --- a/edit/009-sandbox-trace.mu +++ b/edit/009-sandbox-trace.mu @@ -206,4 +206,5 @@ after <render-sandbox-results> [ break-unless sandbox-trace # nothing to print; move on row, screen <- render-string, screen, sandbox-trace, left, right, 245/grey, row } + <render-sandbox-trace-done> ] diff --git a/edit/010-warnings.mu b/edit/010-warnings.mu index 6605f672..f5244a8d 100644 --- a/edit/010-warnings.mu +++ b/edit/010-warnings.mu @@ -63,12 +63,14 @@ recipe! update-sandbox [ } ] -after <render-sandbox-results> [ +# make sure we render any trace +after <render-sandbox-trace-done> [ { sandbox-warnings:address:array:character <- get *sandbox, warnings:offset break-unless sandbox-warnings *response-starting-row <- copy 0 # no response row, screen <- render-string screen, sandbox-warnings, left, right, 1/red, row + # don't try to print anything more for this sandbox jump +render-sandbox-end:label } ] @@ -387,3 +389,52 @@ scenario sandbox-can-handle-infinite-loop [ . ┊ . ] ] + +scenario sandbox-with-warnings-shows-trace [ + $close-trace # trace too long + assume-screen 100/width, 10/height + # generate a stash and a warning + 1:address:array:character <- new [recipe foo [ +local-scope +a:number <- next-ingredient +b:number <- next-ingredient +stash [dividing by], b +_, c:number <- divide-with-remainder a, b +reply b +]] + 2:address:array:character <- new [foo 4, 0] + 3:address:programming-environment-data <- new-programming-environment screen:address, 1:address:array:character, 2:address:array:character + # run + assume-console [ + press F4 + ] + event-loop screen:address, console:address, 3:address:programming-environment-data + # screen prints error message + screen-should-contain [ + . run (F4) . + .recipe foo \\\[ ┊ . + .local-scope ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. + .a:number <- next-ingredient ┊ x. + .b:number <- next-ingredient ┊foo 4, 0 . + .stash [dividing by], b ┊foo: divide by zero in '_, c:number <- divide-wi↩. + ._, c:number <- divide-with-remainder a, b ┊th-remainder a, b' . + ] + # click on the call in the sandbox + assume-console [ + left-click 4, 55 + ] + run [ + event-loop screen:address, console:address, 3:address:programming-environment-data + ] + # screen should expand trace + screen-should-contain [ + . run (F4) . + .recipe foo \\\[ ┊ . + .local-scope ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. + .a:number <- next-ingredient ┊ x. + .b:number <- next-ingredient ┊foo 4, 0 . + .stash [dividing by], b ┊dividing by 0 . + ._, c:number <- divide-with-remainder a, b ┊foo: divide by zero in '_, c:number <- divide-wi↩. + .reply b ┊th-remainder a, b' . + ] +] |