about summary refs log tree commit diff stats
path: root/edit
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-01-22 12:21:10 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-01-22 12:21:33 -0800
commit1234e56e3e48d6d8d4a8e007c806ccc456bafa46 (patch)
tree97214a2ae7498c4d0fc0c72fddfafd54ec4787db /edit
parentf7808ea1295398f31d8da40fe88e6c723662cf3f (diff)
downloadmu-1234e56e3e48d6d8d4a8e007c806ccc456bafa46.tar.gz
2588 - bugfix: show *first* sandbox with error
Diffstat (limited to 'edit')
-rw-r--r--edit/010-warnings.mu56
1 files changed, 55 insertions, 1 deletions
diff --git a/edit/010-warnings.mu b/edit/010-warnings.mu
index 6d8b66e0..ccecc880 100644
--- a/edit/010-warnings.mu
+++ b/edit/010-warnings.mu
@@ -105,6 +105,8 @@ recipe! update-sandbox sandbox:address:shared:sandbox-data, env:address:shared:p
     break-unless *warnings
 #?     $print [setting warning-index to ], idx, 10/newline
     warning-index:address:number <- get-address *env, warning-index:offset
+    warning-not-set?:boolean <- equal *warning-index, -1
+    break-unless warning-not-set?
     *warning-index <- copy idx
   }
 #?   $print [done with run-interactive], 10/newline
@@ -162,6 +164,57 @@ recipe foo [
   ]
 ]
 
+scenario run-updates-status-with-first-erroneous-sandbox [
+  trace-until 100/app  # trace too long
+  assume-screen 100/width, 15/height
+  1:address:shared:array:character <- new []
+  2:address:shared:array:character <- new []
+  3:address:shared:programming-environment-data <- new-programming-environment screen:address:shared:screen, 1:address:shared:array:character, 2:address:shared:array:character
+  assume-console [
+    left-click 3, 80
+    # create invalid sandbox 1
+    type [get foo, x:offset]
+    press F4
+    # create invalid sandbox 0
+    type [get foo, x:offset]
+    press F4
+  ]
+  run [
+    event-loop screen:address:shared:screen, console:address:shared:console, 3:address:shared:programming-environment-data
+  ]
+  # status shows first sandbox with error
+  screen-should-contain [
+    .  errors found (0)                                                               run (F4)           .
+  ]
+]
+
+scenario run-updates-status-with-first-erroneous-sandbox-2 [
+  trace-until 100/app  # trace too long
+  assume-screen 100/width, 15/height
+  1:address:shared:array:character <- new []
+  2:address:shared:array:character <- new []
+  3:address:shared:programming-environment-data <- new-programming-environment screen:address:shared:screen, 1:address:shared:array:character, 2:address:shared:array:character
+  assume-console [
+    left-click 3, 80
+    # create invalid sandbox 2
+    type [get foo, x:offset]
+    press F4
+    # create invalid sandbox 1
+    type [get foo, x:offset]
+    press F4
+    # create valid sandbox 0
+    type [add 2, 2]
+    press F4
+  ]
+  run [
+    event-loop screen:address:shared:screen, console:address:shared:console, 3:address:shared:programming-environment-data
+  ]
+  # status shows first sandbox with error
+  screen-should-contain [
+    .  errors found (1)                                                               run (F4)           .
+  ]
+]
+
 scenario run-hides-warnings-from-past-sandboxes [
   trace-until 100/app  # trace too long
   assume-screen 100/width, 15/height
@@ -178,11 +231,12 @@ scenario run-hides-warnings-from-past-sandboxes [
     left-click 3, 80
     press ctrl-k
     type [add 2, 2]  # valid code
-    press F4  # error should disappear
+    press F4  # update sandbox
   ]
   run [
     event-loop screen:address:shared:screen, console:address:shared:console, 3:address:shared:programming-environment-data
   ]
+  # error should disappear
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .