diff options
author | Arun Isaac | 2023-10-09 14:51:56 +0100 |
---|---|---|
committer | Arun Isaac | 2023-10-09 20:32:39 +0100 |
commit | 7dbe776cb56803d9c66a847f5ac3613366754838 (patch) | |
tree | 19fc925dec08564921afdb3c9f96955bcf737bfb | |
parent | 548cc54bc27b92c3a35a79d1af7440fbad896752 (diff) | |
download | ccwl-7dbe776cb56803d9c66a847f5ac3613366754838.tar.gz ccwl-7dbe776cb56803d9c66a847f5ac3613366754838.tar.lz ccwl-7dbe776cb56803d9c66a847f5ac3613366754838.zip |
ccwl: Error out if steps with expression commands have no identifier.
* ccwl/ccwl.scm (collect-steps): Error out if steps with expressions
that evaluate to commands have no identifier.
* tests/ccwl.scm ("step with expression that evaluates to a command
but without a step identifier must raise a &ccwl-violation
condition"): New test.
-rw-r--r-- | ccwl/ccwl.scm | 6 | ||||
-rw-r--r-- | tests/ccwl.scm | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm index b158947..286fd7a 100644 --- a/ccwl/ccwl.scm +++ b/ccwl/ccwl.scm @@ -535,6 +535,12 @@ represented by <step> objects." (pairify (syntax->datum #'(args ...))))))))) ;; ccwl functions with an implicit step identifier ((function args ...) + ;; Ensure that steps with expression commands have identifiers. + (unless (symbol? (syntax->datum #'function)) + (raise-exception + (condition (ccwl-violation #'function) + (formatted-message "Step with expression ~a that evaluates to a command must have identifier" + (syntax->datum #'function))))) (collect-steps #'(function (function) args ...) input-keys)) ;; any other unrecognized syntax diff --git a/tests/ccwl.scm b/tests/ccwl.scm index 2207200..4f10450 100644 --- a/tests/ccwl.scm +++ b/tests/ccwl.scm @@ -145,4 +145,13 @@ (print) #:message message))) +(test-assert "step with expression that evaluates to a command but without a step identifier must raise a &ccwl-violation condition" + (guard (exception + (else (ccwl-violation? exception))) + (begin (macroexpand + '(workflow ((message #:type string)) + ((and #t print) + #:message message))) + #f))) + (test-end "ccwl") |