MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_diff_with_specific_file

Function test_diff_with_specific_file

atomic-cli/src/commands/diff/tests.rs:1423–1445  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1421 #[test]
1422 #[serial]
1423 fn test_diff_with_specific_file() {
1424 let _guard = DirGuard::new();
1425
1426 let temp_dir = tempfile::tempdir().unwrap();
1427 let repo_path = temp_dir.path();
1428
1429 // Initialize and add files
1430 {
1431 let repo = Repository::init(repo_path).unwrap();
1432 std::fs::write(repo_path.join("file1.txt"), "Content 1").unwrap();
1433 std::fs::write(repo_path.join("file2.txt"), "Content 2").unwrap();
1434 repo.add("file1.txt", Default::default()).unwrap();
1435 repo.add("file2.txt", Default::default()).unwrap();
1436 }
1437
1438 std::env::set_current_dir(repo_path).unwrap();
1439
1440 // Diff only file1.txt
1441 let diff = Diff::new().with_files(vec!["file1.txt"]);
1442 let result = diff.run();
1443
1444 assert!(result.is_ok());
1445 }
1446
1447 #[test]
1448 #[serial]

Callers

nothing calls this directly

Calls 6

writeFunction · 0.85
unwrapMethod · 0.45
pathMethod · 0.45
addMethod · 0.45
with_filesMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected