use super::super::*;
use crate::tests::support::temp_dir;
use std::fs;
#[cfg(unix)]
#[test]
fn non_utf8_tree_names_reject_instead_of_collapsing_path_identity() {
use std::{ffi::OsStr, os::unix::ffi::OsStrExt};
let root = temp_dir("ic-backup-non-utf8");
let name = OsStr::from_bytes(b"\xff");
if let Err(error) = fs::write(root.join(name), b"bytes") {
assert!(
cfg!(target_os = "macos")
&& error.raw_os_error() == Some(rustix::io::Errno::ILSEQ.raw_os_error()),
"write non UTF-8 name: {error:?}"
);
eprintln!("filesystem rejected the raw name; canonical UTF-8 admission checked directly");
fs::remove_dir(&root).expect("remove empty successful fixture");
return;
}
assert!(matches!(
checksum_directory(&root),
Err(ArtifactError::NonUtf8Path { .. })
));
fs::remove_dir_all(root).expect("remove successful fixture");
}