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:1695–1720  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1693 #[test]
1694 #[file_serial]
1695 fn test_diff_with_specific_file() {
1696 let _guard = DirGuard::new();
1697
1698 let temp_dir = tempfile::tempdir().unwrap();
1699 let repo_path = temp_dir.path();
1700
1701 // Initialize and add files
1702 {
1703 let repo = Repository::init(repo_path).unwrap();
1704 std::fs::write(repo_path.join("file1.txt"), "Content 1").unwrap();
1705 std::fs::write(repo_path.join("file2.txt"), "Content 2").unwrap();
1706 let working_copy = repo.require_working_copy_id().unwrap();
1707 repo.add(working_copy, "file1.txt", Default::default())
1708 .unwrap();
1709 repo.add(working_copy, "file2.txt", Default::default())
1710 .unwrap();
1711 }
1712
1713 std::env::set_current_dir(repo_path).unwrap();
1714
1715 // Diff only file1.txt
1716 let diff = Diff::new().with_files(vec!["file1.txt"]);
1717 let result = diff.run();
1718
1719 assert!(result.is_ok());
1720 }
1721
1722 #[test]
1723 #[file_serial]

Callers

nothing calls this directly

Calls 8

initFunction · 0.50
writeFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
addMethod · 0.45
with_filesMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected