(t *testing.T)
| 23 | ) |
| 24 | |
| 25 | func 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 | |
| 44 | func assertCodeRoundTrips(tb testing.TB, code Code) { |
| 45 | tb.Helper() |
nothing calls this directly
no test coverage detected