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

Function TestDecoder_ErrorUnused_NotSetable

mapstructure_test.go:1355–1378  ·  mapstructure_test.go::TestDecoder_ErrorUnused_NotSetable
(t *testing.T)

Source from the content-addressed store, hash-verified

1353}
1354
1355func TestDecoder_ErrorUnused_NotSetable(t *testing.T) {
1356 t.Parallel()
1357
1358 // lowercase vsilent is unexported and cannot be set
1359 input := map[string]interface{}{
1360 "vsilent": "false",
1361 }
1362
1363 var result Basic
1364 config := &DecoderConfig{
1365 ErrorUnused: true,
1366 Result: &result,
1367 }
1368
1369 decoder, err := NewDecoder(config)
1370 if err != nil {
1371 t.Fatalf("err: %s", err)
1372 }
1373
1374 err = decoder.Decode(input)
1375 if err == nil {
1376 t.Fatal("expected error")
1377 }
1378}
1379func TestDecoder_ErrorUnset(t *testing.T) {
1380 t.Parallel()
1381

Callers

nothing calls this directly

Calls 2

DecodeMethod · 0.95
NewDecoderFunction · 0.85

Tested by

no test coverage detected