From 7dbe776cb56803d9c66a847f5ac3613366754838 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 9 Oct 2023 14:51:56 +0100 Subject: 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. --- ccwl/ccwl.scm | 6 ++++++ tests/ccwl.scm | 9 +++++++++ 2 files changed, 15 insertions(+) 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 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") -- cgit v1.2.3