diff options
Diffstat (limited to 'html/edit/009-sandbox-test.mu.html')
-rw-r--r-- | html/edit/009-sandbox-test.mu.html | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/html/edit/009-sandbox-test.mu.html b/html/edit/009-sandbox-test.mu.html index 1772865b..1967fa7d 100644 --- a/html/edit/009-sandbox-test.mu.html +++ b/html/edit/009-sandbox-test.mu.html @@ -48,8 +48,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color assume-console [ press F4 ] - <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + <span class="Constant">3</span>:&:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:&:screen, <span class="Constant">1</span>:text, <span class="Constant">2</span>:text + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -65,7 +65,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">5</span>, <span class="Constant">51</span> ] run [ - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data ] <span class="Comment"># color toggles to green</span> screen-should-contain-in-color <span class="Constant">2/green</span>, [ @@ -80,8 +80,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should remain unmoved</span> run [ - <span class="Constant">4</span>:character/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:address:screen, <span class="Constant">4</span>:character/cursor + <span class="Constant">4</span>:char/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:&:screen, <span class="Constant">4</span>:char/cursor ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> @@ -104,7 +104,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press F4 ] run [ - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + event-loop screen:&:screen, console:&:console, <span class="Constant">3</span>:&:programming-environment-data ] <span class="Comment"># result turns red</span> screen-should-contain-in-color <span class="Constant">1/red</span>, [ @@ -121,7 +121,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># this requires tracking a couple more things</span> <span class="muData">container</span> sandbox-data [ - response-starting-row-on-screen:number + response-starting-row-on-screen:num expected-response:text ] @@ -148,18 +148,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muRecipe">after</span> <span class="Constant"><global-touch></span> [ <span class="Comment"># check if it's inside the output of any sandbox</span> <span class="Delimiter">{</span> - sandbox-left-margin:number<span class="Special"> <- </span>get *current-sandbox, <span class="Constant">left:offset</span> - click-column:number<span class="Special"> <- </span>get t, <span class="Constant">column:offset</span> - on-sandbox-side?:boolean<span class="Special"> <- </span>greater-or-equal click-column, sandbox-left-margin + sandbox-left-margin:num<span class="Special"> <- </span>get *current-sandbox, <span class="Constant">left:offset</span> + click-column:num<span class="Special"> <- </span>get t, <span class="Constant">column:offset</span> + on-sandbox-side?:bool<span class="Special"> <- </span>greater-or-equal click-column, sandbox-left-margin <span class="muControl">break-unless</span> on-sandbox-side? - first-sandbox:address:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + first-sandbox:&:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> <span class="muControl">break-unless</span> first-sandbox - first-sandbox-begins:number<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">starting-row-on-screen:offset</span> - click-row:number<span class="Special"> <- </span>get t, <span class="Constant">row:offset</span> - below-sandbox-editor?:boolean<span class="Special"> <- </span>greater-or-equal click-row, first-sandbox-begins + first-sandbox-begins:num<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">starting-row-on-screen:offset</span> + click-row:num<span class="Special"> <- </span>get t, <span class="Constant">row:offset</span> + below-sandbox-editor?:bool<span class="Special"> <- </span>greater-or-equal click-row, first-sandbox-begins <span class="muControl">break-unless</span> below-sandbox-editor? <span class="Comment"># identify the sandbox whose output is being clicked on</span> - sandbox:address:sandbox-data<span class="Special"> <- </span>find-click-in-sandbox-output env, click-row + sandbox:&:sandbox-data<span class="Special"> <- </span>find-click-in-sandbox-output env, click-row <span class="muControl">break-unless</span> sandbox <span class="Comment"># toggle its expected-response, and save session</span> sandbox<span class="Special"> <- </span>toggle-expected-response sandbox @@ -173,33 +173,33 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> ] -<span class="muRecipe">def</span> find-click-in-sandbox-output env:address:programming-environment-data, click-row:number<span class="muRecipe"> -> </span>sandbox:address:sandbox-data [ +<span class="muRecipe">def</span> find-click-in-sandbox-output env:&:programming-environment-data, click-row:num<span class="muRecipe"> -> </span>sandbox:&:sandbox-data [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># assert click-row >= sandbox.starting-row-on-screen</span> - sandbox:address:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> - start:number<span class="Special"> <- </span>get *sandbox, <span class="Constant">starting-row-on-screen:offset</span> - clicked-on-sandboxes?:boolean<span class="Special"> <- </span>greater-or-equal click-row, start + sandbox:&:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + start:num<span class="Special"> <- </span>get *sandbox, <span class="Constant">starting-row-on-screen:offset</span> + clicked-on-sandboxes?:bool<span class="Special"> <- </span>greater-or-equal click-row, start assert clicked-on-sandboxes?, <span class="Constant">[extract-sandbox called on click to sandbox editor]</span> <span class="Comment"># while click-row < sandbox.next-sandbox.starting-row-on-screen</span> <span class="Delimiter">{</span> - next-sandbox:address:sandbox-data<span class="Special"> <- </span>get *sandbox, <span class="Constant">next-sandbox:offset</span> + next-sandbox:&:sandbox-data<span class="Special"> <- </span>get *sandbox, <span class="Constant">next-sandbox:offset</span> <span class="muControl">break-unless</span> next-sandbox - next-start:number<span class="Special"> <- </span>get *next-sandbox, <span class="Constant">starting-row-on-screen:offset</span> - found?:boolean<span class="Special"> <- </span>lesser-than click-row, next-start + next-start:num<span class="Special"> <- </span>get *next-sandbox, <span class="Constant">starting-row-on-screen:offset</span> + found?:bool<span class="Special"> <- </span>lesser-than click-row, next-start <span class="muControl">break-if</span> found? sandbox<span class="Special"> <- </span>copy next-sandbox <span class="muControl">loop</span> <span class="Delimiter">}</span> <span class="Comment"># return sandbox if click is in its output region</span> - response-starting-row:number<span class="Special"> <- </span>get *sandbox, <span class="Constant">response-starting-row-on-screen:offset</span> + response-starting-row:num<span class="Special"> <- </span>get *sandbox, <span class="Constant">response-starting-row-on-screen:offset</span> <span class="muControl">return-unless</span> response-starting-row, <span class="Constant">0/no-click-in-sandbox-output</span> - click-in-response?:boolean<span class="Special"> <- </span>greater-or-equal click-row, response-starting-row + click-in-response?:bool<span class="Special"> <- </span>greater-or-equal click-row, response-starting-row <span class="muControl">return-unless</span> click-in-response?, <span class="Constant">0/no-click-in-sandbox-output</span> <span class="muControl">return</span> sandbox ] -<span class="muRecipe">def</span> toggle-expected-response sandbox:address:sandbox-data<span class="muRecipe"> -> </span>sandbox:address:sandbox-data [ +<span class="muRecipe">def</span> toggle-expected-response sandbox:&:sandbox-data<span class="muRecipe"> -> </span>sandbox:&:sandbox-data [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> expected-response:text<span class="Special"> <- </span>get *sandbox, <span class="Constant">expected-response:offset</span> @@ -223,13 +223,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color *sandbox<span class="Special"> <- </span>put *sandbox, <span class="Constant">response-starting-row-on-screen:offset</span>, row expected-response:text<span class="Special"> <- </span>get *sandbox, <span class="Constant">expected-response:offset</span> <span class="muControl">break-unless</span> expected-response <span class="Comment"># fall-through to print in grey</span> - response-is-expected?:boolean<span class="Special"> <- </span>equal expected-response, sandbox-response + response-is-expected?:bool<span class="Special"> <- </span>equal expected-response, sandbox-response <span class="Delimiter">{</span> - <span class="muControl">break-if</span> response-is-expected?:boolean + <span class="muControl">break-if</span> response-is-expected?:bool row, screen<span class="Special"> <- </span>render-text screen, sandbox-response, left, right, <span class="Constant">1/red</span>, row <span class="Delimiter">}</span> <span class="Delimiter">{</span> - <span class="muControl">break-unless</span> response-is-expected?:boolean + <span class="muControl">break-unless</span> response-is-expected?:bool row, screen<span class="Special"> <- </span>render-text screen, sandbox-response, left, right, <span class="Constant">2/green</span>, row <span class="Delimiter">}</span> <span class="muControl">jump</span> <span class="Constant">+render-sandbox-end:label</span> |