From e12759ce31a746b0532fbb13371579f0aa19b518 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 16 Jan 2022 13:01:25 +0530 Subject: ccwl: Raise exceptions on command syntax errors. * ccwl/ccwl.scm (command): Raise &ccwl-violation conditions on syntax errors. * tests/ccwl.scm ("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"): New tests. --- tests/ccwl.scm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests/ccwl.scm') diff --git a/tests/ccwl.scm b/tests/ccwl.scm index d667b32..d99650e 100644 --- a/tests/ccwl.scm +++ b/tests/ccwl.scm @@ -85,4 +85,30 @@ (else (ccwl-violation? exception))) (output #'(message #:type int string)))) +(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))))) + +(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))))) + +(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")))) + (test-end "ccwl") -- cgit v1.2.3