Get path of integration test executable. # Panics Panic if it fail to parse integration test executable
(&self, workspace: &Workspace, package: &Package)
| 299 | /// |
| 300 | /// Panic if it fail to parse integration test executable |
| 301 | pub fn get_test_path(&self, workspace: &Workspace, package: &Package) -> Result<String> { |
| 302 | let output = self.get_run_cmd(package).arg("--no-run").output()?; |
| 303 | if !output.status.success() { |
| 304 | eprint!("{}", std::str::from_utf8(&output.stderr)?); |
| 305 | panic!("Fail to compile integration test"); |
| 306 | } |
| 307 | |
| 308 | let target_dir = &workspace.target_dir; |
| 309 | let test_binary_prefix = "debug/deps/"; |
| 310 | let suffix = String::from_utf8(output.stderr)? |
| 311 | .split_once(test_binary_prefix) |
| 312 | .map(|(_, after)| after.chars().take_while(|c| ')'.ne(c)).collect::<String>()) |
| 313 | .expect("Fail to parse integration test executable path"); |
| 314 | // /Applications/MAMP/htdocs/FireDBG.for.Rust.Internal/parser/tests/example-workspace/target/debug/deps/simple_tests-eb63f31f8208c8a4 |
| 315 | Ok(format!("{target_dir}/{test_binary_prefix}{suffix}")) |
| 316 | } |
| 317 | |
| 318 | pub fn get_run_cmd(&self, package: &Package) -> Command { |
| 319 | let root_dir = &package.root_dir; |
no test coverage detected