about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--504test-screen.mu366
1 files changed, 187 insertions, 179 deletions
diff --git a/504test-screen.mu b/504test-screen.mu
index 65c72a83..553c6112 100644
--- a/504test-screen.mu
+++ b/504test-screen.mu
@@ -20,36 +20,38 @@ fn check-screen-row-from _screen: (addr screen), x: int, y: int, expected: (addr
     var done?/eax: boolean <- stream-empty? e-addr
     compare done?, 0
     break-if-!=
-    var _g/eax: grapheme <- screen-grapheme-at-index screen, index
-    var g/ebx: grapheme <- copy _g
-    var expected-grapheme/eax: grapheme <- read-grapheme e-addr
-    # compare graphemes
-    $check-screen-row-from:compare-graphemes: {
-      # if expected-grapheme is space, null grapheme is also ok
-      {
-        compare expected-grapheme, 0x20
-        break-if-!=
-        compare g, 0
-        break-if-= $check-screen-row-from:compare-graphemes
+    {
+      var _g/eax: grapheme <- screen-grapheme-at-index screen, index
+      var g/ebx: grapheme <- copy _g
+      var expected-grapheme/eax: grapheme <- read-grapheme e-addr
+      # compare graphemes
+      $check-screen-row-from:compare-graphemes: {
+        # if expected-grapheme is space, null grapheme is also ok
+        {
+          compare expected-grapheme, 0x20
+          break-if-!=
+          compare g, 0
+          break-if-= $check-screen-row-from:compare-graphemes
+        }
+        # if (g == expected-grapheme) print "."
+        compare g, expected-grapheme
+        break-if-=
+        # otherwise print an error
+        failure-count <- increment
+        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
+        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
+        draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
+        move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
+        draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
+        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
+        draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
+        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") but observed '", 3/fg/cyan, 0/bg
+        draw-grapheme-at-cursor 0/screen, g, 3/cyan, 0/bg
+        move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
+        move-cursor-to-left-margin-of-next-line 0/screen
       }
-      # if (g == expected-grapheme) print "."
-      compare g, expected-grapheme
-      break-if-=
-      # otherwise print an error
-      failure-count <- increment
-      draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
-      draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
-      draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
-      move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
-      draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
-      draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
-      draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
-      draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
-      draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") but observed '", 3/fg/cyan, 0/bg
-      draw-grapheme-at-cursor 0/screen, g, 3/cyan, 0/bg
-      move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
-      draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
-      move-cursor-to-left-margin-of-next-line 0/screen
     }
     index <- increment
     increment x
@@ -83,74 +85,76 @@ fn check-screen-row-in-color-from _screen: (addr screen), fg: int, y: int, x: in
     var done?/eax: boolean <- stream-empty? e-addr
     compare done?, 0
     break-if-!=
-    var _g/eax: grapheme <- screen-grapheme-at-index screen, index
-    var g/ebx: grapheme <- copy _g
-    var _expected-grapheme/eax: grapheme <- read-grapheme e-addr
-    var expected-grapheme/edi: grapheme <- copy _expected-grapheme
-    $check-screen-row-in-color-from:compare-cells: {
-      # if expected-grapheme is space, null grapheme is also ok
-      {
-        compare expected-grapheme, 0x20
-        break-if-!=
-        compare g, 0
-        break-if-= $check-screen-row-in-color-from:compare-cells
-      }
-      # if expected-grapheme is space, a different color is ok
-      {
-        compare expected-grapheme, 0x20
-        break-if-!=
-        var color/eax: int <- screen-color-at-index screen, index
-        compare color, fg
-        break-if-!= $check-screen-row-in-color-from:compare-cells
-      }
-      # compare graphemes
-      $check-screen-row-in-color-from:compare-graphemes: {
-        # if (g == expected-grapheme) print "."
-        compare g, expected-grapheme
+    {
+      var _g/eax: grapheme <- screen-grapheme-at-index screen, index
+      var g/ebx: grapheme <- copy _g
+      var _expected-grapheme/eax: grapheme <- read-grapheme e-addr
+      var expected-grapheme/edi: grapheme <- copy _expected-grapheme
+      $check-screen-row-in-color-from:compare-cells: {
+        # if expected-grapheme is space, null grapheme is also ok
         {
+          compare expected-grapheme, 0x20
           break-if-!=
-          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
-          break $check-screen-row-in-color-from:compare-graphemes
+          compare g, 0
+          break-if-= $check-screen-row-in-color-from:compare-cells
         }
-        # otherwise print an error
-        count-test-failure
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
-        draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
-        move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
-        draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
-        draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") but observed '", 3/fg/cyan, 0/bg
-        draw-grapheme-at-cursor 0/screen, g, 3/cyan, 0/bg
-        move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
-        move-cursor-to-left-margin-of-next-line 0/screen
-      }
-      $check-screen-row-in-color-from:compare-colors: {
-        var color/eax: int <- screen-color-at-index screen, index
-        compare fg, color
+        # if expected-grapheme is space, a different color is ok
         {
+          compare expected-grapheme, 0x20
           break-if-!=
-          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
-          break $check-screen-row-in-color-from:compare-colors
+          var color/eax: int <- screen-color-at-index screen, index
+          compare color, fg
+          break-if-!= $check-screen-row-in-color-from:compare-cells
+        }
+        # compare graphemes
+        $check-screen-row-in-color-from:compare-graphemes: {
+          # if (g == expected-grapheme) print "."
+          compare g, expected-grapheme
+          {
+            break-if-!=
+            draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
+            break $check-screen-row-in-color-from:compare-graphemes
+          }
+          # otherwise print an error
+          count-test-failure
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
+          draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
+          move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
+          draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
+          draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") but observed '", 3/fg/cyan, 0/bg
+          draw-grapheme-at-cursor 0/screen, g, 3/cyan, 0/bg
+          move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
+          move-cursor-to-left-margin-of-next-line 0/screen
+        }
+        $check-screen-row-in-color-from:compare-colors: {
+          var color/eax: int <- screen-color-at-index screen, index
+          compare fg, color
+          {
+            break-if-!=
+            draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
+            break $check-screen-row-in-color-from:compare-colors
+          }
+          # otherwise print an error
+          count-test-failure
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
+          draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
+          move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
+          draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
+          draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") in color ", 3/fg/cyan, 0/bg
+          draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, fg, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, " but observed color ", 3/fg/cyan, 0/bg
+          draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, color, 3/fg/cyan, 0/bg
+          move-cursor-to-left-margin-of-next-line 0/screen
         }
-        # otherwise print an error
-        count-test-failure
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
-        draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
-        move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
-        draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
-        draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") in color ", 3/fg/cyan, 0/bg
-        draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, fg, 3/fg/cyan, 0/bg
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, " but observed color ", 3/fg/cyan, 0/bg
-        draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, color, 3/fg/cyan, 0/bg
-        move-cursor-to-left-margin-of-next-line 0/screen
       }
     }
     index <- increment
@@ -174,75 +178,77 @@ fn check-screen-row-in-background-color-from _screen: (addr screen), bg: int, y:
     var done?/eax: boolean <- stream-empty? e-addr
     compare done?, 0
     break-if-!=
-    var _g/eax: grapheme <- screen-grapheme-at-index screen, index
-    var g/ebx: grapheme <- copy _g
-    var _expected-grapheme/eax: grapheme <- read-grapheme e-addr
-    var expected-grapheme/edi: grapheme <- copy _expected-grapheme
-    $check-screen-row-in-background-color-from:compare-cells: {
-      # if expected-grapheme is space, null grapheme is also ok
-      {
-        compare expected-grapheme, 0x20
-        break-if-!=
-        compare g, 0
-        break-if-= $check-screen-row-in-background-color-from:compare-cells
-      }
-      # if expected-grapheme is space, a different background-color is ok
-      {
-        compare expected-grapheme, 0x20
-        break-if-!=
-        var background-color/eax: int <- screen-background-color-at-index screen, index
-        compare background-color, bg
-        break-if-!= $check-screen-row-in-background-color-from:compare-cells
-      }
-      # compare graphemes
-      $check-screen-row-in-background-color-from:compare-graphemes: {
-        # if (g == expected-grapheme) print "."
-        compare g, expected-grapheme
+    {
+      var _g/eax: grapheme <- screen-grapheme-at-index screen, index
+      var g/ebx: grapheme <- copy _g
+      var _expected-grapheme/eax: grapheme <- read-grapheme e-addr
+      var expected-grapheme/edi: grapheme <- copy _expected-grapheme
+      $check-screen-row-in-background-color-from:compare-cells: {
+        # if expected-grapheme is space, null grapheme is also ok
         {
+          compare expected-grapheme, 0x20
           break-if-!=
-          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
-          break $check-screen-row-in-background-color-from:compare-graphemes
+          compare g, 0
+          break-if-= $check-screen-row-in-background-color-from:compare-cells
         }
-        # otherwise print an error
-        count-test-failure
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
-        draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
-        move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
-        draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
-        draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") but observed '", 3/fg/cyan, 0/bg
-        draw-grapheme-at-cursor 0/screen, g, 3/cyan, 0/bg
-        move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
-        move-cursor-to-left-margin-of-next-line 0/screen
-        break $check-screen-row-in-background-color-from:compare-graphemes
-      }
-      $check-screen-row-in-background-color-from:compare-background-colors: {
-        var background-color/eax: int <- screen-background-color-at-index screen, index
-        compare bg, background-color
+        # if expected-grapheme is space, a different background-color is ok
         {
+          compare expected-grapheme, 0x20
           break-if-!=
-          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
-          break $check-screen-row-in-background-color-from:compare-background-colors
+          var background-color/eax: int <- screen-background-color-at-index screen, index
+          compare background-color, bg
+          break-if-!= $check-screen-row-in-background-color-from:compare-cells
+        }
+        # compare graphemes
+        $check-screen-row-in-background-color-from:compare-graphemes: {
+          # if (g == expected-grapheme) print "."
+          compare g, expected-grapheme
+          {
+            break-if-!=
+            draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
+            break $check-screen-row-in-background-color-from:compare-graphemes
+          }
+          # otherwise print an error
+          count-test-failure
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
+          draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
+          move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
+          draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
+          draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") but observed '", 3/fg/cyan, 0/bg
+          draw-grapheme-at-cursor 0/screen, g, 3/cyan, 0/bg
+          move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
+          move-cursor-to-left-margin-of-next-line 0/screen
+          break $check-screen-row-in-background-color-from:compare-graphemes
+        }
+        $check-screen-row-in-background-color-from:compare-background-colors: {
+          var background-color/eax: int <- screen-background-color-at-index screen, index
+          compare bg, background-color
+          {
+            break-if-!=
+            draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
+            break $check-screen-row-in-background-color-from:compare-background-colors
+          }
+          # otherwise print an error
+          count-test-failure
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
+          draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
+          move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
+          draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
+          draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") in background-color ", 3/fg/cyan, 0/bg
+          draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, bg, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, " but observed background-color ", 3/fg/cyan, 0/bg
+          draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, background-color, 3/fg/cyan, 0/bg
+          move-cursor-to-left-margin-of-next-line 0/screen
         }
-        # otherwise print an error
-        count-test-failure
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected '", 3/fg/cyan, 0/bg
-        draw-grapheme-at-cursor 0/screen, expected-grapheme, 3/cyan, 0/bg
-        move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "' at (", 3/fg/cyan, 0/bg
-        draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
-        draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") in background-color ", 3/fg/cyan, 0/bg
-        draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, bg, 3/fg/cyan, 0/bg
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, " but observed background-color ", 3/fg/cyan, 0/bg
-        draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, background-color, 3/fg/cyan, 0/bg
-        move-cursor-to-left-margin-of-next-line 0/screen
       }
     }
     index <- increment
@@ -270,41 +276,43 @@ fn check-background-color-in-screen-row-from _screen: (addr screen), bg: int, y:
     var done?/eax: boolean <- stream-empty? e-addr
     compare done?, 0
     break-if-!=
-    var _expected-bit/eax: grapheme <- read-grapheme e-addr
-    var expected-bit/edi: grapheme <- copy _expected-bit
-    $check-background-color-in-screen-row-from:compare-cells: {
-      var background-color/eax: int <- screen-background-color-at-index screen, index
-      # if expected-bit is space, assert that background is NOT bg
-      compare expected-bit, 0x20
-      {
-        break-if-!=
+    {
+      var _expected-bit/eax: grapheme <- read-grapheme e-addr
+      var expected-bit/edi: grapheme <- copy _expected-bit
+      $check-background-color-in-screen-row-from:compare-cells: {
+        var background-color/eax: int <- screen-background-color-at-index screen, index
+        # if expected-bit is space, assert that background is NOT bg
+        compare expected-bit, 0x20
+        {
+          break-if-!=
+          compare background-color, bg
+          break-if-!= $check-background-color-in-screen-row-from:compare-cells
+          increment failure-count
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected (", 3/fg/cyan, 0/bg
+          draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
+          draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
+          draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") to not be in background-color ", 3/fg/cyan, 0/bg
+          draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, bg, 3/fg/cyan, 0/bg
+          move-cursor-to-left-margin-of-next-line 0/screen
+          break $check-background-color-in-screen-row-from:compare-cells
+        }
+        # otherwise assert that background IS bg
         compare background-color, bg
-        break-if-!= $check-background-color-in-screen-row-from:compare-cells
+        break-if-= $check-background-color-in-screen-row-from:compare-cells
         increment failure-count
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected (", 3/fg/cyan, 0/bg
         draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
         draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
         draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
-        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") to not be in background-color ", 3/fg/cyan, 0/bg
+        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") in background-color ", 3/fg/cyan, 0/bg
         draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, bg, 3/fg/cyan, 0/bg
+        draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, " but observed background-color ", 3/fg/cyan, 0/bg
+        draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, background-color, 3/fg/cyan, 0/bg
         move-cursor-to-left-margin-of-next-line 0/screen
-        break $check-background-color-in-screen-row-from:compare-cells
       }
-      # otherwise assert that background IS bg
-      compare background-color, bg
-      break-if-= $check-background-color-in-screen-row-from:compare-cells
-      increment failure-count
-      draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
-      draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ": expected (", 3/fg/cyan, 0/bg
-      draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, x, 3/fg/cyan, 0/bg
-      draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ", ", 3/fg/cyan, 0/bg
-      draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
-      draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") in background-color ", 3/fg/cyan, 0/bg
-      draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, bg, 3/fg/cyan, 0/bg
-      draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, " but observed background-color ", 3/fg/cyan, 0/bg
-      draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, background-color, 3/fg/cyan, 0/bg
-      move-cursor-to-left-margin-of-next-line 0/screen
     }
     index <- increment
     increment x