MCPcopy Create free account
hub / github.com/segmentio/encoding / TestErrorMessageFromMisusedString

Function TestErrorMessageFromMisusedString

json/golang_decode_test.go:1259–1266  ·  view source on GitHub ↗

If people misuse the ,string modifier, the error message should be helpful, telling the user that they're doing it wrong.

(t *testing.T)

Source from the content-addressed store, hash-verified

1257// If people misuse the ,string modifier, the error message should be
1258// helpful, telling the user that they're doing it wrong.
1259func TestErrorMessageFromMisusedString(t *testing.T) {
1260 for n, tt := range wrongStringTests {
1261 r := strings.NewReader(tt.in)
1262 var s WrongString
1263 err := NewDecoder(r).Decode(&s)
1264 assertErrorPresence(t, errors.New(tt.err), err, n)
1265 }
1266}
1267
1268func noSpace(c rune) rune {
1269 if isSpace(byte(c)) { // only used for ascii

Callers

nothing calls this directly

Calls 4

assertErrorPresenceFunction · 0.85
NewDecoderFunction · 0.70
NewReaderMethod · 0.65
DecodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…