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

Function test_output_skips_empty_scc

atomic-core/src/output/repo/content.rs:1088–1123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1086
1087 #[test]
1088 fn test_output_skips_empty_scc() {
1089 let content = b"Content\n";
1090 let node = make_vertex(1, 0, content.len() as u64);
1091 let graph = make_simple_graph(node);
1092
1093 // Order with an empty SCC (shouldn't happen, but handle gracefully)
1094 let order = OrderResult {
1095 sccs: vec![vec![], vec![VertexId(1)]],
1096 conflict_tree: Default::default(),
1097 cyclic_conflicts: 0,
1098 forward_edges: Vec::new(),
1099 };
1100
1101 let changes = MemoryChangeStore::new();
1102 let change = make_change(content);
1103 let hash = change.hash().unwrap();
1104 changes.insert(hash, change);
1105
1106 let hash_fn = |id: NodeId| {
1107 if id.get() == 1 {
1108 Some(hash)
1109 } else {
1110 None
1111 }
1112 };
1113
1114 let mut buffer = Vec::new();
1115 {
1116 let pos = Position::ROOT;
1117 let mut writer = ConflictWriter::new(&mut buffer, "test.rs", pos);
1118
1119 let result = output_graph_content(&changes, hash_fn, &graph, &order, &mut writer);
1120 assert!(result.is_ok());
1121 }
1122 assert_eq!(&buffer, content);
1123 }
1124
1125 // ------------------------------------------------------------------------
1126 // Missing Span Tests

Callers

nothing calls this directly

Calls 9

make_simple_graphFunction · 0.85
output_graph_contentFunction · 0.85
make_vertexFunction · 0.70
make_changeFunction · 0.70
getMethod · 0.65
lenMethod · 0.45
unwrapMethod · 0.45
hashMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected