about summary refs log tree commit diff stats
path: root/baremetal
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-02-15 13:21:28 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-02-15 13:21:28 -0800
commit6aaeadfee858b9dacfe391610b99c1c152853383 (patch)
tree8a6686492ed03787be03ce9b25cd982960e13770 /baremetal
parentd83dce3b984c04b09eb8b79803f0417109b720ed (diff)
downloadmu-6aaeadfee858b9dacfe391610b99c1c152853383.tar.gz
7752
Diffstat (limited to 'baremetal')
-rw-r--r--baremetal/shell/line.mu22
1 files changed, 20 insertions, 2 deletions
diff --git a/baremetal/shell/line.mu b/baremetal/shell/line.mu
index b86974cc..aadba891 100644
--- a/baremetal/shell/line.mu
+++ b/baremetal/shell/line.mu
@@ -155,7 +155,6 @@ fn render-word-with-stack-and-cursor screen: (addr screen), line: (addr line), c
 }
 
 fn test-render-line-with-stack-singleton {
-  # line = [1]
   var line-storage: line
   var line/esi: (addr line) <- address line-storage
   parse-line "1", line
@@ -175,7 +174,6 @@ fn test-render-line-with-stack-singleton {
 }
 
 fn test-render-line-with-stack {
-  # line = [1 2]
   var line-storage: line
   var line/esi: (addr line) <- address line-storage
   parse-line "1 2", line
@@ -195,6 +193,26 @@ fn test-render-line-with-stack {
   # not bothering to test hash colors for numbers
 }
 
+# { } groups have no effect on the stack by default.
+fn test-render-line-with-stack-groups {
+  var line-storage: line
+  var line/esi: (addr line) <- address line-storage
+  parse-line "{ 1 2 }", line
+  # setup: screen
+  var screen-on-stack: screen
+  var screen/edi: (addr screen) <- address screen-on-stack
+  initialize-screen screen, 0x20, 4
+  #
+  var new-x/eax: int <- copy 0
+  var new-y/ecx: int <- copy 0
+  new-x, new-y <- render-line-with-stack screen, line, 0/x, 0/y, 0/no-cursor
+  check-screen-row screen, 0/y, "{  1    2    } ", "F - test-render-line-with-stack-groups/0"
+  check-screen-row screen, 1/y, "               ", "F - test-render-line-with-stack-groups/1"
+                                #    ___  ___
+  check-screen-row screen, 2/y, "     1    2    ", "F - test-render-line-with-stack-groups/2"
+  check-screen-row screen, 3/y, "          1    ", "F - test-render-line-with-stack-groups/3"
+}
+
 fn edit-line _self: (addr line), key: byte {
   var self/esi: (addr line) <- copy _self
   var cursor-word-ah/edx: (addr handle word) <- get self, cursor