about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2025-11-29 02:41:31 +0000
committerArun Isaac2025-11-29 02:41:31 +0000
commit9b4f73f0239b5473ea944893402cf95f6bebbc4d (patch)
tree9dd808d84d070693f89c48c6427dd4dd6c629a6e
parent7f174cbfb1c788a6f850dccdbd8aca116043208e (diff)
downloadravanan-9b4f73f0239b5473ea944893402cf95f6bebbc4d.tar.gz
ravanan-9b4f73f0239b5473ea944893402cf95f6bebbc4d.tar.lz
ravanan-9b4f73f0239b5473ea944893402cf95f6bebbc4d.zip
workflow: Identify optional inputs with a boolean #f default.
-rw-r--r--ravanan/workflow.scm2
-rw-r--r--tests/workflow.scm31
2 files changed, 32 insertions, 1 deletions
diff --git a/ravanan/workflow.scm b/ravanan/workflow.scm
index cb64a3a..c48a90e 100644
--- a/ravanan/workflow.scm
+++ b/ravanan/workflow.scm
@@ -175,7 +175,7 @@ requirements and hints of the step."
 (define (optional-input? input)
   "Return truthy value if @var{input} is optional. Else, return @code{#f}."
   ;; Inputs that either have a default or accept null values are optional.
-  (or (assoc-ref input "default")
+  (or (assoc "default" input)
       (match-type 'null
                   (formal-parameter-type
                    (assoc-ref* input "type")))))
diff --git a/tests/workflow.scm b/tests/workflow.scm
new file mode 100644
index 0000000..06b2609
--- /dev/null
+++ b/tests/workflow.scm
@@ -0,0 +1,31 @@
+;;; ravanan --- High-reproducibility CWL runner powered by Guix
+;;; Copyright © 2025 Arun Isaac <arunisaac@systemreboot.net>
+;;;
+;;; This file is part of ravanan.
+;;;
+;;; ravanan is free software: you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation, either version 3 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; ravanan is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;;; General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with ravanan.  If not, see <https://www.gnu.org/licenses/>.
+
+(use-modules (srfi srfi-64))
+
+(define optional-input?
+  (@@ (ravanan workflow) optional-input?))
+
+(test-begin "workflow")
+
+(test-assert "Inputs that have a boolean #f default are also optional"
+  (optional-input? `(("id" . "foo")
+                     ("type" . "boolean")
+                     ("default" . #f))))
+
+(test-end "workflow")