From de18ef6d55b52f52837395684e6b8265b2ad26b3 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 9 Oct 2023 14:56:17 +0100 Subject: tests: Catch expressions that don't raise exceptions. Many tests that use guard to catch and ensure that certain conditions are raised actually leak and let through cases where the expressions result in a truthy value. * tests/ccwl.scm ("input, when passed more than one positional argument, must raise a &ccwl-violation condition", "input, when passed an unrecognized keyword, must raise a &ccwl-violation condition", "input, when passed multiple arguments to a unary keyword, must raise a &ccwl-violation condition", "output, when passed more than one positional argument, must raise a &ccwl-violation condition", "output, when passed an unrecognized keyword, must raise a &ccwl-violation condition", "output, when passed multiple arguments to a unary keyword, must raise a &ccwl-violation condition", "command, when passed positional arguments, must raise a &ccwl-violation condition", "command, when passed an unrecognized keyword, must raise a &ccwl-violation condition", "command, when passed multiple arguments to a unary keyword, must raise a &ccwl-violation condition"): Catch expressions that don't raise exceptions. --- tests/ccwl.scm | 49 +++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) (limited to 'tests') diff --git a/tests/ccwl.scm b/tests/ccwl.scm index 4f10450..219e3f7 100644 --- a/tests/ccwl.scm +++ b/tests/ccwl.scm @@ -58,58 +58,67 @@ (test-assert "input, when passed more than one positional argument, must raise a &ccwl-violation condition" (guard (exception (else (ccwl-violation? exception))) - (input #'(message string)))) + (begin (input #'(message string)) + #f))) (test-assert "input, when passed an unrecognized keyword, must raise a &ccwl-violation condition" (guard (exception (else (ccwl-violation? exception))) - (input #'(message #:foo string)))) + (begin (input #'(message #:foo string)) + #f))) (test-assert "input, when passed multiple arguments to a unary keyword, must raise a &ccwl-violation condition" (guard (exception (else (ccwl-violation? exception))) - (input #'(message #:type int string)))) + (begin (input #'(message #:type int string)) + #f))) (test-assert "output, when passed more than one positional argument, must raise a &ccwl-violation condition" (guard (exception (else (ccwl-violation? exception))) - (output #'(message string)))) + (begin (output #'(message string)) + #f))) (test-assert "output, when passed an unrecognized keyword, must raise a &ccwl-violation condition" (guard (exception (else (ccwl-violation? exception))) - (output #'(message #:foo string)))) + (begin (output #'(message #:foo string)) + #f))) (test-assert "output, when passed multiple arguments to a unary keyword, must raise a &ccwl-violation condition" (guard (exception (else (ccwl-violation? exception))) - (output #'(message #:type int string)))) + (begin (output #'(message #:type int string)) + #f))) (test-assert "command, when passed positional arguments, must raise a &ccwl-violation condition" (guard (exception (else (ccwl-violation? exception))) - (macroexpand - '(command foo - #:inputs (message #:type string) - #:run "echo" message - #:outputs (stdout #:type stdout))))) + (begin (macroexpand + '(command foo + #:inputs (message #:type string) + #:run "echo" message + #:outputs (stdout #:type stdout))) + #f))) (test-assert "command, when passed an unrecognized keyword, must raise a &ccwl-violation condition" (guard (exception (else (ccwl-violation? exception))) - (macroexpand - '(command #:foo (message #:type string) - #:run "echo" message - #:outputs (stdout #:type stdout))))) + (begin (macroexpand + '(command #:foo (message #:type string) + #:run "echo" message + #:outputs (stdout #:type stdout))) + #f))) (test-assert "command, when passed multiple arguments to a unary keyword, must raise a &ccwl-violation condition" (guard (exception (else (ccwl-violation? exception))) - (macroexpand - '(command #:inputs (message #:type string) - #:run "echo" message - #:outputs (stdout #:type stdout) - #:stdin "foo" "bar")))) + (begin (macroexpand + '(command #:inputs (message #:type string) + #:run "echo" message + #:outputs (stdout #:type stdout) + #:stdin "foo" "bar")) + #f))) ;; TODO: Define this in the lexical scope of the test that requires ;; it. -- cgit v1.2.3