diff --git a/wdl-engine/tests/tasks.rs b/wdl-engine/tests/tasks.rs index 465dd582c..353e83826 100644 --- a/wdl-engine/tests/tasks.rs +++ b/wdl-engine/tests/tasks.rs @@ -22,7 +22,6 @@ use std::collections::HashSet; use std::env; use std::ffi::OsStr; use std::fs; -use std::path::MAIN_SEPARATOR; use std::path::Path; use std::path::PathBuf; use std::path::absolute; @@ -88,19 +87,23 @@ fn find_tests() -> Vec { /// Normalizes a result. fn normalize(root: &Path, s: &str) -> String { + // Normalize paths separation characters first + let s = s + .replace("\\", "/") + .replace("//", "/") + .replace("\r\n", "\n"); + // Strip any paths that start with the root directory - let s: Cow<'_, str> = if let Some(mut root) = root.to_str().map(str::to_string) { - if !root.ends_with(MAIN_SEPARATOR) { - root.push(MAIN_SEPARATOR); + if let Some(root) = root.to_str().map(str::to_string) { + let mut root = root.replace('\\', "/"); + if !root.ends_with('/') { + root.push('/'); } - s.replace(&root, "").into() + s.replace(&root, "") } else { - s.into() - }; - - // Normalize paths separation characters - s.replace('\\', "/").replace("\r\n", "\n") + s + } } /// Compares a single result. diff --git a/wdl-engine/tests/tasks/flags-task/source.wdl b/wdl-engine/tests/tasks/flags-task/source.wdl index 94a7e579a..98e971d32 100644 --- a/wdl-engine/tests/tasks/flags-task/source.wdl +++ b/wdl-engine/tests/tasks/flags-task/source.wdl @@ -15,7 +15,7 @@ task flags { # Instead, make both the flag and the value conditional on `max_matches` # being defined. - grep ~{"-m " + max_matches} ~{pattern} ~{infile} | wc -l | sed 's/^ *//' + grep ~{"-m " + max_matches} ~{pattern} '~{infile}' | wc -l | sed 's/^ *//' >>> output { diff --git a/wdl-engine/tests/tasks/input-type-qualifiers/source.wdl b/wdl-engine/tests/tasks/input-type-qualifiers/source.wdl index cabeb5681..6f7147ca8 100644 --- a/wdl-engine/tests/tasks/input-type-qualifiers/source.wdl +++ b/wdl-engine/tests/tasks/input-type-qualifiers/source.wdl @@ -13,13 +13,13 @@ task input_type_quantifiers { } command <<< - cat ~{write_lines(a)} >> result - cat ~{write_lines(b)} >> result + cat '~{write_lines(a)}' >> result + cat '~{write_lines(b)}' >> result ~{if defined(c) then - "cat ~{write_lines(select_first([c]))} >> result" + "cat '~{write_lines(select_first([c]))}' >> result" else ""} ~{if defined(e) then - "cat ~{write_lines(select_first([e]))} >> result" + "cat '~{write_lines(select_first([e]))}' >> result" else ""} >>> diff --git a/wdl-engine/tests/tasks/multiline-strings2/outputs.json b/wdl-engine/tests/tasks/multiline-strings2/outputs.json index 03dc2eb9c..905587c9c 100644 --- a/wdl-engine/tests/tasks/multiline-strings2/outputs.json +++ b/wdl-engine/tests/tasks/multiline-strings2/outputs.json @@ -6,5 +6,5 @@ "multiline_strings2.hw4": "hello world", "multiline_strings2.hw5": "hello world", "multiline_strings2.hw6": "hello world", - "multiline_strings2.not_equivalent": "hello ///n world" + "multiline_strings2.not_equivalent": "hello //n world" } \ No newline at end of file diff --git a/wdl-engine/tests/tasks/private-declaration-task/source.wdl b/wdl-engine/tests/tasks/private-declaration-task/source.wdl index 1bcd2a705..2e7786aa8 100644 --- a/wdl-engine/tests/tasks/private-declaration-task/source.wdl +++ b/wdl-engine/tests/tasks/private-declaration-task/source.wdl @@ -9,7 +9,7 @@ task private_declaration { Int num_lines_clamped = if num_lines > 3 then 3 else num_lines command <<< - head -~{num_lines_clamped} ~{write_lines(lines)} + head -~{num_lines_clamped} '~{write_lines(lines)}' >>> output {