diff options
| -rw-r--r-- | e2e-tests/jobs/int-for-float-input.yaml | 1 | ||||
| -rw-r--r-- | e2e-tests/tests.yaml | 9 | ||||
| -rw-r--r-- | e2e-tests/tools/int-for-float-input.scm | 3 | ||||
| -rw-r--r-- | ravanan/work/command-line-tool.scm | 5 | ||||
| -rw-r--r-- | tests/work/command-line-tool.scm | 4 |
5 files changed, 22 insertions, 0 deletions
diff --git a/e2e-tests/jobs/int-for-float-input.yaml b/e2e-tests/jobs/int-for-float-input.yaml new file mode 100644 index 0000000..32a3dc4 --- /dev/null +++ b/e2e-tests/jobs/int-for-float-input.yaml @@ -0,0 +1 @@ +message: 1 diff --git a/e2e-tests/tests.yaml b/e2e-tests/tests.yaml index b7ab40c..e04d4dd 100644 --- a/e2e-tests/tests.yaml +++ b/e2e-tests/tests.yaml @@ -214,3 +214,12 @@ class: File size: 13 checksum: sha1$47a013e660d408619d894b20806b1d5086aab03b +- id: int-for-float-input + doc: int supplied for float input must be coerced into a float + tool: tools/int-for-float-input.cwl + job: jobs/int-for-float-input.yaml + output: + output_message: + class: File + size: 2 + checksum: sha1$e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e diff --git a/e2e-tests/tools/int-for-float-input.scm b/e2e-tests/tools/int-for-float-input.scm new file mode 100644 index 0000000..18b2f1f --- /dev/null +++ b/e2e-tests/tools/int-for-float-input.scm @@ -0,0 +1,3 @@ +(command #:inputs (message #:type float) + #:run "echo" message + #:outputs (output_message #:type stdout)) diff --git a/ravanan/work/command-line-tool.scm b/ravanan/work/command-line-tool.scm index e82a42e..74699ed 100644 --- a/ravanan/work/command-line-tool.scm +++ b/ravanan/work/command-line-tool.scm @@ -123,6 +123,11 @@ example, when @var{type} is a union type." ;; CWL specification needs separate types for these. ((eq? type 'double) (match-type obj 'float)) + ;; Accept ints as floats too. + ((eq? type 'float) + (and (or (match-type obj 'int) + (match-type obj 'float)) + 'float)) ;; Recursively match type of every element of array. ((cwl-array-type? type) (and (vector? obj) diff --git a/tests/work/command-line-tool.scm b/tests/work/command-line-tool.scm index 3d63fbb..c008412 100644 --- a/tests/work/command-line-tool.scm +++ b/tests/work/command-line-tool.scm @@ -26,4 +26,8 @@ #f (match-type 'null (cwl-array-type 'File))) +(test-equal "match int to float" + 'float + (match-type 1 'float)) + (test-end "work.command-line-tool") |
