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

Function test_file_diff_compute_stats

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

Source from the content-addressed store, hash-verified

468
469 #[test]
470 fn test_file_diff_compute_stats() {
471 let mut diff = FileDiff::modified("test.rs");
472 let mut graph_op = DiffHunk::new(1, 2, 1, 3);
473 graph_op.add_line(HunkLine::context("line1", 1, 1));
474 graph_op.add_line(HunkLine::removed("old line", 2));
475 graph_op.add_line(HunkLine::added("new line 1", 2));
476 graph_op.add_line(HunkLine::added("new line 2", 3));
477 diff.add_hunk(graph_op);
478
479 diff.compute_stats();
480
481 assert_eq!(diff.stats.insertions, 2);
482 assert_eq!(diff.stats.deletions, 1);
483 }
484
485 #[test]
486 fn test_file_diff_has_changes() {

Callers

nothing calls this directly

Calls 5

modifiedFunction · 0.85
addedFunction · 0.85
compute_statsMethod · 0.80
add_lineMethod · 0.45
add_hunkMethod · 0.45

Tested by

no test coverage detected