From cb66af826596b7bfba0fa45f8eb25fcf1613bc13 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 15 Oct 2023 12:13:58 +0100 Subject: ccwl: Make #:stderr and #:stdout first class parameters. #:stderr and #:stdout, especially #:stdout, are commonly required. They ought to be first class parameters and not tucked away into #:other. * ccwl/ccwl.scm ()[stderr, stdout]: New fields. * ccwl/ccwl.scm (command): Accept #:stderr and #:stdout as first class parameters. * ccwl/cwl.scm (command->cwl-scm): Serialize stderr and stdout fields. * doc/capture-stdout.scm (print), doc/decompress-compile-run.scm (run), doc/checksum.scm (md5sum, sha1sum, sha256sum), doc/spell-check.scm (find-misspellings): Capture stdout in file. * doc/checksum.scm, doc/decompress-compile-run.scm: * doc/ccwl.skb (Tutorial)[Capturing the standard output stream of a command]: Document #:stdout first class parameter. * doc/ccwl.skb (Tutorial)[Workflow with multiple steps]: Capture stdout in explicitly named files. * tests/ccwl.scm ("commands with non-string #:stderr parameters must raise a &ccwl-violation condition", "commands with non-string #:stdout parameters must raise a &ccwl-violation condition"): New tests. --- tests/ccwl.scm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests') diff --git a/tests/ccwl.scm b/tests/ccwl.scm index 76bcecd..e7a0cb7 100644 --- a/tests/ccwl.scm +++ b/tests/ccwl.scm @@ -197,4 +197,28 @@ (print (print2) #:message message2))) #f))) +(test-assert "commands with non-string #:stderr parameters must raise a &ccwl-violation condition" + (guard (exception + (else (and (ccwl-violation? exception) + (string=? (formatted-message-format exception) + "#:stderr parameter must be a string")))) + (begin (macroexpand + '(command #:inputs (message #:type string) + #:run "echo" message + #:outputs (printed #:type stderr) + #:stderr captured-stderr)) + #f))) + +(test-assert "commands with non-string #:stdout parameters must raise a &ccwl-violation condition" + (guard (exception + (else (and (ccwl-violation? exception) + (string=? (formatted-message-format exception) + "#:stdout parameter must be a string")))) + (begin (macroexpand + '(command #:inputs (message #:type string) + #:run "echo" message + #:outputs (printed #:type stdout) + #:stdout captured-stdout)) + #f))) + (test-end "ccwl") -- cgit v1.2.3