## editing sandboxes after they've been created scenario clicking-on-sandbox-edit-button-moves-it-to-editor [ local-scope trace-until 100/app # trace too long assume-screen 50/width, 10/height # empty recipes assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [add 2, 2] render-all screen, env, render # run it assume-console [ press F4 ] event-loop screen, console, env, resources screen-should-contain [ . run (F4) . . . .──────────────────────────────────────────────────. .0 edit copy delete . .add 2, 2 . .4 . .──────────────────────────────────────────────────. . . ] # click at left edge of 'edit' button assume-console [ left-click 3, 4 ] run [ event-loop screen, console, env, resources ] # it pops back into editor screen-should-contain [ . run (F4) . .add 2, 2 . .──────────────────────────────────────────────────. . . ] # cursor should be in the right place assume-console [ type [0] ] run [ event-loop screen, console, env, resources ] screen-should-contain [ . run (F4) . .0add 2, 2 . .──────────────────────────────────────────────────. . . ] ] scenario clicking-on-sandbox-edit-button-moves-it-to-editor-2 [ local-scope trace-until 100/app # trace too long assume-screen 50/width, 10/height # empty recipes assume-resources [ ] env:&:environment <- new-programming-environment resources, screen, [add 2, 2] render-all screen, env, render # run it assume-console [ press F4 ] event-loop screen, console, env, resources screen-should-contain [ . run (F4) . . . .──────────────────────────────────────────────────. .0 edit copy delete . .add 2, 2 . .4 . .──────────────────────────────────────────────────. . . ] # click at right edge of 'edit' button (just before 'copy') assume-console [ left-click 3, 18 ] run [ event-loop screen, console, env, resources ] # it pops back into editor screen-should-contain [ . run (F4) . .add 2, 2 . .──────────────────────────────────────────────────. . . ] # cursor should be in the right place assume-console [ type [0] ] run [ event-loop screen, console, env, resources ] screen-should-contain [ . run (F4) . .0add 2, 2 . .──────────────────────────────────────────────────. . . ] ] after [ # support 'edit' button { edit?:bool <- should-attempt-edit? click-row, click-column, env break-unless edit? edit?, env <- try-edit-sandbox click-row, env break-unless edit? screen <- render-sandbox-side screen, env, render screen <- update-cursor screen, current-sandbox, env loop +next-event } ] # some preconditions for attempting to edit a sandbox def should-attempt-edit? click-row:num, click-column:num, env:&:environment -> result:bool [ local-scope load-inputs # are we below the sandbox editor? click-sandbox-area?:bool <- click-on-sandbox-area? click-row, env return-unless click-sandbox-area?, fals
discard """
  output: '''holla
true
defabc 4
0'''
"""

# Test top level semicolon works properly:
import os; echo "holla"

# Test the new predence rules

proc `\+` (x, y: int): int = result = x + y
proc `\*` (x, y: int): int = result = x * y

echo 5 \+ 1 \* 9 == 6*9

proc foo[S, T](x: S, y: T):