diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-02-01 13:51:49 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-02-01 13:56:21 -0800 |
commit | 67d2a9c07dea2f100f526cf6cd0831b544cd73fa (patch) | |
tree | a78367a21ac4ab5c1d54a29b8ad9ec69ef7e7e18 | |
parent | 07a6418389a6c36c0fe9cded6e585fb013ec90e1 (diff) | |
download | mu-67d2a9c07dea2f100f526cf6cd0831b544cd73fa.tar.gz |
2624
Reorganize further to make edit/008-sandbox-test more self-contained.
-rw-r--r-- | edit/005-sandbox.mu | 11 | ||||
-rw-r--r-- | edit/008-sandbox-test.mu | 27 | ||||
-rw-r--r-- | sandbox/005-sandbox.mu | 11 | ||||
-rw-r--r-- | sandbox/008-sandbox-test.mu | 27 |
4 files changed, 46 insertions, 30 deletions
diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu index a5a0d239..4a29254e 100644 --- a/edit/005-sandbox.mu +++ b/edit/005-sandbox.mu @@ -31,7 +31,6 @@ after <programming-environment-initialization> [ container sandbox-data [ data:address:shared:array:character response:address:shared:array:character - expected-response:address:shared:array:character # coordinates to track clicks # constraint: will be 0 for sandboxes at positions before env.render-from starting-row-on-screen:number @@ -234,12 +233,7 @@ recipe save-sandboxes env:address:shared:programming-environment-data [ data:address:shared:array:character <- get *curr, data:offset filename:address:shared:array:character <- to-text idx save filename, data - { - expected-response:address:shared:array:character <- get *curr, expected-response:offset - break-unless expected-response - filename <- append filename, suffix - save filename, expected-response - } + <end-save-sandbox> idx <- add idx, 1 curr <- get *curr, next-sandbox:offset loop @@ -355,8 +349,7 @@ recipe restore-sandboxes env:address:shared:programming-environment-data -> env: filename <- append filename, suffix contents <- restore filename break-unless contents - expected-response:address:address:shared:array:character <- get-address **curr, expected-response:offset - *expected-response <- copy contents + <end-restore-sandbox> } +continue idx <- add idx, 1 diff --git a/edit/008-sandbox-test.mu b/edit/008-sandbox-test.mu index 347980aa..5fa4c70c 100644 --- a/edit/008-sandbox-test.mu +++ b/edit/008-sandbox-test.mu @@ -82,6 +82,27 @@ recipe foo [ ] ] +# this requires tracking a couple more things +container sandbox-data [ + response-starting-row-on-screen:number + expected-response:address:shared:array:character +] + +# include expected response when saving or restoring a sandbox +before <end-save-sandbox> [ + { + expected-response:address:shared:array:character <- get *curr, expected-response:offset + break-unless expected-response + filename <- append filename, suffix + save filename, expected-response + } +] + +before <end-restore-sandbox> [ + expected-response:address:address:shared:array:character <- get-address **curr, expected-response:offset + *expected-response <- copy contents +] + # clicks on sandbox responses save it as 'expected' after <global-touch> [ # check if it's inside the output of any sandbox @@ -111,11 +132,6 @@ after <global-touch> [ } ] -# this requires tracking where responses begin for every sandbox -container sandbox-data [ - response-starting-row-on-screen:number -] - recipe find-click-in-sandbox-output env:address:shared:programming-environment-data, click-row:number -> sandbox:address:shared:sandbox-data [ local-scope load-ingredients @@ -179,7 +195,6 @@ after <render-sandbox-response> [ ] before <end-render-sandbox-reset-hidden> [ - $log sandbox, [resetting response starting row] tmp:address:number <- get-address *sandbox, response-starting-row-on-screen:offset *tmp <- copy 0 ] diff --git a/sandbox/005-sandbox.mu b/sandbox/005-sandbox.mu index 690ab22c..e79029f6 100644 --- a/sandbox/005-sandbox.mu +++ b/sandbox/005-sandbox.mu @@ -18,7 +18,6 @@ after <programming-environment-initialization> [ container sandbox-data [ data:address:shared:array:character response:address:shared:array:character - expected-response:address:shared:array:character # coordinates to track clicks # constraint: will be 0 for sandboxes at positions before env.render-from starting-row-on-screen:number @@ -223,12 +222,7 @@ recipe save-sandboxes env:address:shared:programming-environment-data [ data:address:shared:array:character <- get *curr, data:offset filename:address:shared:array:character <- to-text idx save filename, data - { - expected-response:address:shared:array:character <- get *curr, expected-response:offset - break-unless expected-response - filename <- append filename, suffix - save filename, expected-response - } + <end-save-sandbox> idx <- add idx, 1 curr <- get *curr, next-sandbox:offset loop @@ -343,8 +337,7 @@ recipe! restore-sandboxes env:address:shared:programming-environment-data -> env filename <- append filename, suffix contents <- restore filename break-unless contents - expected-response:address:address:shared:array:character <- get-address **curr, expected-response:offset - *expected-response <- copy contents + <end-restore-sandbox> } +continue idx <- add idx, 1 diff --git a/sandbox/008-sandbox-test.mu b/sandbox/008-sandbox-test.mu index c5695610..b299f704 100644 --- a/sandbox/008-sandbox-test.mu +++ b/sandbox/008-sandbox-test.mu @@ -81,6 +81,27 @@ recipe foo [ ] ] +# this requires tracking a couple more things +container sandbox-data [ + response-starting-row-on-screen:number + expected-response:address:shared:array:character +] + +# include expected response when saving or restoring a sandbox +before <end-save-sandbox> [ + { + expected-response:address:shared:array:character <- get *curr, expected-response:offset + break-unless expected-response + filename <- append filename, suffix + save filename, expected-response + } +] + +before <end-restore-sandbox> [ + expected-response:address:address:shared:array:character <- get-address **curr, expected-response:offset + *expected-response <- copy contents +] + # clicks on sandbox responses save it as 'expected' after <global-touch> [ # check if it's inside the output of any sandbox @@ -110,11 +131,6 @@ after <global-touch> [ } ] -# this requires tracking where responses begin for every sandbox -container sandbox-data [ - response-starting-row-on-screen:number -] - recipe find-click-in-sandbox-output env:address:shared:programming-environment-data, click-row:number -> sandbox:address:shared:sandbox-data [ local-scope load-ingredients @@ -178,7 +194,6 @@ after <render-sandbox-response> [ ] before <end-render-sandbox-reset-hidden> [ - $log sandbox, [resetting response starting row] tmp:address:number <- get-address *sandbox, response-starting-row-on-screen:offset *tmp <- copy 0 ] |