From ba2b5098166a7f8a5f01ecf12aea6d54c6f5108e Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Mon, 1 Feb 2021 23:25:54 -0800 Subject: [PATCH] Less verbose output for success. --- ueforth/common/testing.fs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ueforth/common/testing.fs b/ueforth/common/testing.fs index 2d8a2df..2b9f657 100644 --- a/ueforth/common/testing.fs +++ b/ueforth/common/testing.fs @@ -45,12 +45,15 @@ variable tests-found variable tests-run variable tests-passed : check-fresh depth if ." DEPTH LEAK! " depth . 1 throw then ; : wrap-test ( xt -- ) expect-reset >r check-fresh r> execute check-fresh expect-finish ; : red 1 fg ; : green 2 fg ; : hr 40 for [char] - emit next cr ; -: run-test ( xt -- ) dup >name type confirm{ ['] wrap-test catch }confirm +: replace-line 13 emit clear-to-eol ; +: label-test ( xt -- ) replace-line >name type ; +: run-test ( xt -- ) dup label-test confirm{ ['] wrap-test catch }confirm if drop ( cause xt restored on throw ) red ." FAILED" normal cr - else green ." OK" normal cr 1 tests-passed +! then 1 tests-run +! ; -: pre-test-run cr hr tests-found @ . ." Tests found." cr hr ; + else green ." OK" normal 1 tests-passed +! then 1 tests-run +! ; : show-test-results - hr ." PASSED: " green tests-passed @ . normal ." RUN: " tests-run @ . + replace-line hr + ." PASSED: " green tests-passed @ . normal + ." RUN: " tests-run @ . ." FOUND: " tests-found @ . cr tests-passed @ tests-found @ = if green ." ALL TESTS PASSED" normal cr @@ -58,6 +61,6 @@ variable tests-found variable tests-run variable tests-passed ." FAILED: " red tests-run @ tests-passed @ - . normal cr then hr ; : run-tests - reset-test-counters ['] count-test for-tests pre-test-run + reset-test-counters ['] count-test for-tests ['] run-test for-tests show-test-results tests-passed @ tests-found @ <> sysexit ;