MCPcopy Create free account
hub / github.com/apache/dubbo-go / assertCodeRoundTrips

Function assertCodeRoundTrips

protocol/triple/triple_protocol/code_test.go:46–58  ·  view source on GitHub ↗
(tb testing.TB, code Code)

Source from the content-addressed store, hash-verified

44}
45
46func assertCodeRoundTrips(tb testing.TB, code Code) {
47 tb.Helper()
48 encoded, err := code.MarshalText()
49 assert.Nil(tb, err)
50 var decoded Code
51 assert.Nil(tb, decoded.UnmarshalText(encoded))
52 assert.Equal(tb, decoded, code)
53 if code >= minCode && code <= maxCode {
54 var invalid Code
55 // For the known codes, we only accept the canonical string representation: "canceled", not "code_1".
56 assert.NotNil(tb, invalid.UnmarshalText([]byte("code_"+strconv.Itoa(int(code)))))
57 }
58}

Callers 1

TestCodeFunction · 0.85

Calls 5

UnmarshalTextMethod · 0.95
NilFunction · 0.92
EqualFunction · 0.92
NotNilFunction · 0.92
MarshalTextMethod · 0.80

Tested by

no test coverage detected