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

Function test_diff_custom_context_lines

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

Source from the content-addressed store, hash-verified

1815 #[test]
1816 #[file_serial]
1817 fn test_diff_custom_context_lines() {
1818 let _guard = DirGuard::new();
1819
1820 let temp_dir = tempfile::tempdir().unwrap();
1821 let repo_path = temp_dir.path();
1822
1823 // Initialize and add a file
1824 {
1825 let repo = Repository::init(repo_path).unwrap();
1826 std::fs::write(
1827 repo_path.join("test.txt"),
1828 "Line 1\nLine 2\nLine 3\nLine 4\nLine 5\n",
1829 )
1830 .unwrap();
1831 let working_copy = repo.require_working_copy_id().unwrap();
1832 repo.add(working_copy, "test.txt", Default::default())
1833 .unwrap();
1834 }
1835
1836 std::env::set_current_dir(repo_path).unwrap();
1837
1838 // Use 5 context lines
1839 let diff = Diff::new().with_context(5);
1840 let result = diff.run();
1841
1842 assert!(result.is_ok());
1843 }
1844}

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected