about summary refs log tree commit diff stats
path: root/edit/010-sandbox-trace.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-09-28 19:48:56 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-09-28 19:48:56 -0700
commit6f65d5918f4b73de56e6cb6362c7cbc7dbbe5945 (patch)
treedec4043f2d62f5dd02156d369e20af247881e2ac /edit/010-sandbox-trace.mu
parent1627d836b46440f57d766b154ec488fa2e5a1e06 (diff)
downloadmu-6f65d5918f4b73de56e6cb6362c7cbc7dbbe5945.tar.gz
3429 - standardize Mu scenarios
A long-standing problem has been that I couldn't spread code across
'run' blocks because they were separate scopes, so I've ended up making
them effectively comments. Running code inside a 'run' block is
identical in every way to simply running the code directly. The 'run'
block is merely a visual aid to separate setup from the component under
test.

In the process I've also standardized all Mu scenarios to always run in
a local scope, and only use (raw) numeric addresses for values they want
to check later.
Diffstat (limited to 'edit/010-sandbox-trace.mu')
-rw-r--r--edit/010-sandbox-trace.mu37
1 files changed, 18 insertions, 19 deletions
diff --git a/edit/010-sandbox-trace.mu b/edit/010-sandbox-trace.mu
index 195d0fd5..21a3aec2 100644
--- a/edit/010-sandbox-trace.mu
+++ b/edit/010-sandbox-trace.mu
@@ -1,20 +1,20 @@
 ## clicking on the code typed into a sandbox toggles its trace
 
 scenario sandbox-click-on-code-toggles-app-trace [
+  local-scope
   trace-until 100/app  # trace too long
   assume-screen 100/width, 10/height
   # basic recipe
-  1:text <- new [ 
+  recipes:text <- new [ 
 recipe foo [
   stash [abc]
 ]]
+  env:&:environment <- new-programming-environment screen:&:screen, recipes, [foo]
   # run it
-  2:text <- new [foo]
   assume-console [
     press F4
   ]
-  3:&:environment <- new-programming-environment screen:&:screen, 1:text, 2:text
-  event-loop screen:&:screen, console:&:console, 3:&:environment
+  event-loop screen:&:screen, console:&:console, env
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
@@ -29,9 +29,9 @@ recipe foo [
     left-click 4, 51
   ]
   run [
-    event-loop screen:&:screen, console:&:console, 3:&:environment
-    4:char/cursor-icon <- copy 9251/␣
-    print screen:&:screen, 4:char/cursor-icon
+    event-loop screen:&:screen, console:&:console, env
+    cursor:char <- copy 9251/␣
+    print screen:&:screen, cursor
   ]
   # trace now printed and cursor shouldn't have budged
   screen-should-contain [
@@ -55,8 +55,8 @@ recipe foo [
     left-click 4, 55
   ]
   run [
-    event-loop screen:&:screen, console:&:console, 3:&:environment
-    print screen:&:screen, 4:char/cursor-icon
+    event-loop screen:&:screen, console:&:console, env
+    print screen:&:screen, cursor
   ]
   # trace hidden again
   screen-should-contain [
@@ -71,21 +71,21 @@ recipe foo [
 ]
 
 scenario sandbox-shows-app-trace-and-result [
+  local-scope
   trace-until 100/app  # trace too long
   assume-screen 100/width, 10/height
   # basic recipe
-  1:text <- new [ 
+  recipes:text <- new [ 
 recipe foo [
   stash [abc]
   reply 4
 ]]
+  env:&:environment <- new-programming-environment screen:&:screen, recipes, [foo]
   # run it
-  2:text <- new [foo]
   assume-console [
     press F4
   ]
-  3:&:environment <- new-programming-environment screen:&:screen, 1:text, 2:text
-  event-loop screen:&:screen, console:&:console, 3:&:environment
+  event-loop screen:&:screen, console:&:console, env
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
@@ -101,7 +101,7 @@ recipe foo [
     left-click 4, 51
   ]
   run [
-    event-loop screen:&:screen, console:&:console, 3:&:environment
+    event-loop screen:&:screen, console:&:console, env
   ]
   # trace now printed above result
   screen-should-contain [
@@ -119,17 +119,16 @@ recipe foo [
 ]
 
 scenario clicking-on-app-trace-does-nothing [
+  local-scope
   trace-until 100/app  # trace too long
   assume-screen 100/width, 10/height
-  1:text <- new []
+  env:&:environment <- new-programming-environment screen:&:screen, [], [stash 123456789]
   # create and expand the trace
-  2:text <- new [stash 123456789]
   assume-console [
     press F4
     left-click 4, 51
   ]
-  3:&:environment <- new-programming-environment screen:&:screen, 1:text, 2:text
-  event-loop screen:&:screen, console:&:console, 3:&:environment
+  event-loop screen:&:screen, console:&:console, env
   screen-should-contain [
     .                                                                                 run (F4)           .
     .                                                  ┊                                                 .
@@ -143,7 +142,7 @@ scenario clicking-on-app-trace-does-nothing [
     left-click 5, 57
   ]
   run [
-    event-loop screen:&:screen, console:&:console, 3:&:environment
+    event-loop screen:&:screen, console:&:console, env
   ]
   # no change; doesn't die
   screen-should-contain [