about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ccwl.scm32
-rw-r--r--tests/cwl.scm16
-rw-r--r--tests/ui.scm5
-rw-r--r--tests/utils.scm14
4 files changed, 50 insertions, 17 deletions
diff --git a/tests/ccwl.scm b/tests/ccwl.scm
index 2d755ad..85ec322 100644
--- a/tests/ccwl.scm
+++ b/tests/ccwl.scm
@@ -1,5 +1,5 @@
 ;;; ccwl --- Concise Common Workflow Language
-;;; Copyright © 2021–2024 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2021–2026 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of ccwl.
 ;;;
@@ -20,6 +20,7 @@
              (srfi srfi-1)
              (srfi srfi-64)
              (srfi srfi-71)
+             (ice-9 match)
              (ccwl ccwl)
              (ccwl conditions))
 
@@ -60,17 +61,14 @@
 
 (test-begin "ccwl")
 
-(test-assert "stdin input should not have inputBinding"
-  (not (assoc-ref
-        (assoc-ref
-         (assoc-ref
-          ((@@ (ccwl cwl) command->cwl-scm)
-           (command #:inputs (file #:type File)
-                    #:run "wc" "-c"
-                    #:stdin file))
-          'inputs)
-         'file)
-        'inputBinding)))
+(test-equal "stdin input should not have inputBinding"
+  '((file (type . File)))
+  (assoc-ref
+   ((@@ (ccwl cwl) command->cwl-scm)
+    (command #:inputs (file #:type File)
+             #:run "wc" "-c"
+             #:stdin file))
+   'inputs))
 
 (test-equal "read all forms of inputs and outputs from a CWL workflow"
   '(((spam string))
@@ -189,6 +187,16 @@
   (workflow ()
     (print-int #:number 42)))
 
+;; TODO: Define this in the lexical scope of the test that requires
+;; it.
+(define print-workflow
+  (workflow ((message #:type string))
+    (print #:message message)))
+
+(test-assert "allow literals as arguments to workflows"
+  (workflow ()
+    (print-workflow #:message "foo")))
+
 (test-condition "step supplied with an unknown key must raise a &ccwl-violation condition"
   ccwl-violation?
   (macroexpand
diff --git a/tests/cwl.scm b/tests/cwl.scm
index ba619ab..ae8fa6b 100644
--- a/tests/cwl.scm
+++ b/tests/cwl.scm
@@ -1,5 +1,5 @@
 ;;; ccwl --- Concise Common Workflow Language
-;;; Copyright © 2023 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2023, 2025 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of ccwl.
 ;;;
@@ -18,6 +18,12 @@
 
 (use-modules (srfi srfi-64))
 
+(define make-input
+  (@@ (ccwl ccwl) make-input))
+
+(define input->cwl-scm
+  (@@ (ccwl cwl) input->cwl-scm))
+
 (define type->cwl
   (@@ (ccwl cwl) type->cwl))
 
@@ -41,4 +47,12 @@
               (items . File))))
   (type->cwl (make-array-type (make-array-type 'File))))
 
+(test-equal "Serialize #f defaults in input values"
+  '("foo"
+    (type . boolean)
+    (default . #f)
+    (label . "foo"))
+  (input->cwl-scm
+   (make-input "foo" 'boolean "foo" #f #f #f #t #f #f '())))
+
 (test-end "cwl")
diff --git a/tests/ui.scm b/tests/ui.scm
index a5741c0..115a20e 100644
--- a/tests/ui.scm
+++ b/tests/ui.scm
@@ -1,5 +1,5 @@
 ;;; ccwl --- Concise Common Workflow Language
-;;; Copyright © 2023 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2023, 2025 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of ccwl.
 ;;;
@@ -16,7 +16,8 @@
 ;;; You should have received a copy of the GNU General Public License
 ;;; along with ccwl.  If not, see <https://www.gnu.org/licenses/>.
 
-(use-modules (srfi srfi-64)
+(use-modules (srfi srfi-26)
+             (srfi srfi-64)
              (term ansi-color)
              (ccwl ui)
              (ccwl conditions))
diff --git a/tests/utils.scm b/tests/utils.scm
index 50c3396..d786d02 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -1,5 +1,5 @@
 ;;; ccwl --- Concise Common Workflow Language
-;;; Copyright © 2021, 2022, 2023 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2021, 2022, 2023, 2025 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of ccwl.
 ;;;
@@ -194,7 +194,17 @@
   (let ((squares cubes (mapn (lambda (n)
                                (values (expt n 2)
                                        (expt n 3)))
-                             (iota 5))))
+                             (iota 5)
+                             2)))
+    (list squares cubes)))
+
+(test-equal "mapn on an empty list"
+  '(() ())
+  (let ((squares cubes (mapn (lambda (n)
+                               (values (expt n 2)
+                                       (expt n 3)))
+                             '()
+                             2)))
     (list squares cubes)))
 
 (test-equal "foldn"