File tree 5 files changed +18
-15
lines changed
5 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ use std::collections::HashSet;
22
22
use std:: env;
23
23
use std:: ffi:: OsStr ;
24
24
use std:: fs;
25
- use std:: path:: MAIN_SEPARATOR ;
26
25
use std:: path:: Path ;
27
26
use std:: path:: PathBuf ;
28
27
use std:: path:: absolute;
@@ -88,19 +87,23 @@ fn find_tests() -> Vec<PathBuf> {
88
87
89
88
/// Normalizes a result.
90
89
fn normalize ( root : & Path , s : & str ) -> String {
90
+ // Normalize paths separation characters first
91
+ let s = s
92
+ . replace ( "\\ " , "/" )
93
+ . replace ( "//" , "/" )
94
+ . replace ( "\r \n " , "\n " ) ;
95
+
91
96
// Strip any paths that start with the root directory
92
- let s: Cow < ' _ , str > = if let Some ( mut root) = root. to_str ( ) . map ( str:: to_string) {
93
- if !root. ends_with ( MAIN_SEPARATOR ) {
94
- root. push ( MAIN_SEPARATOR ) ;
97
+ if let Some ( root) = root. to_str ( ) . map ( str:: to_string) {
98
+ let mut root = root. replace ( '\\' , "/" ) ;
99
+ if !root. ends_with ( '/' ) {
100
+ root. push ( '/' ) ;
95
101
}
96
102
97
- s. replace ( & root, "" ) . into ( )
103
+ s. replace ( & root, "" )
98
104
} else {
99
- s. into ( )
100
- } ;
101
-
102
- // Normalize paths separation characters
103
- s. replace ( '\\' , "/" ) . replace ( "\r \n " , "\n " )
105
+ s
106
+ }
104
107
}
105
108
106
109
/// Compares a single result.
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ task flags {
15
15
16
16
# Instead, make both the flag and the value conditional on `max_matches`
17
17
# being defined.
18
- grep ~ {" -m " + max_matches} ~ {pattern} ~ {infile} | wc -l | sed ' s/^ *//'
18
+ grep ~ {" -m " + max_matches} ~ {pattern} ' ~{infile}' | wc -l | sed ' s/^ *//'
19
19
>>>
20
20
21
21
output {
Original file line number Diff line number Diff line change @@ -16,10 +16,10 @@ task input_type_quantifiers {
16
16
cat ~ {write_lines(a)} >> result
17
17
cat ~ {write_lines(b)} >> result
18
18
~ {if defined(c) then
19
- " cat ~{write_lines(select_first([c]))} >> result"
19
+ " cat ' ~{write_lines(select_first([c]))}' >> result"
20
20
else " " }
21
21
~ {if defined(e) then
22
- " cat ~{write_lines(select_first([e]))} >> result"
22
+ " cat ' ~{write_lines(select_first([e]))}' >> result"
23
23
else " " }
24
24
>>>
25
25
Original file line number Diff line number Diff line change 6
6
"multiline_strings2.hw4" : " hello world" ,
7
7
"multiline_strings2.hw5" : " hello world" ,
8
8
"multiline_strings2.hw6" : " hello world" ,
9
- "multiline_strings2.not_equivalent" : " hello /// n world"
9
+ "multiline_strings2.not_equivalent" : " hello //n world"
10
10
}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ task private_declaration {
9
9
Int num_lines_clamped = if num_lines > 3 then 3 else num_lines
10
10
11
11
command <<<
12
- head -~{num_lines_clamped} ~ {write_lines(lines)}
12
+ head -~{num_lines_clamped} ' ~{write_lines(lines)}'
13
13
>>>
14
14
15
15
output {
You can’t perform that action at this time.
0 commit comments