MCPcopy
hub / github.com/connectrpc/connect-go / TestCode

Function TestCode

code_test.go:25–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23)
24
25func TestCode(t *testing.T) {
26 t.Parallel()
27 var valid []Code
28 for code := minCode; code <= maxCode; code++ {
29 valid = append(valid, code)
30 }
31 // Ensures that we don't forget to update the mapping in the Stringer
32 // implementation.
33 for _, code := range valid {
34 assert.False(
35 t,
36 strings.HasPrefix(code.String(), "code_"),
37 assert.Sprintf("update Code.String() method for new code %v", code),
38 )
39 assertCodeRoundTrips(t, code)
40 }
41 assertCodeRoundTrips(t, Code(999))
42}
43
44func assertCodeRoundTrips(tb testing.TB, code Code) {
45 tb.Helper()

Callers

nothing calls this directly

Calls 5

FalseFunction · 0.92
SprintfFunction · 0.92
assertCodeRoundTripsFunction · 0.85
CodeTypeAlias · 0.85
StringMethod · 0.45

Tested by

no test coverage detected