From 5e774d8f08d9a89352873289d856d0d5c2a47f41 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 16 Oct 2023 15:19:27 +0100 Subject: ccwl: Check if inputs in command definitions are defined. * ccwl/ccwl.scm (command): Check if inputs used in #:run arguments of command definitions are actually defined. * tests/ccwl.scm ("command definitions with undefined inputs in their #:run arguments must raise a &ccwl-violation condition", "command definitions with undefined prefix inputs in their #:run arguments must raise a &ccwl-violation condition"): New tests. --- tests/ccwl.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/ccwl.scm') diff --git a/tests/ccwl.scm b/tests/ccwl.scm index 2f3f88d..334633b 100644 --- a/tests/ccwl.scm +++ b/tests/ccwl.scm @@ -232,4 +232,24 @@ #:stdout captured-stdout)) #f))) +(test-assert "command definitions with undefined inputs in their #:run arguments must raise a &ccwl-violation condition" + (guard (exception + (else (and (ccwl-violation? exception) + (string=? (formatted-message-format exception) + "Undefined input ~a")))) + (begin (macroexpand + '(command #:inputs (number #:type int) + #:run "echo" n)) + #f))) + +(test-assert "command definitions with undefined prefix inputs in their #:run arguments must raise a &ccwl-violation condition" + (guard (exception + (else (and (ccwl-violation? exception) + (string=? (formatted-message-format exception) + "Undefined input ~a")))) + (begin (macroexpand + '(command #:inputs (number #:type int) + #:run "echo" ("-x" n))) + #f))) + (test-end "ccwl") -- cgit v1.2.3