(t *testing.T)
| 140 | } |
| 141 | |
| 142 | func TestAppendStringer(t *testing.T) { |
| 143 | oldJSONMarshalFunc := JSONMarshalFunc |
| 144 | defer func() { |
| 145 | JSONMarshalFunc = oldJSONMarshalFunc |
| 146 | }() |
| 147 | |
| 148 | JSONMarshalFunc = func(v interface{}) ([]byte, error) { |
| 149 | return internal.InterfaceMarshalFunc(v) |
| 150 | } |
| 151 | |
| 152 | for _, tt := range internal.EncodeStringerTests { |
| 153 | got := enc.AppendStringer([]byte{}, tt.In) |
| 154 | want := []byte(tt.Binary) |
| 155 | if !bytes.Equal(got, want) { |
| 156 | t.Errorf("AppendStrings(%v)\ngot: %s\nwant: %s", |
| 157 | tt.In, |
| 158 | hex.EncodeToString(got), |
| 159 | hex.EncodeToString(want)) |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | func TestAppendStringers(t *testing.T) { |
| 165 | for _, tt := range internal.EncodeStringersTests { |
nothing calls this directly
no test coverage detected