chore(repo): remove dead code and useless tests (#3375)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-10 21:43:29 +02:00
1 parent 7e177a1c90
commit 1cd62eb661
1391 files changed
+783 -120415

No files matched your search

-44
View File
@@ -51,47 +51,3 @@ pub(crate) fn sha256_file(path: &Path) -> Result<String> {
fs::File::open(path).with_context(|| format!("Failed to open {}", path.display()))?;
sha256_reader(file).with_context(|| format!("Failed to read {}", path.display()))
}
#[cfg(test)]
mod tests {
use super::*;
use serde_json::json;
#[test]
fn remove_file_if_exists_removes_files_and_ignores_missing_paths() {
let temp = tempfile::tempdir().unwrap();
let path = temp.path().join("artifact.txt");
fs::write(&path, "artifact").unwrap();
remove_file_if_exists(&path).unwrap();
remove_file_if_exists(&path).unwrap();
assert!(!path.exists());
}
#[test]
fn remove_dir_if_exists_removes_directories_and_ignores_missing_paths() {
let temp = tempfile::tempdir().unwrap();
let path = temp.path().join("dist");
fs::create_dir_all(path.join("nested")).unwrap();
fs::write(path.join("nested").join("artifact.txt"), "artifact").unwrap();
remove_dir_if_exists(&path).unwrap();
remove_dir_if_exists(&path).unwrap();
assert!(!path.exists());
}
#[test]
fn write_json_pretty_creates_parent_directories_and_writes_pretty_json() {
let temp = tempfile::tempdir().unwrap();
let path = temp.path().join("nested").join("manifest.json");
write_json_pretty(&path, &json!({ "name": "fluxer", "version": 1 })).unwrap();
assert_eq!(
fs::read_to_string(path).unwrap(),
"{\n \"name\": \"fluxer\",\n \"version\": 1\n}\n"
);
}
}