MCPcopy Create free account
hub / github.com/bytecodealliance/wit-bindgen / test_bytes_roundtrip

Function test_bytes_roundtrip

tests/runtime/map/runner.rs:40–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38}
39
40fn test_bytes_roundtrip() {
41 let mut bytes_input = BytesByName::new();
42 bytes_input.insert("hello".to_string(), b"world".to_vec());
43 bytes_input.insert("bin".to_string(), vec![0u8, 1, 2]);
44 let bytes_by_name = bytes_roundtrip(&bytes_input);
45 assert_eq!(
46 bytes_by_name.get("hello").map(Vec::as_slice),
47 Some(b"world".as_slice())
48 );
49 assert_eq!(
50 bytes_by_name.get("bin").map(Vec::as_slice),
51 Some([0u8, 1, 2].as_slice())
52 );
53}
54
55fn test_empty_roundtrip() {
56 let empty = NamesById::new();

Callers 1

runMethod · 0.70

Calls 3

newFunction · 0.85
insertMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected