From 8014210316809c9d59adc015ecc181337b42cf19 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 6 Jun 2021 12:39:03 -0700 Subject: shell: support negative integer literals We still don't support _any_ fractional literals, positive or negative. --- shell/sandbox.mu | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'shell/sandbox.mu') diff --git a/shell/sandbox.mu b/shell/sandbox.mu index 0aad5b44..67b89e75 100644 --- a/shell/sandbox.mu +++ b/shell/sandbox.mu @@ -740,6 +740,24 @@ fn test-run-integer { check-screen-row screen, 3/y, " => 1 ", "F - test-run-integer/2" } +fn test-run-negative-integer { + var sandbox-storage: sandbox + var sandbox/esi: (addr sandbox) <- address sandbox-storage + initialize-sandbox-with sandbox, "-1" + # eval + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/no-tweak-screen + # setup: screen + var screen-on-stack: screen + var screen/edi: (addr screen) <- address screen-on-stack + initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics + # + render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor + # skip one line of padding + check-screen-row screen, 1/y, " -1 ", "F - test-run-negative-integer/0" + check-screen-row screen, 2/y, " ... ", "F - test-run-negative-integer/1" + check-screen-row screen, 3/y, " => -1 ", "F - test-run-negative-integer/2" +} + fn test-run-error-invalid-integer { var sandbox-storage: sandbox var sandbox/esi: (addr sandbox) <- address sandbox-storage -- cgit 1.4.1-2-gfad0