mirror of
https://github.com/spf13/viper
synced 2025-05-07 20:57:18 +00:00
wip
This commit is contained in:
parent
d4014cfce7
commit
701e7d9615
1 changed files with 16 additions and 0 deletions
|
@ -8,6 +8,7 @@ package viper
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil" //nolint:staticcheck
|
||||
"os"
|
||||
|
@ -1484,6 +1485,21 @@ func TestWrongDirsSearchNotFoundForMerge(t *testing.T) {
|
|||
assert.Equal(t, `default`, v.GetString(`key`))
|
||||
}
|
||||
|
||||
func TestUnwrap(t *testing.T) {
|
||||
yamlInvalid := []byte(`hash: map
|
||||
- foo
|
||||
- bar
|
||||
`)
|
||||
|
||||
SetConfigType("yaml")
|
||||
err := ReadConfig(bytes.NewBuffer(yamlInvalid))
|
||||
|
||||
var cpe ConfigParseError
|
||||
if !errors.As(err, &cpe) {
|
||||
t.Fatalf("not a ConfigParseError")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSub(t *testing.T) {
|
||||
v := New()
|
||||
v.SetConfigType("yaml")
|
||||
|
|
Loading…
Add table
Reference in a new issue