MCPcopy
hub / github.com/mitchellh/mapstructure / TestDecoder_ErrorUnset

Function TestDecoder_ErrorUnset

mapstructure_test.go:1379–1402  ·  mapstructure_test.go::TestDecoder_ErrorUnset
(t *testing.T)

Source from the content-addressed store, hash-verified

1377 }
1378}
1379func TestDecoder_ErrorUnset(t *testing.T) {
1380 t.Parallel()
1381
1382 input := map[string]interface{}{
1383 "vstring": "hello",
1384 "foo": "bar",
1385 }
1386
1387 var result Basic
1388 config := &DecoderConfig{
1389 ErrorUnset: true,
1390 Result: &result,
1391 }
1392
1393 decoder, err := NewDecoder(config)
1394 if err != nil {
1395 t.Fatalf("err: %s", err)
1396 }
1397
1398 err = decoder.Decode(input)
1399 if err == nil {
1400 t.Fatal("expected error")
1401 }
1402}
1403
1404func TestMap(t *testing.T) {
1405 t.Parallel()

Callers

nothing calls this directly

Calls 2

DecodeMethod · 0.95
NewDecoderFunction · 0.85

Tested by

no test coverage detected