From b3f18dbf95d80d92a708f04be53b8d98b7980a80 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 16 Jan 2022 12:42:20 +0530 Subject: ccwl: Raise exceptions on input syntax errors. * ccwl/ccwl.scm: Import (rnrs conditions), (rnrs exceptions) and (ccwl conditions). (input, input-spec-id): Raise &ccwl-violation conditions on syntax errors. * tests/ccwl.scm: Import (rnrs exceptions) and (ccwl conditions). (input): New function. ("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"): New tests. --- tests/ccwl.scm | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/ccwl.scm b/tests/ccwl.scm index 015dcde..bc9fb01 100644 --- a/tests/ccwl.scm +++ b/tests/ccwl.scm @@ -16,8 +16,13 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with ccwl. If not, see . -(use-modules (srfi srfi-64) - (ccwl ccwl)) +(use-modules (rnrs exceptions) + (srfi srfi-64) + (ccwl ccwl) + (ccwl conditions)) + +(define input + (@@ (ccwl ccwl) input)) (test-begin "ccwl") @@ -47,4 +52,19 @@ (output-type output))) (cwl-workflow-outputs cwl-workflow))))) +(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)))) + +(test-assert "input, when passed an unrecognized keyword, must raise a &ccwl-violation condition" + (guard (exception + (else (ccwl-violation? exception))) + (input #'(message #:foo string)))) + +(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)))) + (test-end "ccwl") -- cgit v1.2.3