File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env cwl-runner
2
+ cwlVersion: v1.2
3
+ class: Workflow
4
+ $namespaces:
5
+ cwltool: "http://commonwl. org/cwltool#"
6
+ requirements :
7
+ InlineJavascriptRequirement: {}
8
+
9
+ inputs :
10
+ i1: int
11
+ outputs :
12
+ o1:
13
+ type : int
14
+ outputSource : subworkflow/o1
15
+ steps :
16
+ subworkflow:
17
+ run :
18
+ class: ExpressionTool
19
+ inputs :
20
+ i1: int
21
+ i2: int ?
22
+ outputs :
23
+ o1: int
24
+ expression: >
25
+ ${return {'o1' : inputs.i1 + 1};}
26
+ in :
27
+ i1: i1
28
+ out : [o1]
29
+ requirements :
30
+ cwltool:Loop:
31
+ loopWhen: $(inputs.i1 < 10)
32
+ loop:
33
+ i1: o1
34
+ outputMethod: last
Original file line number Diff line number Diff line change @@ -235,6 +235,19 @@ def test_scatter_inside_loop() -> None:
235
235
assert json .loads (stream .getvalue ()) == expected
236
236
237
237
238
+ def test_loop_opt_variable () -> None :
239
+ """Test a loop case with two variables but one is optional."""
240
+ stream = StringIO ()
241
+ params = [
242
+ "--enable-ext" ,
243
+ get_data ("tests/loop/opt-var-loop.cwl" ),
244
+ get_data ("tests/loop/single-var-loop-job.yml" ),
245
+ ]
246
+ main (params , stdout = stream )
247
+ expected = {"o1" : 10 }
248
+ assert json .loads (stream .getvalue ()) == expected
249
+
250
+
238
251
def test_nested_loops () -> None :
239
252
"""Test a workflow with two nested loops."""
240
253
stream = StringIO ()
You can’t perform that action at this time.
0 commit comments