()
| 1732 | #[test] |
| 1733 | #[serial] |
| 1734 | fn test_diff_word_diff_enabled() { |
| 1735 | let _guard = DirGuard::new(); |
| 1736 | |
| 1737 | let temp_dir = tempfile::tempdir().unwrap(); |
| 1738 | let repo_path = temp_dir.path(); |
| 1739 | |
| 1740 | // Initialize repository and create initial file |
| 1741 | { |
| 1742 | let repo = Repository::init(repo_path).unwrap(); |
| 1743 | std::fs::write(repo_path.join("code.rs"), "let x = 42;\n").unwrap(); |
| 1744 | repo.add("code.rs", Default::default()).unwrap(); |
| 1745 | |
| 1746 | // Record the initial state |
| 1747 | let header = atomic_core::change::ChangeHeader::builder() |
| 1748 | .message("Initial commit") |
| 1749 | .build(); |
| 1750 | repo.record(header, Default::default()).unwrap(); |
| 1751 | } |
| 1752 | |
| 1753 | // Modify the file (change value) |
| 1754 | std::fs::write(repo_path.join("code.rs"), "let x = 100;\n").unwrap(); |
| 1755 | |
| 1756 | std::env::set_current_dir(repo_path).unwrap(); |
| 1757 | |
| 1758 | // Create diff with word-diff enabled |
| 1759 | let diff = Diff::new().with_word_diff(true).with_no_color(false); // Ensure color is on for word-diff |
| 1760 | |
| 1761 | assert!(diff.word_diff); |
| 1762 | |
| 1763 | let config = diff.get_output_config(); |
| 1764 | assert!(config.word_diff); |
| 1765 | |
| 1766 | // Run should succeed |
| 1767 | let result = diff.run(); |
| 1768 | assert!(result.is_ok()); |
| 1769 | } |
| 1770 | |
| 1771 | #[test] |
| 1772 | #[serial] |
nothing calls this directly
no test coverage detected