about summary refs log tree commit diff stats
path: root/edit/009-sandbox-test.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-12-11 16:18:18 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-12-11 16:18:18 -0800
commit294b2ab35983ebe95698835bb54bca8bd3eec101 (patch)
treefbc74bea6cefd7b8f527d36a7b7c6804dd886414 /edit/009-sandbox-test.mu
parentd5c86dfd8706e6b3ceee7843464797e6fcad4259 (diff)
downloadmu-294b2ab35983ebe95698835bb54bca8bd3eec101.tar.gz
3705 - switch to tested file-system primitives
Diffstat (limited to 'edit/009-sandbox-test.mu')
-rw-r--r--edit/009-sandbox-test.mu45
1 files changed, 23 insertions, 22 deletions
diff --git a/edit/009-sandbox-test.mu b/edit/009-sandbox-test.mu
index fe9ef059..39b58ecb 100644
--- a/edit/009-sandbox-test.mu
+++ b/edit/009-sandbox-test.mu
@@ -5,22 +5,25 @@ scenario sandbox-click-on-result-toggles-color-to-green [
   trace-until 100/app  # trace too long
   assume-screen 100/width, 10/height
   # basic recipe
-  recipes:text <- new [ 
-recipe foo [
-  reply 4
-]]
-  env:&:environment <- new-programming-environment screen, recipes:text, [foo]
+  assume-resources [
+    [lesson/recipes.mu] <- [
+      |recipe foo [|
+      |  reply 4|
+      |]|
+    ]
+  ]
+  env:&:environment <- new-programming-environment resources, screen, [foo]
   # run it
   assume-console [
     press F4
   ]
-  event-loop screen, console, env
+  event-loop screen, console, env, resources
   screen-should-contain [
     .                                                                                 run (F4)           .
-    .                                                  ┊                                                 .
-    .recipe foo [                                      ┊─────────────────────────────────────────────────.
-    .  reply 4                                         ┊0   edit          copy            delete         .
-    .]                                                 ┊foo                                              .
+    .recipe foo [                                      ┊                                                 .
+    .  reply 4                                         ┊─────────────────────────────────────────────────.
+    .]                                                 ┊0   edit          copy            delete         .
+    .                                                  ┊foo                                              .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
     .                                                  ┊                                                 .
@@ -30,7 +33,7 @@ recipe foo [
     left-click 5, 51
   ]
   run [
-    event-loop screen, console, env
+    event-loop screen, console, env, resources
   ]
   # color toggles to green
   screen-should-contain-in-color 2/green, [
@@ -50,26 +53,24 @@ recipe foo [
   ]
   screen-should-contain [
     .                                                                                 run (F4)           .
-    .␣                                                 ┊                                                 .
-    .recipe foo [                                      ┊─────────────────────────────────────────────────.
-    .  reply 4                                         ┊0   edit          copy            delete         .
-    .]                                                 ┊foo                                              .
+    .␣ecipe foo [                                      ┊                                                 .
+    .  reply 4                                         ┊─────────────────────────────────────────────────.
+    .]                                                 ┊0   edit          copy            delete         .
+    .                                                  ┊foo                                              .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4                                                .
     .                                                  ┊─────────────────────────────────────────────────.
     .                                                  ┊                                                 .
-    .                                                  ┊                                                 .
-    .                                                  ┊                                                 .
   ]
   # now change the result
   # then rerun
   assume-console [
-    left-click 3, 11  # cursor to end of line
+    left-click 2, 11  # cursor to end of line
     press backspace
     type [3]
     press F4
   ]
   run [
-    event-loop screen, console, env
+    event-loop screen, console, env, resources
   ]
   # result turns red
   screen-should-contain-in-color 1/red, [
@@ -96,14 +97,14 @@ before <end-save-sandbox> [
     expected-response:text <- get *curr, expected-response:offset
     break-unless expected-response
     filename <- append filename, [.out]
-    save filename, expected-response
+    resources <- dump resources, filename, expected-response
   }
 ]
 
 before <end-restore-sandbox> [
   {
     filename <- append filename, [.out]
-    contents <- restore filename
+    contents <- slurp resources, filename
     break-unless contents
     *curr <- put *curr, expected-response:offset, contents
   }
@@ -128,7 +129,7 @@ after <global-touch> [
     break-unless sandbox
     # toggle its expected-response, and save session
     sandbox <- toggle-expected-response sandbox
-    save-sandboxes env
+    save-sandboxes env, resources
     hide-screen screen
     screen <- render-sandbox-side screen, env, render
     screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env