()
| 1011 | |
| 1012 | #[test] |
| 1013 | fn test_single_byte_content() { |
| 1014 | let store = MemoryChangeStore::new(); |
| 1015 | let content = b"X"; |
| 1016 | let change = create_test_change("Single byte", content); |
| 1017 | let hash = change.hash().unwrap(); |
| 1018 | store.insert(hash, change); |
| 1019 | |
| 1020 | let node_id = NodeId::new(1); |
| 1021 | let hash_fn = move |id: NodeId| { |
| 1022 | if id == node_id { |
| 1023 | Some(hash) |
| 1024 | } else { |
| 1025 | None |
| 1026 | } |
| 1027 | }; |
| 1028 | |
| 1029 | let node = GraphNode::new(node_id, ChangePosition::new(0), ChangePosition::new(1)); |
| 1030 | let mut buf = vec![0u8; 1]; |
| 1031 | |
| 1032 | let n = store.get_contents(hash_fn, node, &mut buf).unwrap(); |
| 1033 | assert_eq!(n, 1); |
| 1034 | assert_eq!(buf[0], b'X'); |
| 1035 | } |
| 1036 | |
| 1037 | #[test] |
| 1038 | fn test_unicode_content() { |
nothing calls this directly
no test coverage detected