Skip to content

Commit

Permalink
fix(bolt): update rust test package_id parsing (#622)
Browse files Browse the repository at this point in the history
Pulled from downstream
  • Loading branch information
NathanFlurry committed Apr 1, 2024
1 parent 49e439e commit 3d987ab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/bolt/core/src/dep/cargo/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,15 @@ pub async fn build_tests<'a, T: AsRef<str>>(
let v = serde_json::from_str::<serde_json::Value>(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;

Expand Down

0 comments on commit 3d987ab

Please sign in to comment.