about summary refs log tree commit diff stats
path: root/sandbox/009-sandbox-test.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 /sandbox/009-sandbox-test.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 'sandbox/009-sandbox-test.mu')
-rw-r--r--sandbox/009-sandbox-test.mu26
1 files changed, 13 insertions, 13 deletions
diff --git a/sandbox/009-sandbox-test.mu b/sandbox/009-sandbox-test.mu
index 3b2e91db..aebb34c2 100644
--- a/sandbox/009-sandbox-test.mu
+++ b/sandbox/009-sandbox-test.mu
@@ -1,20 +1,20 @@
 ## clicking on sandbox results to 'fix' them and turn sandboxes into tests
 
 scenario sandbox-click-on-result-toggles-color-to-green [
+  local-scope
   trace-until 100/app  # trace too long
   assume-screen 50/width, 20/height
   # basic recipe
-  1:text <- new [ 
-def foo [
-  return 4
+  recipes:text <- new [ 
+recipe foo [
+  reply 4
 ]]
+  env:&:environment <- new-programming-environment screen:&:screen, [foo]
   # run it
-  2:text <- new [foo]
   assume-console [
     press F4
   ]
-  3:&:environment <- new-programming-environment screen:&:screen, 2:text
-  event-loop screen:&:screen, console:&:console, 3:&:environment, 1:text/test-recipes
+  event-loop screen:&:screen, console:&:console, env, recipes
   screen-should-contain [
     .                               run (F4)           .
     .                                                  .
@@ -30,7 +30,7 @@ def foo [
     left-click 5, 21
   ]
   run [
-    event-loop screen:&:screen, console:&:console, 3:&:environment, 1:text/test-recipes
+    event-loop screen:&:screen, console:&:console, env, recipes
   ]
   # color toggles to green
   screen-should-contain-in-color 2/green, [
@@ -44,8 +44,8 @@ def foo [
   ]
   # cursor should remain unmoved
   run [
-    4:char/cursor <- copy 9251/␣
-    print screen:&:screen, 4:char/cursor
+    cursor:char <- copy 9251/␣
+    print screen:&:screen, cursor
   ]
   screen-should-contain [
     .                               run (F4)           .
@@ -58,16 +58,16 @@ def foo [
     .                                                  .
   ]
   # now change the result
-  1:text <- new [ 
-def foo [
-  return 3
+  new-recipes:text <- new [ 
+recipe foo [
+  reply 3
 ]]
   # then rerun
   assume-console [
     press F4
   ]
   run [
-    event-loop screen:&:screen, console:&:console, 3:&:environment, 1:text/new-test-recipes
+    event-loop screen:&:screen, console:&:console, env, new-recipes
   ]
   # result turns red
   screen-should-contain-in-color 1/red, [