From cb01075a2e3a7d595ff4bf185181f6db37c19379 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 9 Oct 2020 21:25:32 -0700 Subject: 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. --- apps/tile/main.mu | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'apps/tile') 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 # + 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 -- cgit 1.4.1-2-gfad0