about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ccwl/ccwl.scm19
-rw-r--r--tests/ccwl.scm5
2 files changed, 24 insertions, 0 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm
index cafc3c5..8714e81 100644
--- a/ccwl/ccwl.scm
+++ b/ccwl/ccwl.scm
@@ -272,6 +272,25 @@ compared using @code{equal?}."
             (syntax-lambda** (id #:key (type #'File) binding source (other #'()))
               (ensure-yaml-serializable binding "#:binding")
               (ensure-yaml-serializable other "#:other")
+              (when (and (eq? (syntax->datum type)
+                              'stdout)
+                         (syntax->datum binding))
+                (raise-continuable
+                 (condition (ccwl-violation
+                             ;; Find the syntax object corresponding
+                             ;; to the #:binding keyword. The binding
+                             ;; variable is only the value of the
+                             ;; argument. TODO: Highlight both the
+                             ;; #:binding keyword and its value in the
+                             ;; error message once our condition
+                             ;; system is capable of representing
+                             ;; that.
+                             (find (lambda (arg)
+                                     (eq? (syntax->datum arg)
+                                          #:binding))
+                                   #'(args ...)))
+                            (formatted-message "~a not allowed with stdout type output"
+                                               #:binding))))
               #`(make-output '#,id
                              #,(construct-type-syntax type)
                              '#,binding #,source '#,other))
diff --git a/tests/ccwl.scm b/tests/ccwl.scm
index ea14f86..bd852e9 100644
--- a/tests/ccwl.scm
+++ b/tests/ccwl.scm
@@ -108,6 +108,11 @@
   ccwl-violation?
   (output #'(message #:type int string)))
 
+(test-condition "output, when passed a #:binding to an stdout type, must raise a &ccwl-violation condition"
+  ccwl-violation?
+  (output #'(message #:type stdout
+                     #:binding ((glob . "output.txt")))))
+
 (test-condition "command, when passed positional arguments, must raise a &ccwl-violation condition"
   ccwl-violation?
   (macroexpand