+
+ #[test]
+ fn test_read_shasums() {
+ let shasums = "4b91f7a387a6edd4a7c0afb2897f1ca968c9695b *cp
+ 75eb7420a9f5a260b04a3e8ad51e50f2838a17fc lel.txt
+
+ fe6c26d485a3573a1cb0ad0682f5105325a1905f shasums";
+ let lines = shasums.lines().map(|l| std::io::Result::Ok(l));
+ let path = Path::new("SHASUMS").to_owned();
+ let candidates = read_coreutils_digests_from_file(lines, &path);
+
+ assert_eq!(
+ candidates,
+ Some(CandidateHashes {
+ alg: Algorithm::Sha1,
+ hashes: vec![
+ CandidateHash {
+ bytes: hex::decode("4b91f7a387a6edd4a7c0afb2897f1ca968c9695b").unwrap(),
+ filename: Some("cp".to_owned()),
+ },
+ CandidateHash {
+ bytes: hex::decode("75eb7420a9f5a260b04a3e8ad51e50f2838a17fc").unwrap(),
+ filename: Some("lel.txt".to_owned()),
+ },
+ CandidateHash {
+ bytes: hex::decode("fe6c26d485a3573a1cb0ad0682f5105325a1905f").unwrap(),
+ filename: Some("shasums".to_owned()),
+ }
+ ],
+ source: VerificationSource::DigestsFile(path),
+ })
+ );
+ }