Skip to content

Commit 4d92c13

Browse files
authored
Merge pull request #138 from rust-secure-code/1.77
Fix tests on Rust 1.77
2 parents 24df0e1 + 2ac59f8 commit 4d92c13

File tree

1 file changed

+19
-1
lines changed
  • cargo-auditable/tests

1 file changed

+19
-1
lines changed

cargo-auditable/tests/it.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,29 @@ where
110110
binaries
111111
})
112112
.for_each(|(package, binary)| {
113-
bins.entry(package).or_insert(Vec::new()).push(binary);
113+
bins.entry(pkgid_to_bin_name(&package))
114+
.or_insert(Vec::new())
115+
.push(binary);
114116
});
115117
bins
116118
}
117119

120+
fn pkgid_to_bin_name(pkgid: &str) -> String {
121+
// the input is string in the format such as
122+
// "path+file:///home/shnatsel/Code/cargo-auditable/cargo-auditable/tests/fixtures/lib_and_bin_crate#0.1.0"
123+
// (for full docs see `cargo pkgid`)
124+
// and we need just the crate name, e.g. "lib_and_bin_crate".
125+
// Weirdly it doesn't use OS path separator, it always uses '/'
126+
pkgid
127+
.rsplit_once('/')
128+
.unwrap()
129+
.1
130+
.split_once('#')
131+
.unwrap()
132+
.0
133+
.to_owned()
134+
}
135+
118136
fn ensure_build_succeeded(output: &Output) {
119137
if !output.status.success() {
120138
let stderr = std::io::stderr();

0 commit comments

Comments
 (0)