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

Function test_stats_from_file_ops

atomic-core/src/change/ops.rs:1447–1476  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1445
1446 #[test]
1447 fn test_stats_from_file_ops() {
1448 let mut file1 =
1449 FileOps::create(test_trunk_id(), "new.txt".to_string(), Some(Encoding::Utf8));
1450 file1.add_line_op(LineOps::insert(
1451 test_branch_id(0),
1452 None,
1453 vec![
1454 LeafOp::Insert {
1455 after: None,
1456 kind: TokenKind::Word,
1457 content: b"Hello".to_vec(),
1458 },
1459 LeafOp::Insert {
1460 after: None,
1461 kind: TokenKind::Word,
1462 content: b"World".to_vec(),
1463 },
1464 ],
1465 ));
1466
1467 let file2 = FileOps::delete(TrunkId::new(NodeId::new(2), 0), "old.txt".to_string());
1468
1469 let stats = FileOpsStats::from_file_ops(&[file1, file2]);
1470
1471 assert_eq!(stats.files_created, 1);
1472 assert_eq!(stats.files_deleted, 1);
1473 assert_eq!(stats.lines_added, 1);
1474 assert_eq!(stats.tokens_added, 2);
1475 assert!(stats.has_changes());
1476 }
1477
1478 #[test]
1479 fn test_stats_display() {

Callers

nothing calls this directly

Calls 4

test_branch_idFunction · 0.85
test_trunk_idFunction · 0.70
createFunction · 0.50
add_line_opMethod · 0.45

Tested by

no test coverage detected