Skip to content

Commit 1a89507

Browse files
committed
Don't use the diff command in regex test
The output is small enough that getting a pretty diff isn't important. In addition this reduces the amount of commands the build system depends on.
1 parent 890c612 commit 1a89507

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

build_system/tests.rs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,10 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
169169
REGEX.source_dir(&runner.dirs).join("examples").join("regexdna-input.txt"),
170170
)
171171
.unwrap();
172-
let expected_path =
173-
REGEX.source_dir(&runner.dirs).join("examples").join("regexdna-output.txt");
174-
let expected = fs::read_to_string(&expected_path).unwrap();
172+
let expected = fs::read_to_string(
173+
REGEX.source_dir(&runner.dirs).join("examples").join("regexdna-output.txt"),
174+
)
175+
.unwrap();
175176

176177
let output = spawn_and_wait_with_input(run_cmd, input);
177178
// Make sure `[codegen mono items] start` doesn't poison the diff
@@ -184,20 +185,9 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
184185

185186
let output_matches = expected.lines().eq(output.lines());
186187
if !output_matches {
187-
let res_path = REGEX.source_dir(&runner.dirs).join("res.txt");
188-
fs::write(&res_path, &output).unwrap();
189-
190-
if cfg!(windows) {
191-
println!("Output files don't match!");
192-
println!("Expected Output:\n{}", expected);
193-
println!("Actual Output:\n{}", output);
194-
} else {
195-
let mut diff = Command::new("diff");
196-
diff.arg("-u");
197-
diff.arg(res_path);
198-
diff.arg(expected_path);
199-
spawn_and_wait(diff);
200-
}
188+
println!("Output files don't match!");
189+
println!("Expected Output:\n{}", expected);
190+
println!("Actual Output:\n{}", output);
201191

202192
std::process::exit(1);
203193
}

0 commit comments

Comments
 (0)