about summary refs log tree commit diff stats
path: root/sandbox/010-warnings.mu
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/010-warnings.mu')
-rw-r--r--sandbox/010-warnings.mu61
1 files changed, 54 insertions, 7 deletions
diff --git a/sandbox/010-warnings.mu b/sandbox/010-warnings.mu
index 16a6a92c..317a857a 100644
--- a/sandbox/010-warnings.mu
+++ b/sandbox/010-warnings.mu
@@ -14,8 +14,10 @@ recipe! update-recipes env:address:shared:programming-environment-data, screen:a
   # if recipe editor has errors, stop
   {
     break-unless *recipe-warnings
-    status:address:shared:array:character <- new [errors found]
+    status:address:shared:array:character <- new [errors found     ]
     update-status screen, status, 1/red
+    errors-found? <- copy 1/true
+    reply
   }
   errors-found? <- copy 0/false
 ]
@@ -25,8 +27,46 @@ before <render-components-end> [
   recipe-warnings:address:shared:array:character <- get *env, recipe-warnings:offset
   {
     break-unless recipe-warnings
-    status:address:shared:array:character <- new [errors found]
+    status:address:shared:array:character <- new [errors found     ]
+    update-status screen, status, 1/red
+  }
+]
+
+container programming-environment-data [
+  warning-index:number  # index of first sandbox with an error (or -1 if none)
+]
+
+after <programming-environment-initialization> [
+  warning-index:address:number <- get-address *result, warning-index:offset
+  *warning-index <- copy -1
+]
+
+after <run-sandboxes-begin> [
+  warning-index:address:number <- get-address *env, warning-index:offset
+  *warning-index <- copy -1
+]
+
+before <run-sandboxes-end> [
+  {
+    sandboxes-completed-successfully?:boolean <- equal *warning-index, -1
+    break-if sandboxes-completed-successfully?
+    errors-found? <- copy 1/true
+  }
+]
+
+before <render-components-end> [
+  {
+    break-if recipe-warnings
+    warning-index:number <- get *env, warning-index:offset
+    sandboxes-completed-successfully?:boolean <- equal warning-index, -1
+    break-if sandboxes-completed-successfully?
+    status-template:address:shared:array:character <- new [errors found (_)    ]
+    warning-index-text:address:shared:array:character <- to-text warning-index
+    status:address:shared:array:character <- interpolate status-template, warning-index-text
+#?     $print [update-status: sandbox warning], 10/newline
     update-status screen, status, 1/red
+#?     $print [run sandboxes end], 10/newline
+    reply
   }
 ]
 
@@ -34,7 +74,7 @@ container sandbox-data [
   warnings:address:shared:array:character
 ]
 
-recipe! update-sandbox sandbox:address:shared:sandbox-data, env:address:shared:programming-environment-data -> sandbox:address:shared:sandbox-data [
+recipe! update-sandbox sandbox:address:shared:sandbox-data, env:address:shared:programming-environment-data, idx:number -> sandbox:address:shared:sandbox-data, env:address:shared:programming-environment-data [
   local-scope
   load-ingredients
   data:address:shared:array:character <- get *sandbox, data:offset
@@ -55,6 +95,13 @@ recipe! update-sandbox sandbox:address:shared:sandbox-data, env:address:shared:p
     *warnings <- new [took too long!
 ]
   }
+  {
+    break-unless *warnings
+#?     $print [setting warning-index to ], idx, 10/newline
+    warning-index:address:number <- get-address *env, warning-index:offset
+    *warning-index <- copy idx
+  }
+#?   $print [done with run-interactive], 10/newline
 ]
 
 # make sure we render any trace
@@ -86,7 +133,7 @@ scenario run-instruction-and-print-warnings [
     event-loop screen:address:shared:screen, console:address:shared:console, 2:address:shared:programming-environment-data
   ]
   screen-should-contain [
-    .                               run (F4)           .
+    .  errors found (0)             run (F4)           .
     .                                                  .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
     .0                                                x.
@@ -97,7 +144,7 @@ scenario run-instruction-and-print-warnings [
     .                                                  .
   ]
   screen-should-contain-in-color 1/red, [
-    .                                                  .
+    .  errors found (0)                                .
     .                                                  .
     .                                                  .
     .                                                  .
@@ -127,7 +174,7 @@ scenario run-instruction-and-print-warnings-only-once [
   ]
   # check that screen prints error message just once
   screen-should-contain [
-    .                               run (F4)           .
+    .  errors found (0)             run (F4)           .
     .                                                  .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
     .0                                                x.
@@ -156,7 +203,7 @@ loop
     event-loop screen:address:shared:screen, console:address:shared:console, 2:address:shared:programming-environment-data
   ]
   screen-should-contain [
-    .                               run (F4)           .
+    .  errors found (0)             run (F4)           .
     .                                                  .
     .━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.
     .0                                                x.