From 6f65d5918f4b73de56e6cb6362c7cbc7dbbe5945 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 28 Sep 2016 19:48:56 -0700 Subject: 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. --- sandbox/009-sandbox-test.mu | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'sandbox/009-sandbox-test.mu') 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, [ -- cgit 1.4.1-2-gfad0