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

Function test_record_roundtrip

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

Source from the content-addressed store, hash-verified

69}
70
71fn test_record_roundtrip() {
72 let mut values = NamesById::new();
73 values.insert(10, "ten".to_string());
74 values.insert(20, "twenty".to_string());
75 let entry = LabeledEntry {
76 label: "test-label".to_string(),
77 values,
78 };
79 let result = record_roundtrip(&entry);
80 assert_eq!(result.label, "test-label");
81 assert_eq!(result.values.len(), 2);
82 assert_eq!(result.values.get(&10).map(String::as_str), Some("ten"));
83 assert_eq!(result.values.get(&20).map(String::as_str), Some("twenty"));
84}
85
86fn test_inline_roundtrip() {
87 let mut input = wit_bindgen::rt::Map::new();

Callers 1

runMethod · 0.70

Calls 3

newFunction · 0.85
insertMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected