about summary refs log tree commit diff stats
path: root/shell/sandbox.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-03-08 17:54:07 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-03-08 17:54:07 -0800
commitd124be9cb68a7d46fddc59e4e107ffdf6fb07508 (patch)
tree86b85d0705460f81cb84001700272f99f25ad0e4 /shell/sandbox.mu
parente58980b4c8552ea41f097d905db34f603ea35a09 (diff)
downloadmu-d124be9cb68a7d46fddc59e4e107ffdf6fb07508.tar.gz
strip spaces when tokenizing
Thanks Max Bernstein for reporting this.
Diffstat (limited to 'shell/sandbox.mu')
-rw-r--r--shell/sandbox.mu23
1 files changed, 23 insertions, 0 deletions
diff --git a/shell/sandbox.mu b/shell/sandbox.mu
index 7d85ed59..37e94c12 100644
--- a/shell/sandbox.mu
+++ b/shell/sandbox.mu
@@ -210,6 +210,29 @@ fn test-run-integer {
   check-screen-row screen, 2/y, "=> 1 ", "F - test-run-integer/2"
 }
 
+fn test-run-with-spaces {
+  var sandbox-storage: sandbox
+  var sandbox/esi: (addr sandbox) <- address sandbox-storage
+  initialize-sandbox sandbox
+  # type "1"
+  edit-sandbox sandbox, 0x20/space
+  edit-sandbox sandbox, 0x31/1
+  edit-sandbox sandbox, 0x20/space
+  edit-sandbox sandbox, 0xa/newline
+  # eval
+  edit-sandbox sandbox, 0x13/ctrl-s
+  # setup: screen
+  var screen-on-stack: screen
+  var screen/edi: (addr screen) <- address screen-on-stack
+  initialize-screen screen, 0x80/width, 0x10/height
+  #
+  render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height
+  check-screen-row screen, 0/y, " 1   ", "F - test-run-with-spaces/0"
+  check-screen-row screen, 1/y, "     ", "F - test-run-with-spaces/1"
+  check-screen-row screen, 2/y, "...  ", "F - test-run-with-spaces/2"
+  check-screen-row screen, 3/y, "=> 1 ", "F - test-run-with-spaces/3"
+}
+
 fn test-run-error-invalid-integer {
   var sandbox-storage: sandbox
   var sandbox/esi: (addr sandbox) <- address sandbox-storage