summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArun Isaac2023-12-01 22:41:17 +0000
committerArun Isaac2023-12-01 22:54:33 +0000
commitd63f2df9d10ab425930900283323aba4b96b8a8c (patch)
tree0ddef6c50b0ae1ba77bb465674b83599dc842ba1 /tests
parentd5fadbd7d93fe047a37591a149bae007c359b88c (diff)
downloadccwl-d63f2df9d10ab425930900283323aba4b96b8a8c.tar.gz
ccwl-d63f2df9d10ab425930900283323aba4b96b8a8c.tar.lz
ccwl-d63f2df9d10ab425930900283323aba4b96b8a8c.zip
ccwl: Deduplicate global workflow input keys across tee branches.
* ccwl/ccwl.scm (collect-steps): Deduplicate global workflow input keys across branches of tees. * tests/ccwl.scm (key, collect-steps): New variables. ("rename should work even on the final output of a workflow"): Update order of elements in expected list. ("tee must deduplicate global workflow input keys"): New test. * ccwl/utils.scm (append-mapn): Delete function. * tests/utils.scm ("append-mapn"): Delete test.
Diffstat (limited to 'tests')
-rw-r--r--tests/ccwl.scm17
-rw-r--r--tests/utils.scm9
2 files changed, 16 insertions, 10 deletions
diff --git a/tests/ccwl.scm b/tests/ccwl.scm
index 9e73c50..f0e2911 100644
--- a/tests/ccwl.scm
+++ b/tests/ccwl.scm
@@ -17,7 +17,9 @@
;;; along with ccwl. If not, see <https://www.gnu.org/licenses/>.
(use-modules (rnrs exceptions)
+ (srfi srfi-1)
(srfi srfi-64)
+ (srfi srfi-71)
(ccwl ccwl)
(ccwl conditions))
@@ -30,6 +32,12 @@
(define make-array-type
(@@ (ccwl ccwl) make-array-type))
+(define key
+ (@@ (ccwl ccwl) key))
+
+(define collect-steps
+ (@@ (ccwl ccwl) collect-steps))
+
(define-syntax construct-type-syntax-wrapper
(lambda (x)
(syntax-case x ()
@@ -133,7 +141,7 @@
#:outputs (printed-message #:type stdout)))
(test-equal "rename should work even on the final output of a workflow"
- (list 'out1 'printed-message)
+ (list 'printed-message 'out1)
(map output-id
(workflow-outputs
(workflow ((message1 #:type string)
@@ -315,4 +323,11 @@
'(command #:inputs (messages #:type (array string))
#:run "echo" (array messages #:separator foo))))
+(test-assert "tee must deduplicate global workflow input keys"
+ (let ((keys steps (collect-steps #'(tee (print #:message message)
+ (identity))
+ (list (key 'message)))))
+ (= (length (delete-duplicates keys eq?))
+ (length keys))))
+
(test-end "ccwl")
diff --git a/tests/utils.scm b/tests/utils.scm
index 66220cc..50c3396 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -197,15 +197,6 @@
(iota 5))))
(list squares cubes)))
-(test-equal "append-mapn"
- '((0 0 1 1 2 4 3 9 4 16)
- (0 0 1 1 2 8 3 27 4 64))
- (let ((squares cubes (append-mapn (lambda (n)
- (values (list n (expt n 2))
- (list n (expt n 3))))
- (iota 5))))
- (list squares cubes)))
-
(test-equal "foldn"
'(45 285)
(let ((sum sum-of-squares