Skip to content

Commit 5b951ab

Browse files
tetronGlassOfWhiskey
authored andcommitted
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 d042009 commit 5b951ab

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
@@ -3475,7 +3475,7 @@
34753475
tags: [ required, command_line_tool ]
34763476

34773477
- label: record_with_default
3478-
output:
3478+
output:
34793479
same_record:
34803480
first: y
34813481
second: 23
@@ -3520,3 +3520,11 @@
35203520
tool: tests/record_outputeval_nojs.cwl
35213521
doc: Use of outputEval on a record itself, not the fields of the record (without javascript)
35223522
tags: [ required, command_line_tool ]
3523+
3524+
- label: staging-basename
3525+
output: {}
3526+
tool: tests/staging-basename/wf_ren.cwl
3527+
doc: |
3528+
Use of expression tool to change basename of file, then correctly staging
3529+
the file using the new name.
3530+
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)