()
| 1035 | |
| 1036 | #[test] |
| 1037 | fn test_single_byte_content() { |
| 1038 | let store = MemoryChangeStore::new(); |
| 1039 | let content = b"X"; |
| 1040 | let change = create_test_change("Single byte", content); |
| 1041 | let hash = change.hash().unwrap(); |
| 1042 | store.insert(hash, change); |
| 1043 | |
| 1044 | let node_id = NodeId::new(1); |
| 1045 | let hash_fn = move |id: NodeId| { |
| 1046 | if id == node_id { |
| 1047 | Some(hash) |
| 1048 | } else { |
| 1049 | None |
| 1050 | } |
| 1051 | }; |
| 1052 | |
| 1053 | let node = GraphNode::new(node_id, ChangePosition::new(0), ChangePosition::new(1)); |
| 1054 | let mut buf = vec![0u8; 1]; |
| 1055 | |
| 1056 | let n = store.get_contents(hash_fn, node, &mut buf).unwrap(); |
| 1057 | assert_eq!(n, 1); |
| 1058 | assert_eq!(buf[0], b'X'); |
| 1059 | } |
| 1060 | |
| 1061 | #[test] |
| 1062 | fn test_unicode_content() { |
nothing calls this directly
no test coverage detected