MCPcopy Create free account
hub / github.com/SeaQL/FireDBG.for.Rust / get_unit_test_path

Method get_unit_test_path

parser/src/def/workspace.rs:231–246  ·  view source on GitHub ↗

Get path of unit test executable. # Panics Panic if it fail to parse unit test executable

(&self, workspace: &Workspace)

Source from the content-addressed store, hash-verified

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
249impl Binary {

Callers 1

run_unit_testFunction · 0.80

Calls 2

get_unit_test_cmdMethod · 0.80
outputMethod · 0.45

Tested by

no test coverage detected