refactor: reorganize source and tests
This commit is contained in:
1 parent
15d76c18a0
commit
c6205a337c
139 files changed
+5532
-5548
No files matched your search
+2
-47
@@ -175,50 +175,5 @@ fn replace_file(source: &Path, destination: &Path) -> io::Result<()> {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn instance_paths_use_visible_directories() {
|
||||
let paths = InstancePaths::new("/instances/example");
|
||||
assert_eq!(
|
||||
paths.minecraft(),
|
||||
PathBuf::from("/instances/example/minecraft")
|
||||
);
|
||||
assert_eq!(
|
||||
paths.content_manifest(),
|
||||
PathBuf::from("/instances/example/rmcl/content/manifest.json")
|
||||
);
|
||||
assert_eq!(
|
||||
paths.local_config(),
|
||||
PathBuf::from("/instances/example/rmcl/content/config")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn metadata_paths_separate_state_and_cache() {
|
||||
let paths = MetadataPaths::new("/meta");
|
||||
assert_eq!(paths.profiles(), PathBuf::from("/meta/state/profiles"));
|
||||
assert_eq!(
|
||||
paths.provider_icons("modrinth"),
|
||||
PathBuf::from("/meta/cache/providers/modrinth/icons")
|
||||
);
|
||||
assert_eq!(
|
||||
paths.versions(),
|
||||
PathBuf::from("/meta/cache/minecraft/versions")
|
||||
);
|
||||
assert_eq!(
|
||||
paths.migration_journal(),
|
||||
PathBuf::from("/meta/state/migration.json")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn atomic_write_replaces_existing_file() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let path = temp.path().join("state.json");
|
||||
std::fs::write(&path, b"old").unwrap();
|
||||
write_atomic(&path, b"new").unwrap();
|
||||
assert_eq!(std::fs::read(path).unwrap(), b"new");
|
||||
}
|
||||
}
|
||||
#[path = "tests/storage.rs"]
|
||||
mod tests;
|
||||
Reference in new issue
Block a user