MCPcopy Index your code
hub / github.com/dunglas/httpsfv / TestDecodeError

Function TestDecodeError

decode_test.go:5–22  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func TestDecodeError(t *testing.T) {
6 t.Parallel()
7
8 _, err := UnmarshalItem([]string{"invalid-é"})
9
10 if err.Error() != "unmarshal error: character 8" {
11 t.Error("invalid error")
12 }
13
14 _, err = UnmarshalItem([]string{`"é"`})
15 if err.Error() != "invalid string format: character 2" {
16 t.Error("invalid error")
17 }
18
19 if err.(*UnmarshalError).Unwrap().Error() != "invalid string format" {
20 t.Error("invalid wrapped error")
21 }
22}

Callers

nothing calls this directly

Calls 3

UnmarshalItemFunction · 0.85
ErrorMethod · 0.80
UnwrapMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…