about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-06-08 12:03:39 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-06-08 12:03:39 -0700
commita7008328cb3aa2b6182bd50ee996082bdac2ec43 (patch)
treeef2b846b45ef0936073a6ed967c4006f7912f827
parent227d18f8a235701ea10b067ab4e1d3d8d2b579ed (diff)
downloadmu-a7008328cb3aa2b6182bd50ee996082bdac2ec43.tar.gz
stop printing more than one '.' per assertion
Screen real-estate is precious on the boot screen since we have no scrolling.
-rw-r--r--504test-screen.mu18
1 files changed, 12 insertions, 6 deletions
diff --git a/504test-screen.mu b/504test-screen.mu
index e071b2d6..603fb8a1 100644
--- a/504test-screen.mu
+++ b/504test-screen.mu
@@ -10,6 +10,7 @@ fn check-screen-row screen: (addr screen), y: int, expected: (addr array byte),
 
 fn check-screen-row-from screen-on-stack: (addr screen), x: int, y: int, expected: (addr array byte), msg: (addr array byte) {
   var screen/esi: (addr screen) <- copy screen-on-stack
+  var failure-count/edi: int <- copy 0
   var idx/ecx: int <- screen-cell-index screen, x, y
   # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme
   var e: (stream byte 0x100)
@@ -33,13 +34,9 @@ fn check-screen-row-from screen-on-stack: (addr screen), x: int, y: int, expecte
       }
       # 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-from:compare-graphemes
-      }
+      break-if-=
       # otherwise print an error
-      count-test-failure
+      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
@@ -58,6 +55,15 @@ fn check-screen-row-from screen-on-stack: (addr screen), x: int, y: int, expecte
     increment x
     loop
   }
+  # if any assertions failed, count the test as failed
+  compare failure-count, 0
+  {
+    break-if-=
+    count-test-failure
+    return
+  }
+  # otherwise print a "."
+  draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
 }
 
 # various variants by screen-cell attribute; spaces in the 'expected' data should not match the attribute