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

Function test_result_roundtrip

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

Source from the content-addressed store, hash-verified

162}
163
164fn test_result_roundtrip() {
165 let mut map = NamesById::new();
166 map.insert(5, "five".to_string());
167 let ok_result = result_roundtrip(Ok(&map));
168 match &ok_result {
169 Ok(m) => assert_eq!(m.get(&5).map(String::as_str), Some("five")),
170 Err(_) => panic!("expected Ok"),
171 }
172
173 let err_result = result_roundtrip(Err("bad input"));
174 match &err_result {
175 Err(e) => assert_eq!(e, "bad input"),
176 Ok(_) => panic!("expected Err"),
177 }
178}
179
180fn test_tuple_roundtrip() {
181 let mut map = 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