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

Source from the content-addressed store, hash-verified

1659 #[test]
1660 #[serial]
1661 fn test_diff_with_specific_file() {
1662 let _guard = DirGuard::new();
1663
1664 let temp_dir = tempfile::tempdir().unwrap();
1665 let repo_path = temp_dir.path();
1666
1667 // Initialize and add files
1668 {
1669 let repo = Repository::init(repo_path).unwrap();
1670 std::fs::write(repo_path.join("file1.txt"), "Content 1").unwrap();
1671 std::fs::write(repo_path.join("file2.txt"), "Content 2").unwrap();
1672 repo.add("file1.txt", Default::default()).unwrap();
1673 repo.add("file2.txt", Default::default()).unwrap();
1674 }
1675
1676 std::env::set_current_dir(repo_path).unwrap();
1677
1678 // Diff only file1.txt
1679 let diff = Diff::new().with_files(vec!["file1.txt"]);
1680 let result = diff.run();
1681
1682 assert!(result.is_ok());
1683 }
1684
1685 #[test]
1686 #[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