Skip to content

Commit bbe6e92

Browse files
committed
try hashes
1 parent 675e30a commit bbe6e92

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

rust-tests/src/lib.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
mod tests {
33
use duct::cmd;
44
use fs_err as fs;
5-
use rattler_build::hash::HashInfo;
6-
use rattler_conda_types::NoArchType;
75
use rattler_package_streaming::read::extract_tar_bz2;
86
use std::{
9-
collections::{BTreeMap, HashMap},
7+
collections::HashMap,
108
ffi::{OsStr, OsString},
119
fs::File,
1210
path::{Component, Path, PathBuf},
@@ -310,12 +308,23 @@ mod tests {
310308
assert!(rattler_build.status.success());
311309

312310
let pkg = get_package(tmp.as_dir(), "pkg_hash".to_string());
313-
let mut variant = BTreeMap::new();
314-
variant.insert("target_platform".into(), host_subdir().into());
315-
let hash = HashInfo::from_variant(&variant, &NoArchType::none());
316-
let pkg_hash = "pkg_hash-1.0.0-h_my_pkg.tar.bz2";
311+
let variant = [("target_platform", host_subdir())]
312+
.into_iter()
313+
.map(|(k, v)| (k.into(), v.into()))
314+
.collect::<std::collections::BTreeMap<_, _>>();
315+
let hash = rattler_build::hash::HashInfo::from_variant(
316+
&variant,
317+
&rattler_conda_types::NoArchType::none(),
318+
)
319+
.to_string();
320+
let pkg_hash = format!("pkg_hash-1.0.0-{}.tar.bz2", hash);
317321
let pkg = pkg.display().to_string();
318-
assert!(pkg.ends_with(&pkg_hash));
322+
assert!(
323+
pkg.ends_with(&pkg_hash),
324+
"{} does not end with {}",
325+
pkg,
326+
pkg_hash
327+
);
319328
}
320329

321330
#[test]

0 commit comments

Comments
 (0)