diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2023-01-13 15:14:04 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2023-01-13 15:29:28 +0000 |
| commit | 1a89507d7c4fa7d8cfa87872578cc833d52f88f8 (patch) | |
| tree | 864b925da1930e7babcb3e8d899eeed2288af550 | |
| parent | 890c61216a726a6ecad41e1f8146c169aa91812d (diff) | |
| download | rust-1a89507d7c4fa7d8cfa87872578cc833d52f88f8.tar.gz rust-1a89507d7c4fa7d8cfa87872578cc833d52f88f8.zip | |
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.
| -rw-r--r-- | build_system/tests.rs | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/build_system/tests.rs b/build_system/tests.rs index 8bef6f73380..25c2457785e 100644 --- a/build_system/tests.rs +++ b/build_system/tests.rs @@ -169,9 +169,10 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[ REGEX.source_dir(&runner.dirs).join("examples").join("regexdna-input.txt"), ) .unwrap(); - let expected_path = - REGEX.source_dir(&runner.dirs).join("examples").join("regexdna-output.txt"); - let expected = fs::read_to_string(&expected_path).unwrap(); + let expected = fs::read_to_string( + REGEX.source_dir(&runner.dirs).join("examples").join("regexdna-output.txt"), + ) + .unwrap(); let output = spawn_and_wait_with_input(run_cmd, input); // Make sure `[codegen mono items] start` doesn't poison the diff @@ -184,20 +185,9 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[ let output_matches = expected.lines().eq(output.lines()); if !output_matches { - let res_path = REGEX.source_dir(&runner.dirs).join("res.txt"); - fs::write(&res_path, &output).unwrap(); - - if cfg!(windows) { - println!("Output files don't match!"); - println!("Expected Output:\n{}", expected); - println!("Actual Output:\n{}", output); - } else { - let mut diff = Command::new("diff"); - diff.arg("-u"); - diff.arg(res_path); - diff.arg(expected_path); - spawn_and_wait(diff); - } + println!("Output files don't match!"); + println!("Expected Output:\n{}", expected); + println!("Actual Output:\n{}", output); std::process::exit(1); } |
