about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-06-08 21:45:10 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-06-08 21:45:10 -0700
commit8cff44fef442bab0b6c75ac0ef1e3616c5149139 (patch)
treeae95c9b0286271d7966d80aaaadd7c01ec657940
parentd0d8fc7b046d46640632f744d8b2751193b218f5 (diff)
downloadmu-8cff44fef442bab0b6c75ac0ef1e3616c5149139.tar.gz
.
-rw-r--r--504test-screen.mu14
1 files changed, 12 insertions, 2 deletions
diff --git a/504test-screen.mu b/504test-screen.mu
index 603fb8a1..7c5a653b 100644
--- a/504test-screen.mu
+++ b/504test-screen.mu
@@ -260,6 +260,7 @@ fn check-background-color-in-screen-row screen: (addr screen), bg: int, y: int,
 
 fn check-background-color-in-screen-row-from screen-on-stack: (addr screen), bg: int, y: int, x: int, expected-bitmap: (addr array byte), msg: (addr array byte) {
   var screen/esi: (addr screen) <- copy screen-on-stack
+  var failure-count: int
   var idx/ecx: int <- screen-cell-index screen, x, y
   # compare background color where 'expected-bitmap' is a non-space
   var e: (stream byte 0x100)
@@ -279,7 +280,7 @@ fn check-background-color-in-screen-row-from screen-on-stack: (addr screen), bg:
         break-if-!=
         compare background-color, bg
         break-if-!= $check-background-color-in-screen-row-from:compare-cells
-        count-test-failure
+        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
@@ -293,7 +294,7 @@ fn check-background-color-in-screen-row-from screen-on-stack: (addr screen), bg:
       # otherwise assert that background IS bg
       compare background-color, bg
       break-if-= $check-background-color-in-screen-row-from:compare-cells
-      count-test-failure
+      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
@@ -309,6 +310,15 @@ fn check-background-color-in-screen-row-from screen-on-stack: (addr screen), bg:
     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
 }
 
 fn test-draw-single-grapheme {