()
| 1494 | #[test] |
| 1495 | #[serial] |
| 1496 | fn test_diff_word_diff_enabled() { |
| 1497 | let _guard = DirGuard::new(); |
| 1498 | |
| 1499 | let temp_dir = tempfile::tempdir().unwrap(); |
| 1500 | let repo_path = temp_dir.path(); |
| 1501 | |
| 1502 | // Initialize repository and create initial file |
| 1503 | { |
| 1504 | let repo = Repository::init(repo_path).unwrap(); |
| 1505 | std::fs::write(repo_path.join("code.rs"), "let x = 42;\n").unwrap(); |
| 1506 | repo.add("code.rs", Default::default()).unwrap(); |
| 1507 | |
| 1508 | // Record the initial state |
| 1509 | let header = atomic_core::change::ChangeHeader::builder() |
| 1510 | .message("Initial commit") |
| 1511 | .build(); |
| 1512 | repo.record(header, Default::default()).unwrap(); |
| 1513 | } |
| 1514 | |
| 1515 | // Modify the file (change value) |
| 1516 | std::fs::write(repo_path.join("code.rs"), "let x = 100;\n").unwrap(); |
| 1517 | |
| 1518 | std::env::set_current_dir(repo_path).unwrap(); |
| 1519 | |
| 1520 | // Create diff with word-diff enabled |
| 1521 | let diff = Diff::new().with_word_diff(true).with_no_color(false); // Ensure color is on for word-diff |
| 1522 | |
| 1523 | assert!(diff.word_diff); |
| 1524 | |
| 1525 | let config = diff.get_output_config(); |
| 1526 | assert!(config.word_diff); |
| 1527 | |
| 1528 | // Run should succeed |
| 1529 | let result = diff.run(); |
| 1530 | assert!(result.is_ok()); |
| 1531 | } |
| 1532 | |
| 1533 | #[test] |
| 1534 | #[serial] |
nothing calls this directly
no test coverage detected