()
| 1060 | |
| 1061 | #[test] |
| 1062 | fn test_unicode_content() { |
| 1063 | let store = MemoryChangeStore::new(); |
| 1064 | let content = "Hello, 世界! 🌍".as_bytes(); |
| 1065 | let change = create_test_change("Unicode", content); |
| 1066 | let hash = change.hash().unwrap(); |
| 1067 | store.insert(hash, change); |
| 1068 | |
| 1069 | let node_id = NodeId::new(1); |
| 1070 | let hash_fn = move |id: NodeId| { |
| 1071 | if id == node_id { |
| 1072 | Some(hash) |
| 1073 | } else { |
| 1074 | None |
| 1075 | } |
| 1076 | }; |
| 1077 | |
| 1078 | let node = GraphNode::new( |
| 1079 | node_id, |
| 1080 | ChangePosition::new(0), |
| 1081 | ChangePosition::new(content.len() as u64), |
| 1082 | ); |
| 1083 | let mut buf = vec![0u8; content.len()]; |
| 1084 | |
| 1085 | let n = store.get_contents(hash_fn, node, &mut buf).unwrap(); |
| 1086 | assert_eq!(n, content.len()); |
| 1087 | assert_eq!(std::str::from_utf8(&buf).unwrap(), "Hello, 世界! 🌍"); |
| 1088 | } |
| 1089 | |
| 1090 | #[test] |
| 1091 | fn test_binary_content() { |
nothing calls this directly
no test coverage detected