()
| 1036 | |
| 1037 | #[test] |
| 1038 | fn test_unicode_content() { |
| 1039 | let store = MemoryChangeStore::new(); |
| 1040 | let content = "Hello, 世界! 🌍".as_bytes(); |
| 1041 | let change = create_test_change("Unicode", content); |
| 1042 | let hash = change.hash().unwrap(); |
| 1043 | store.insert(hash, change); |
| 1044 | |
| 1045 | let node_id = NodeId::new(1); |
| 1046 | let hash_fn = move |id: NodeId| { |
| 1047 | if id == node_id { |
| 1048 | Some(hash) |
| 1049 | } else { |
| 1050 | None |
| 1051 | } |
| 1052 | }; |
| 1053 | |
| 1054 | let node = GraphNode::new( |
| 1055 | node_id, |
| 1056 | ChangePosition::new(0), |
| 1057 | ChangePosition::new(content.len() as u64), |
| 1058 | ); |
| 1059 | let mut buf = vec![0u8; content.len()]; |
| 1060 | |
| 1061 | let n = store.get_contents(hash_fn, node, &mut buf).unwrap(); |
| 1062 | assert_eq!(n, content.len()); |
| 1063 | assert_eq!(std::str::from_utf8(&buf).unwrap(), "Hello, 世界! 🌍"); |
| 1064 | } |
| 1065 | |
| 1066 | #[test] |
| 1067 | fn test_binary_content() { |
nothing calls this directly
no test coverage detected