MCPcopy Create free account
hub / github.com/clawshell/clawshell / test_next_backup_path

Function test_next_backup_path

src/migration/orchestrator.rs:224–247  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

222
223 #[test]
224 fn test_next_backup_path() {
225 let unique = format!(
226 "clawshell-migration-test-{}-{}",
227 std::process::id(),
228 std::time::SystemTime::now()
229 .duration_since(std::time::UNIX_EPOCH)
230 .unwrap()
231 .as_nanos()
232 );
233 let root = std::env::temp_dir().join(unique);
234 std::fs::create_dir_all(&root).unwrap();
235
236 let file = root.join("config.toml");
237 std::fs::write(&file, "version = \"0.0.1\"\n").unwrap();
238
239 let bak0 = next_backup_path(&file);
240 assert_eq!(bak0, PathBuf::from(format!("{}.bak", file.display())));
241
242 std::fs::write(&bak0, "backup 0").unwrap();
243 let bak1 = next_backup_path(&file);
244 assert_eq!(bak1, PathBuf::from(format!("{}.bak.1", file.display())));
245
246 std::fs::remove_dir_all(root).unwrap();
247 }
248}

Callers

nothing calls this directly

Calls 1

next_backup_pathFunction · 0.85

Tested by

no test coverage detected