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

Function test_output_single_vertex

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

Source from the content-addressed store, hash-verified

809
810 #[test]
811 fn test_output_single_vertex() {
812 let content = b"Hello, world!";
813 let node = make_vertex(1, 0, content.len() as u64);
814 let graph = make_simple_graph(node);
815 let order = make_simple_order();
816
817 let changes = MemoryChangeStore::new();
818 let change = make_change(content);
819 let hash = change.hash().unwrap();
820 changes.insert(hash, change);
821
822 let hash_fn = |id: NodeId| {
823 if id.get() == 1 {
824 Some(hash)
825 } else {
826 None
827 }
828 };
829
830 let mut buffer = Vec::new();
831 {
832 let pos = Position::ROOT;
833 let mut writer = ConflictWriter::new(&mut buffer, "test.rs", pos);
834
835 let result = output_graph_content(&changes, hash_fn, &graph, &order, &mut writer);
836 assert!(result.is_ok());
837 }
838 assert_eq!(&buffer, content);
839 }
840
841 #[test]
842 fn test_output_empty_vertex_skipped() {

Callers

nothing calls this directly

Calls 10

make_simple_graphFunction · 0.85
make_simple_orderFunction · 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