From 8cff44fef442bab0b6c75ac0ef1e3616c5149139 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 8 Jun 2021 21:45:10 -0700 Subject: . --- 504test-screen.mu | 14 ++++++++++++-- 1 file 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 { -- cgit 1.4.1-2-gfad0