mirror of
https://github.com/spf13/viper
synced 2025-05-11 06:37:27 +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 (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil" //nolint:staticcheck
|
"io/ioutil" //nolint:staticcheck
|
||||||
"os"
|
"os"
|
||||||
|
@ -1484,6 +1485,21 @@ func TestWrongDirsSearchNotFoundForMerge(t *testing.T) {
|
||||||
assert.Equal(t, `default`, v.GetString(`key`))
|
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) {
|
func TestSub(t *testing.T) {
|
||||||
v := New()
|
v := New()
|
||||||
v.SetConfigType("yaml")
|
v.SetConfigType("yaml")
|
||||||
|
|
Loading…
Add table
Reference in a new issue