Skip to content

Commit b962666

Browse files
authored
Add test that changing basename with an ExpressionTool (#158)
Test to assert that when used in a command line tool it does actually use the specified basename and not the original file name.
1 parent 5551e59 commit b962666

File tree

5 files changed

+69
-1
lines changed

5 files changed

+69
-1
lines changed

conformance_tests.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3469,7 +3469,7 @@
34693469
tags: [ required, command_line_tool ]
34703470

34713471
- label: record_with_default
3472-
output:
3472+
output:
34733473
same_record:
34743474
first: y
34753475
second: 23
@@ -3514,3 +3514,11 @@
35143514
tool: tests/record_outputeval_nojs.cwl
35153515
doc: Use of outputEval on a record itself, not the fields of the record (without javascript)
35163516
tags: [ required, command_line_tool ]
3517+
3518+
- label: staging-basename
3519+
output: {}
3520+
tool: tests/staging-basename/wf_ren.cwl
3521+
doc: |
3522+
Use of expression tool to change basename of file, then correctly staging
3523+
the file using the new name.
3524+
tags: [ required, command_line_tool, inline_javascript, expression_tool ]

tests/staging-basename/check.cwl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class: CommandLineTool
2+
cwlVersion: v1.2
3+
inputs:
4+
p: File
5+
checkname: string
6+
outputs: []
7+
arguments:
8+
- sh
9+
- "-c"
10+
- |
11+
name=`basename $(inputs.p.path)`
12+
ls -l $(inputs.p.path)
13+
if test $name = $(inputs.checkname) ; then
14+
echo success
15+
else
16+
echo expected basename to be $(inputs.checkname) but was $name
17+
exit 1
18+
fi

tests/staging-basename/rename.cwl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class: ExpressionTool
2+
cwlVersion: v1.2
3+
inputs:
4+
f1: File
5+
newname: string
6+
outputs:
7+
out: File
8+
expression: |
9+
${
10+
inputs.f1.basename = inputs.newname;
11+
return {"out": inputs.f1};
12+
}

tests/staging-basename/wf_ren.cwl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
class: Workflow
2+
cwlVersion: v1.2
3+
inputs:
4+
f1:
5+
type: File
6+
default:
7+
class: File
8+
location: whale.txt
9+
newname:
10+
type: string
11+
default: "badger.txt"
12+
outputs: []
13+
requirements:
14+
StepInputExpressionRequirement: {}
15+
InlineJavascriptRequirement: {}
16+
steps:
17+
rename:
18+
in:
19+
f1: f1
20+
newname: newname
21+
run: rename.cwl
22+
out: [out]
23+
24+
echo:
25+
in:
26+
p: rename/out
27+
checkname: newname
28+
out: []
29+
run: check.cwl

tests/staging-basename/whale.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
whale

0 commit comments

Comments
 (0)