Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion cargo-auditable/tests/it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,29 @@ where
binaries
})
.for_each(|(package, binary)| {
bins.entry(package).or_insert(Vec::new()).push(binary);
bins.entry(pkgid_to_bin_name(&package))
.or_insert(Vec::new())
.push(binary);
});
bins
}

fn pkgid_to_bin_name(pkgid: &str) -> String {
// the input is string in the format such as
// "path+file:///home/shnatsel/Code/cargo-auditable/cargo-auditable/tests/fixtures/lib_and_bin_crate#0.1.0"
// (for full docs see `cargo pkgid`)
// and we need just the crate name, e.g. "lib_and_bin_crate".
// Weirdly it doesn't use OS path separator, it always uses '/'
pkgid
.rsplit_once('/')
.unwrap()
.1
.split_once('#')
.unwrap()
.0
.to_owned()
}

fn ensure_build_succeeded(output: &Output) {
if !output.status.success() {
let stderr = std::io::stderr();
Expand Down