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

Function TestDecoder_ErrorUnused

mapstructure_test.go:1330–1353  ·  mapstructure_test.go::TestDecoder_ErrorUnused
(t *testing.T)

Source from the content-addressed store, hash-verified

1328}
1329
1330func TestDecoder_ErrorUnused(t *testing.T) {
1331 t.Parallel()
1332
1333 input := map[string]interface{}{
1334 "vstring": "hello",
1335 "foo": "bar",
1336 }
1337
1338 var result Basic
1339 config := &DecoderConfig{
1340 ErrorUnused: true,
1341 Result: &result,
1342 }
1343
1344 decoder, err := NewDecoder(config)
1345 if err != nil {
1346 t.Fatalf("err: %s", err)
1347 }
1348
1349 err = decoder.Decode(input)
1350 if err == nil {
1351 t.Fatal("expected error")
1352 }
1353}
1354
1355func TestDecoder_ErrorUnused_NotSetable(t *testing.T) {
1356 t.Parallel()

Callers

nothing calls this directly

Calls 2

DecodeMethod · 0.95
NewDecoderFunction · 0.85

Tested by

no test coverage detected