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:1055–1090  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1053
1054 #[test]
1055 fn test_output_skips_empty_scc() {
1056 let content = b"Content\n";
1057 let node = make_vertex(1, 0, content.len() as u64);
1058 let graph = make_simple_graph(node);
1059
1060 // Order with an empty SCC (shouldn't happen, but handle gracefully)
1061 let order = OrderResult {
1062 sccs: vec![vec![], vec![VertexId(1)]],
1063 conflict_tree: Default::default(),
1064 cyclic_conflicts: 0,
1065 forward_edges: Vec::new(),
1066 };
1067
1068 let changes = MemoryChangeStore::new();
1069 let change = make_change(content);
1070 let hash = change.hash().unwrap();
1071 changes.insert(hash, change);
1072
1073 let hash_fn = |id: NodeId| {
1074 if id.get() == 1 {
1075 Some(hash)
1076 } else {
1077 None
1078 }
1079 };
1080
1081 let mut buffer = Vec::new();
1082 {
1083 let pos = Position::ROOT;
1084 let mut writer = ConflictWriter::new(&mut buffer, "test.rs", pos);
1085
1086 let result = output_graph_content(&changes, hash_fn, &graph, &order, &mut writer);
1087 assert!(result.is_ok());
1088 }
1089 assert_eq!(&buffer, content);
1090 }
1091
1092 // ------------------------------------------------------------------------
1093 // 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