From 3d987ab01c16927d1fccf17285df822af2bb5497 Mon Sep 17 00:00:00 2001 From: NathanFlurry Date: Mon, 1 Apr 2024 07:17:40 +0000 Subject: [PATCH] fix(bolt): update rust test package_id parsing (#622) Pulled from downstream --- lib/bolt/core/src/dep/cargo/cli.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/bolt/core/src/dep/cargo/cli.rs b/lib/bolt/core/src/dep/cargo/cli.rs index 39952513e2..9aac1f3d7c 100644 --- a/lib/bolt/core/src/dep/cargo/cli.rs +++ b/lib/bolt/core/src/dep/cargo/cli.rs @@ -320,11 +320,15 @@ pub async fn build_tests<'a, T: AsRef>( let v = serde_json::from_str::(line).context("invalid json")?; if v["reason"] == "compiler-artifact" && v["target"]["kind"] == json!(["test"]) { if let Some(executable) = v["filenames"][0].as_str() { - // Parse package name + // Parsing the cargo package name (foo-bar) from + // path+file:///foo/bar#foo-bar@0.0.1 let package = v["package_id"] .as_str() .context("missing package_id")? - .split_once(" ") + .split_once("#") + .context("split_once failed")? + .1 + .split_once("@") .context("split_once failed")? .0;