Get path of unit test executable. # Panics Panic if it fail to parse unit test executable
(&self, workspace: &Workspace)
| 229 | /// |
| 230 | /// Panic if it fail to parse unit test executable |
| 231 | pub fn get_unit_test_path(&self, workspace: &Workspace) -> Result<String> { |
| 232 | let output = self.get_unit_test_cmd().arg("--no-run").output()?; |
| 233 | if !output.status.success() { |
| 234 | eprint!("{}", std::str::from_utf8(&output.stderr)?); |
| 235 | panic!("Fail to compile unit test"); |
| 236 | } |
| 237 | |
| 238 | let target_dir = &workspace.target_dir; |
| 239 | let test_binary_prefix = "debug/deps/"; |
| 240 | let suffix = String::from_utf8(output.stderr)? |
| 241 | .split_once(test_binary_prefix) |
| 242 | .map(|(_, after)| after.chars().take_while(|c| ')'.ne(c)).collect::<String>()) |
| 243 | .expect("Fail to parse unit test executable path"); |
| 244 | // /Applications/MAMP/htdocs/FireDBG.for.Rust.Internal/parser/tests/example-workspace/target/debug/deps/quick_sort-c42cff5519f79ed2 |
| 245 | Ok(format!("{target_dir}/{test_binary_prefix}{suffix}")) |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | impl Binary { |
no test coverage detected