-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prototype multi-line strings in version development
- Loading branch information
Showing
7 changed files
with
220 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
# bash-tap tests for WDL multi-line strings (runs multi_line_strings.wdl) | ||
set -o pipefail | ||
|
||
cd "$(dirname $0)/.." | ||
SOURCE_DIR="$(pwd)" | ||
|
||
BASH_TAP_ROOT="tests/bash-tap" | ||
source tests/bash-tap/bash-tap-bootstrap | ||
|
||
export PYTHONPATH="$SOURCE_DIR:$PYTHONPATH" | ||
miniwdl="python3 -m WDL" | ||
|
||
plan tests 1 | ||
|
||
if [[ -z $TMPDIR ]]; then | ||
TMPDIR=/tmp | ||
fi | ||
DN=$(mktemp -d "${TMPDIR}/miniwdl_tests_XXXXXX") | ||
DN=$(realpath "$DN") | ||
cd $DN | ||
|
||
$miniwdl run "$SOURCE_DIR/tests/multi_line_strings.wdl" --verbose | ||
is $? "0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
version development | ||
|
||
# Test cases for multi-line string literals (openwdl PR# 414) | ||
# The integration test suite executes this WDL (via multi_line_strings.t) which you can also run | ||
# standalone in your miniwdl repo clone: | ||
# python3 -m WDL run tests/multi_line_strings.wdl --dir /tmp --verbose | ||
workflow test_multi_line_strings { | ||
String speed = "quick" | ||
String color = "brown" | ||
String verb = "jumps" | ||
|
||
String spaces = " " | ||
String name = "Henry" | ||
String company = "Acme" | ||
|
||
# Test cases: pairs with a multi-line string and an escaped single-line string; the two should | ||
# equal each other. | ||
Array[Pair[String, String]] examples = [ | ||
(<<< | ||
The ~{speed} ~{color} | ||
fox ~{verb} over \ | ||
the lazy dog.>>>, | ||
"The quick brown\n fox jumps over the lazy dog."), | ||
(<<<hello world>>>, "hello world"), | ||
(<<< hello world >>>, "hello world"), | ||
(<<< | ||
hello world>>>, "hello world"), | ||
(<<< | ||
hello world | ||
>>>, "hello world"), | ||
(<<< | ||
hello \ | ||
world \ | ||
>>>, "hello world"), | ||
(<<< | ||
hello world | ||
>>>, "\nhello world\n"), | ||
(<<< | ||
hello \ | ||
world | ||
>>>, "hello world"), | ||
(<<< | ||
this is a | ||
multi-line string | ||
>>>, "this is a\n\n multi-line string"), | ||
(<<< | ||
this is a | ||
multi-line string | ||
>>>, "this is a\n\nmulti-line string\n"), | ||
(<<< | ||
this is a \ | ||
string that \ | ||
contains no newlines | ||
>>>, "this is a string that contains no newlines"), | ||
(<<< | ||
multi-line string \ | ||
with 'single' and "double" quotes | ||
>>>, "multi-line string with 'single' and \"double\" quotes"), | ||
(<<< | ||
~{spaces}Hello ~{name}, | ||
~{spaces}Welcome to ~{company}! | ||
>>>, " Hello Henry,\n Welcome to Acme!"), | ||
(<<< | ||
\x20 Forced | ||
indentation | ||
>>>, " Forced\n indentation"), | ||
(<<<abc\ | ||
>>>, "abc"), | ||
(<<<abc\\ | ||
>>>, "abc\\"), | ||
(<<<abc\\>>>, 'abc\\'), | ||
(<<<abc\\ | ||
def>>>, "abc\\\ndef"), | ||
(<<<abc\\\ | ||
def>>>, "abc\\def") | ||
] | ||
|
||
scatter (ex in examples) { | ||
if (ex.left != ex.right) { | ||
call fail { input: lhs = ex.left, rhs = ex.right } | ||
} | ||
} | ||
|
||
output { | ||
Int cases_ok = length(examples) | ||
} | ||
} | ||
|
||
task fail { | ||
input { | ||
String lhs | ||
String rhs | ||
} | ||
|
||
command { | ||
>&2 echo "$(cat ~{write_json(lhs)}) != $(cat ~{write_json(rhs)})" | ||
exit 1 | ||
} | ||
|
||
output {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters