|
5 | 5 | use anyhow::Result; |
6 | 6 | use assert_cmd::prelude::*; // Add methods on commands |
7 | 7 | use predicates::prelude::*; // Used for writing assertions |
| 8 | +use std::fs; |
8 | 9 | use std::path::Path; |
9 | 10 | use std::process::Command; // Run programs |
10 | 11 | // use std::fs::File; |
@@ -85,23 +86,23 @@ mod tests { |
85 | 86 |
|
86 | 87 | Ok(()) |
87 | 88 | } |
88 | | -} |
89 | 89 |
|
90 | | -#[test] |
91 | | -fn test_infer_dot_star() -> Result<(), Box<dyn std::error::Error>> { |
92 | | - let expected_output = fs::read_to_string("test/infer_dot_star/expected/expected.sv")?; |
93 | | - let mut cmd = Command::cargo_bin("morty")?; |
94 | | - cmd.arg("--infer_dot_star") |
95 | | - .arg(Path::new("test/infer_dot_star/top.sv").as_os_str()) |
96 | | - .arg(Path::new("test/infer_dot_star/submodule.sv").as_os_str()); |
97 | | - let binding = cmd.assert().success(); |
98 | | - // we have to do it this complex such that windows tests are passing |
99 | | - // windows has a different output format and injects \r into the output |
100 | | - let output = &binding.get_output().stdout; |
101 | | - let output_str = String::from_utf8(output.clone()).unwrap(); |
102 | | - let expected_output_stripped = expected_output.replace(&['\r'][..], ""); |
103 | | - let output_str_stripped = output_str.replace(&['\r'][..], ""); |
104 | | - let compare_fn = predicate::str::contains(expected_output_stripped); |
105 | | - assert_eq!(compare_fn.eval(&output_str_stripped), true); |
106 | | - Ok(()) |
| 90 | + #[test] |
| 91 | + fn test_infer_dot_star() -> Result<(), Box<dyn std::error::Error>> { |
| 92 | + let expected_output = fs::read_to_string("test/infer_dot_star/expected/expected.sv")?; |
| 93 | + let mut cmd = Command::cargo_bin("morty")?; |
| 94 | + cmd.arg("--infer_dot_star") |
| 95 | + .arg(Path::new("test/infer_dot_star/top.sv").as_os_str()) |
| 96 | + .arg(Path::new("test/infer_dot_star/submodule.sv").as_os_str()); |
| 97 | + let binding = cmd.assert().success(); |
| 98 | + // we have to do it this complex such that windows tests are passing |
| 99 | + // windows has a different output format and injects \r into the output |
| 100 | + let output = &binding.get_output().stdout; |
| 101 | + let output_str = String::from_utf8(output.clone()).unwrap(); |
| 102 | + let expected_output_stripped = expected_output.replace(&['\r'][..], ""); |
| 103 | + let output_str_stripped = output_str.replace(&['\r'][..], ""); |
| 104 | + let compare_fn = predicate::str::contains(expected_output_stripped); |
| 105 | + assert_eq!(compare_fn.eval(&output_str_stripped), true); |
| 106 | + Ok(()) |
| 107 | + } |
107 | 108 | } |
0 commit comments