about summary refs log tree commit diff stats
path: root/apps/tile/main.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-10-09 21:25:32 -0700
committerKartik Agaram <vc@akkartik.com>2020-10-09 21:25:32 -0700
commitcb01075a2e3a7d595ff4bf185181f6db37c19379 (patch)
tree3576949bd8287dc7bda572cd8a7c9d8ae2d5408c /apps/tile/main.mu
parent7c6bb4d316a513b276828935162de8429e8e5df0 (diff)
downloadmu-cb01075a2e3a7d595ff4bf185181f6db37c19379.tar.gz
6978
We don't have tests yet in the tile prototype, mostly because we don't
yet feel confident about what desired behavior should be. But it's still
helpful to have a non-interactive mode for tracking down segfaults.
Diffstat (limited to 'apps/tile/main.mu')
-rw-r--r--apps/tile/main.mu36
1 files changed, 36 insertions, 0 deletions
diff --git a/apps/tile/main.mu b/apps/tile/main.mu
index c4a5f6c0..b9cfde53 100644
--- a/apps/tile/main.mu
+++ b/apps/tile/main.mu
@@ -33,6 +33,15 @@ fn main args-on-stack: (addr array addr array byte) -> exit-status/ebx: int {
         exit-status <- copy 0
         break $main-body
       }
+      # if single arg is 'test' ...
+      tmp2 <- string-equal? *tmp, "test2"
+      compare tmp2, 0  # false
+      {
+        break-if-=
+        test
+        exit-status <- copy 0
+        break $main-body
+      }
     }
     # otherwise error message
     print-string-to-real-screen "usage:\n"
@@ -62,6 +71,33 @@ fn interactive {
   enable-screen-type-mode
 }
 
+fn test {
+  var env-storage: environment
+  var env/esi: (addr environment) <- address env-storage
+  initialize-environment env
+  var g/eax: grapheme <- copy 0x31  # '1'
+  process env, g
+  g <- copy 0x20  # space
+  process env, g
+  g <- copy 0x32  # '2'
+  process env, g
+  g <- copy 0x2a  # '*'
+  process env, g
+  g <- copy 0xa  # <enter>
+  process env, g
+  g <- copy 0x445b1b  # left-arrow
+  process env, g
+  g <- copy 0x445b1b  # left-arrow
+  process env, g
+  g <- copy 0x445b1b  # left-arrow
+  process env, g
+  g <- copy 0x435b1b  # right-arrow
+  process env, g
+  g <- copy 0x435b1b  # right-arrow
+  process env, g
+  render env
+}
+
 fn repl {
   {
     # prompt