summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArun Isaac2023-10-16 15:19:27 +0100
committerArun Isaac2023-10-16 15:22:08 +0100
commit5e774d8f08d9a89352873289d856d0d5c2a47f41 (patch)
tree4f19693fae08ff3010f2780570de204e59df4833 /tests
parent2a3ba9b993575da807ecf0f99a5c77ab5076a003 (diff)
downloadccwl-5e774d8f08d9a89352873289d856d0d5c2a47f41.tar.gz
ccwl-5e774d8f08d9a89352873289d856d0d5c2a47f41.tar.lz
ccwl-5e774d8f08d9a89352873289d856d0d5c2a47f41.zip
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/ccwl.scm20
1 files changed, 20 insertions, 0 deletions
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")