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

Function testVariantRoundtrip

tests/runtime/map/runner.go:136–145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134}
135
136func testVariantRoundtrip() {
137 m := test.NamesById{1: "one"}
138 asMap := test.VariantRoundtrip(test.MakeMapOrStringAsMap(m))
139 assertEqual(asMap.Tag(), test.MapOrStringAsMap)
140 assertEqual(asMap.AsMap()[1], "one")
141
142 asStr := test.VariantRoundtrip(test.MakeMapOrStringAsString("hello"))
143 assertEqual(asStr.Tag(), test.MapOrStringAsString)
144 assertEqual(asStr.AsString(), "hello")
145}
146
147func testResultRoundtrip() {
148 m := test.NamesById{5: "five"}

Callers 1

RunFunction · 0.85

Calls 1

assertEqualFunction · 0.70

Tested by

no test coverage detected