From 8cd856e060840277b1a8b30892d6ef4f55fe5c7a Mon Sep 17 00:00:00 2001 From: Arne Babenhauserheide Date: Fri, 18 Aug 2023 19:19:40 +0200 Subject: [PATCH 20/21] SRFI-119 (Wisp): use pass-if-equal instead of pass-if (equal? ...) * test-suite/tests/srfi-119.test (wisp-read-simple, wisp-read-complex): use pass-if-equal and invert conditions to improve error messages --- test-suite/tests/srfi-119.test | 54 ++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/test-suite/tests/srfi-119.test b/test-suite/tests/srfi-119.test index 6fe87f2b2..64ccc2ff6 100644 --- a/test-suite/tests/srfi-119.test +++ b/test-suite/tests/srfi-119.test @@ -37,11 +37,21 @@ (wisp-scheme-read-string str)) (with-test-prefix "wisp-read-simple" - (pass-if (equal? (wisp->list "<= n 5") '((<= n 5)))) - (pass-if (equal? (wisp->list ". 5") '(5))) - (pass-if (equal? (wisp->list "+ 1 : * 2 3") '((+ 1 (* 2 3)))))) + (pass-if-equal '((<= n 5)) + (wisp->list "<= n 5")) + (pass-if-equal '(5) + (wisp->list ". 5")) + (pass-if-equal '((+ 1 (* 2 3))) + (wisp->list "+ 1 : * 2 3"))) (with-test-prefix "wisp-read-complex" - (pass-if (equal? (wisp->list " + (pass-if-equal '( + (a b c d e + f g h + i j k) + + (concat "I want " + (getwish from me) + " - " username)) (wisp->list " a b c d e . f g h . i j k @@ -49,16 +59,20 @@ a b c d e concat \"I want \" getwish from me . \" - \" username -") '( -(a b c d e - f g h - i j k) +")) + + (pass-if-equal + '( + (define (a b c) + (d e + (f) + (g h) + i)) -(concat "I want " - (getwish from me) - " - " username)))) + (define (_) + (display "hello\n")) - (pass-if (equal? (wisp->list " + (_)) (wisp->list " define : a b c _ d e ___ f @@ -68,21 +82,11 @@ __ . i define : _ _ display \"hello\n\" -\\_") '( -(define (a b c) - (d e - (f) - (g h) - i)) - -(define (_) - (display "hello\n")) - -(_)))) +\\_")) ;; nesting with pairs - (pass-if (equal? (wisp->list "1 . 2\n3 4\n 5 . 6") - '((1 . 2)(3 4 (5 . 6)))))) + (pass-if-equal '((1 . 2)(3 4 (5 . 6))) + (wisp->list "1 . 2\n3 4\n 5 . 6"))) (with-test-prefix "wisp-source-properties" (pass-if (not (find null? (map source-properties (wisp->list "1 . 2\n3 4\n 5 . 6"))))) -- 2.41.0