Merge pull request 'refactor(tests): write tests with stdlib instead of goconvey' (#1) from remove-convey into master

Reviewed-on: #1
This commit is contained in:
Bruno Carlin 2024-05-04 01:18:59 +02:00
commit 0e036c7c7d
5 changed files with 299 additions and 320 deletions

View file

@ -1,19 +1,19 @@
package conf
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
. "github.com/smartystreets/goconvey/convey"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
type testconf struct {
String string
Int int
Invariant string
inUpdate func()
String string
Invariant string
Int int
}
func (t testconf) Update() {
@ -23,401 +23,372 @@ func (t testconf) Update() {
}
func TestLoadFile(t *testing.T) {
Convey("Given a config struct", t, func() {
t.Parallel()
t.Run("with a valid file", func(t *testing.T) {
t.Parallel()
c := testconf{
String: "default string",
Int: 1,
Invariant: "should not change",
}
Convey("Given a valid config file", func() {
file := "test.conf"
content := []byte(`{"String": "config string", "Int": 42}`)
err := ioutil.WriteFile(file, content, 0o644)
So(err, ShouldBeNil)
defer func() { _ = os.Remove(file) }()
file := "test_data/valid.json"
Convey("When the config file is loaded", func() {
err := LoadFile(file, &c)
err := LoadFile(file, &c)
require.NoError(t, err)
Convey("Then there is no error", func() {
So(err, ShouldBeNil)
})
assert.Equal(t, "config string", c.String)
assert.Equal(t, 42, c.Int)
assert.Equal(t, "should not change", c.Invariant)
})
Convey("Then the struct fields are filled", func() {
So(c.String, ShouldEqual, "config string")
So(c.Int, ShouldEqual, 42)
})
t.Run("with an invalid file", func(t *testing.T) {
t.Parallel()
Convey("Then the default values are kept", func() {
So(c.Invariant, ShouldEqual, "should not change")
})
})
})
c := testconf{
String: "default string",
Int: 1,
Invariant: "should not change",
}
Convey("Given an invalid config file", func() {
file := "test.conf"
content := []byte(`String: not json`)
err := ioutil.WriteFile(file, content, 0o644)
So(err, ShouldBeNil)
defer func() { _ = os.Remove(file) }()
file := "test_data/invalid.json"
Convey("When the config file is loaded", func() {
err := LoadFile(file, &c)
err := LoadFile(file, &c)
require.Error(t, err)
Convey("Then an error is returned", func() {
So(err, ShouldBeError)
})
assert.Equal(t, "default string", c.String)
assert.Equal(t, 1, c.Int)
assert.Equal(t, "should not change", c.Invariant)
})
Convey("Then the struct fields are not filled", func() {
So(c.String, ShouldEqual, "default string")
So(c.Int, ShouldEqual, 1)
})
})
})
t.Run("with a non existent file", func(t *testing.T) {
t.Parallel()
Convey("Given a non existent config file", func() {
file := "does-not-exist.conf.conf"
c := testconf{
String: "default string",
Int: 1,
Invariant: "should not change",
}
Convey("When the config file is loaded", func() {
err := LoadFile(file, &c)
file := "does-not-exist.conf"
Convey("Then an error is returned", func() {
So(err, ShouldBeError)
})
err := LoadFile(file, &c)
require.Error(t, err)
Convey("Then the struct fields are not filled", func() {
So(c.String, ShouldEqual, "default string")
So(c.Int, ShouldEqual, 1)
})
})
})
assert.Equal(t, "default string", c.String)
assert.Equal(t, 1, c.Int)
assert.Equal(t, "should not change", c.Invariant)
})
}
func TestLoadFiles(t *testing.T) {
Convey("Given a config struct", t, func() {
c := &testconf{}
t.Parallel()
t.Run("with two valid files with different options", func(t *testing.T) {
t.Parallel()
c := testconf{}
tmpDir := t.TempDir()
Convey("Given two existing files setting different options", func() {
content1 := []byte(`{"String": "foo"}`)
content2 := []byte(`{"Int": 42}`)
paths := []string{
filepath.Join(tmpDir, "file1.json"),
filepath.Join(tmpDir, "file2.json"),
}
content1 := []byte(`{"String": "foo"}`)
content2 := []byte(`{"Int": 42}`)
paths := []string{
filepath.Join(tmpDir, "file1.json"),
filepath.Join(tmpDir, "file2.json"),
}
err := ioutil.WriteFile(paths[0], content1, 0o600)
So(err, ShouldBeNil)
err = ioutil.WriteFile(paths[1], content2, 0o600)
So(err, ShouldBeNil)
err := os.WriteFile(paths[0], content1, 0o600)
require.NoError(t, err)
err = os.WriteFile(paths[1], content2, 0o600)
require.NoError(t, err)
Convey("When LoadFiles is called", func() {
err := LoadFiles(&c, paths...)
err = LoadFiles(&c, paths...)
require.NoError(t, err)
Convey("Then there is no error", func() {
So(err, ShouldBeNil)
assert.Equal(t, "foo", c.String)
assert.Equal(t, 42, c.Int)
})
Convey("And the options from both files have been set", func() {
So(c.String, ShouldEqual, "foo")
So(c.Int, ShouldEqual, 42)
})
})
})
})
t.Run("with two valid files with the same option", func(t *testing.T) {
t.Parallel()
Convey("Given two existing files setting the same option", func() {
content1 := []byte(`{"String": "foo"}`)
content2 := []byte(`{"String": "bar"}`)
paths := []string{
filepath.Join(tmpDir, "file1.json"),
filepath.Join(tmpDir, "file2.json"),
}
c := testconf{}
tmpDir := t.TempDir()
err := ioutil.WriteFile(paths[0], content1, 0o600)
So(err, ShouldBeNil)
err = ioutil.WriteFile(paths[1], content2, 0o600)
So(err, ShouldBeNil)
content1 := []byte(`{"String": "foo"}`)
content2 := []byte(`{"String": "bar"}`)
paths := []string{
filepath.Join(tmpDir, "file1.json"),
filepath.Join(tmpDir, "file2.json"),
}
Convey("When LoadFiles is called", func() {
err := LoadFiles(&c, paths...)
err := os.WriteFile(paths[0], content1, 0o600)
require.NoError(t, err)
err = os.WriteFile(paths[1], content2, 0o600)
require.NoError(t, err)
Convey("Then there is no error", func() {
So(err, ShouldBeNil)
err = LoadFiles(&c, paths...)
require.NoError(t, err)
Convey("And the last file overwrote the first", func() {
So(c.String, ShouldEqual, "bar")
})
})
})
})
assert.Equal(t, "bar", c.String)
})
Convey("Given one non-existing and one existing files", func() {
content2 := []byte(`{"String": "bar"}`)
paths := []string{
"does-not-exist.json",
filepath.Join(tmpDir, "file2.json"),
}
t.Run("with one non-existing and one existing file", func(t *testing.T) {
t.Parallel()
err := ioutil.WriteFile(paths[1], content2, 0o600)
So(err, ShouldBeNil)
c := testconf{}
tmpDir := t.TempDir()
Convey("When LoadFiles is called", func() {
err := LoadFiles(&c, paths...)
content2 := []byte(`{"String": "bar"}`)
paths := []string{
"does-not-exist.json",
filepath.Join(tmpDir, "file2.json"),
}
Convey("Then there is no error", func() {
So(err, ShouldBeNil)
err := os.WriteFile(paths[1], content2, 0o600)
require.NoError(t, err)
Convey("And the options from the last file have been set", func() {
So(c.String, ShouldEqual, "bar")
})
})
})
})
err = LoadFiles(&c, paths...)
require.NoError(t, err)
Convey("Given one invalid and one valid files", func() {
content1 := []byte(`{"`)
content2 := []byte(`{"String": "bar"}`)
paths := []string{
filepath.Join(tmpDir, "file1.json"),
filepath.Join(tmpDir, "file2.json"),
}
assert.Equal(t, "bar", c.String)
})
err := ioutil.WriteFile(paths[0], content1, 0o600)
So(err, ShouldBeNil)
err = ioutil.WriteFile(paths[1], content2, 0o600)
So(err, ShouldBeNil)
t.Run("with one valid and one invalid file", func(t *testing.T) {
t.Parallel()
Convey("When LoadFiles is called", func() {
err := LoadFiles(&c, paths...)
c := testconf{}
tmpDir := t.TempDir()
Convey("Then an error is returned", func() {
So(err, ShouldBeError)
content1 := []byte(`{"`)
content2 := []byte(`{"String": "bar"}`)
paths := []string{
filepath.Join(tmpDir, "file1.json"),
filepath.Join(tmpDir, "file2.json"),
}
Convey("And the last file has not been read", func() {
So(c.String, ShouldNotEqual, "bar")
})
})
})
})
err := os.WriteFile(paths[0], content1, 0o600)
require.NoError(t, err)
err = os.WriteFile(paths[1], content2, 0o600)
require.NoError(t, err)
err = LoadFiles(&c, paths...)
require.Error(t, err)
assert.Equal(t, "", c.String)
})
}
func TestSaveFile(t *testing.T) {
Convey("Given a config struct", t, func() {
t.Parallel()
t.Run("with a valid path", func(t *testing.T) {
t.Parallel()
c := testconf{
String: "default string",
Int: 1,
Invariant: "should not change",
Int: 1,
}
tmpDir := t.TempDir()
file := filepath.Join(tmpDir, "test.conf")
Convey("Given a valid path", func() {
file := "test.conf"
err := SaveFile(file, &c)
require.NoError(t, err)
Convey("When the config file is saved", func() {
err := SaveFile(file, &c)
defer func() { _ = os.Remove(file) }()
assert.FileExists(t, file)
Convey("Then there is no error", func() {
So(err, ShouldBeNil)
})
expected := "{\n \"String\": \"default string\",\n \"Invariant\": \"should not change\",\n \"Int\": 1\n}"
got, err := os.ReadFile(file)
require.NoError(t, err)
assert.Equal(t, expected, string(got))
})
Convey("Then the file exists", func() {
_, err := os.Stat(file)
So(err, ShouldBeNil)
t.Run("with a valid path and invalid data", func(t *testing.T) {
t.Parallel()
Convey("Then the content is correct", func() {
expected := "{\n \"String\": \"default string\",\n \"Int\": 1,\n \"Invariant\": \"should not change\"\n}"
got, err := ioutil.ReadFile(file)
So(err, ShouldBeNil)
So(string(got), ShouldEqual, expected)
})
})
})
tmpDir := t.TempDir()
file := filepath.Join(tmpDir, "test.conf")
Convey("When the config file is saved with invalid data", func() {
err := SaveFile(file, func() error { return nil })
defer func() { _ = os.Remove(file) }()
err := SaveFile(file, func() error { return nil })
require.Error(t, err)
Convey("Then an error is returned", func() {
So(err, ShouldBeError)
})
assert.NoFileExists(t, file)
})
Convey("Then the file does not exist", func() {
_, err := os.Stat(file)
So(os.IsNotExist(err), ShouldBeTrue)
})
})
})
t.Run("with an invalid path", func(t *testing.T) {
t.Parallel()
Convey("Given an invalid path", func() {
file := "cannot/write/here.conf"
c := testconf{
String: "default string",
Invariant: "should not change",
Int: 1,
}
file := "cannot/write/here.conf"
Convey("When the config file is loaded", func() {
err := SaveFile(file, &c)
err := SaveFile(file, &c)
require.Error(t, err)
Convey("Then an error is returned", func() {
So(err, ShouldBeError)
})
Convey("Then the file does not exist", func() {
_, err := os.Stat(file)
So(os.IsNotExist(err), ShouldBeTrue)
})
})
})
assert.NoFileExists(t, file)
})
}
func TestLoadAndUpdateFile(t *testing.T) {
Convey("Given a config struct and a path", t, func() {
updated := false
t.Parallel()
t.Run("when the target file does not exist", func(t *testing.T) {
t.Parallel()
updated := false
c := testconf{
String: "default string",
Int: 1,
Invariant: "should not change",
inUpdate: func() { updated = true },
}
c.inUpdate = func() { updated = true }
file := "test.conf"
tmpDir := t.TempDir()
file := filepath.Join(tmpDir, "test.conf")
Convey("Given no file exists at this path", func() {
_, err := os.Stat(file)
So(err, ShouldBeError)
So(os.IsNotExist(err), ShouldBeTrue)
err := LoadAndUpdateFile(file, &c)
require.NoError(t, err)
Convey("When LoadAndUpdateFile is called", func() {
err := LoadAndUpdateFile(file, &c)
So(err, ShouldBeNil)
defer func() { _ = os.Remove(file) }()
var c2 testconf
err = read(file, &c2)
require.NoError(t, err)
assert.Equal(t, c.String, c2.String)
assert.Equal(t, c.Int, c2.Int)
assert.Equal(t, c.Invariant, c2.Invariant)
Convey("Then the config file has been created", func() {
_, err := os.Stat(file)
So(err, ShouldBeNil)
assert.False(t, updated)
})
Convey("and it has the default configuration", func() {
var c2 testconf
err := read(file, &c2)
So(err, ShouldBeNil)
c.inUpdate = nil
So(c2, ShouldResemble, c)
})
})
})
})
t.Run("when the path cannot be written", func(t *testing.T) {
t.Parallel()
Convey("Given the path cannot be written", func() {
file = "does-not-exist/test.conf"
_, err := os.Stat(file)
So(err, ShouldBeError)
So(os.IsNotExist(err), ShouldBeTrue)
updated := false
c := testconf{
String: "default string",
Int: 1,
Invariant: "should not change",
inUpdate: func() { updated = true },
}
tmpDir := t.TempDir()
file := filepath.Join(tmpDir, "does-not-exist", "test.conf")
Convey("When LoadAndUpdateFile is called", func() {
err := LoadAndUpdateFile(file, &c)
defer func() { _ = os.Remove(file) }()
err := LoadAndUpdateFile(file, &c)
require.Error(t, err)
Convey("Then an error is returned", func() {
So(err, ShouldBeError)
})
})
})
assert.NoFileExists(t, file)
Convey("Given a config file with custom values", func() {
content := []byte(`{"String": "config string", "Int": 42}`)
err := ioutil.WriteFile(file, content, 0o644)
So(err, ShouldBeNil)
defer func() { _ = os.Remove(file) }()
assert.False(t, updated)
})
Convey("When LoadAndUpdateFile is called", func() {
err := LoadAndUpdateFile(file, &c)
t.Run("when the config file is invalid", func(t *testing.T) {
t.Parallel()
Convey("Then there is no error", func() {
So(err, ShouldBeNil)
})
updated := false
c := testconf{
String: "default string",
Int: 1,
Invariant: "should not change",
inUpdate: func() { updated = true },
}
tmpDir := t.TempDir()
file := filepath.Join(tmpDir, "test.conf")
Convey("Then the struct fields are filled", func() {
So(c.String, ShouldEqual, "config string")
So(c.Int, ShouldEqual, 42)
})
})
})
content := []byte(`String: not json`)
err := os.WriteFile(file, content, 0o644)
require.NoError(t, err)
Convey("Given an invalid configuration file", func() {
content := []byte(`String: not json`)
err := ioutil.WriteFile(file, content, 0o644)
So(err, ShouldBeNil)
defer func() { _ = os.Remove(file) }()
err = LoadAndUpdateFile(file, &c)
require.Error(t, err)
Convey("When LoadAndUpdateFile is called", func() {
err := LoadAndUpdateFile(file, &c)
defer func() { _ = os.Remove(file) }()
assert.False(t, updated)
})
Convey("Then an error is returned", func() {
So(err, ShouldBeError)
})
})
})
t.Run("when the config file is valid", func(t *testing.T) {
t.Parallel()
Convey("Given a config file with missing options", func() {
content := []byte(`{"String": "config string"}`)
err := ioutil.WriteFile(file, content, 0o644)
So(err, ShouldBeNil)
defer func() { _ = os.Remove(file) }()
updated := false
c := testconf{
String: "default string",
Int: 1,
Invariant: "should not change",
inUpdate: func() { updated = true },
}
tmpDir := t.TempDir()
file := filepath.Join(tmpDir, "test.conf")
Convey("When LoadAndUpdateFile is called", func() {
err := LoadAndUpdateFile(file, &c)
content := []byte(`{"String": "config string", "Int": 42}`)
err := os.WriteFile(file, content, 0o644)
require.NoError(t, err)
Convey("Then there is no error", func() {
So(err, ShouldBeNil)
})
err = LoadAndUpdateFile(file, &c)
require.NoError(t, err)
Convey("Then the config file has been updated with new options", func() {
content, err := ioutil.ReadFile(file)
So(err, ShouldBeNil)
So(string(content), ShouldContainSubstring, `"Int"`)
})
})
})
var c2 testconf
err = read(file, &c2)
require.NoError(t, err)
assert.Equal(t, "config string", c2.String)
assert.Equal(t, 42, c2.Int)
Convey("Given a config file with old options", func() {
content := []byte(`{"String": "config string", "Foo": "blah"}`)
err := ioutil.WriteFile(file, content, 0o644)
So(err, ShouldBeNil)
defer func() { _ = os.Remove(file) }()
assert.True(t, updated)
})
Convey("When LoadAndUpdateFile is called", func() {
err := LoadAndUpdateFile(file, &c)
t.Run("when the config file is missing options", func(t *testing.T) {
t.Parallel()
Convey("Then there is no error", func() {
So(err, ShouldBeNil)
})
updated := false
c := testconf{
String: "default string",
Int: 1,
Invariant: "should not change",
inUpdate: func() { updated = true },
}
tmpDir := t.TempDir()
file := filepath.Join(tmpDir, "test.conf")
Convey("Then the config file has been updated with new options", func() {
content, err := ioutil.ReadFile(file)
So(err, ShouldBeNil)
So(string(content), ShouldNotContainSubstring, `"Foo"`)
})
})
})
content := []byte(`{"String": "config string"}`)
err := os.WriteFile(file, content, 0o644)
require.NoError(t, err)
Convey("Given a valid config file", func() {
content := []byte(`{"String": "config string"}`)
err := ioutil.WriteFile(file, content, 0o644)
So(err, ShouldBeNil)
defer func() { _ = os.Remove(file) }()
err = LoadAndUpdateFile(file, &c)
require.NoError(t, err)
Convey("When LoadAndUpdateFile is called", func() {
err := LoadAndUpdateFile(file, &c)
newContent, err := os.ReadFile(file)
require.NoError(t, err)
assert.Contains(t, string(newContent), "Int")
assert.Contains(t, string(newContent), "Invariant")
Convey("Then there is no error", func() {
So(err, ShouldBeNil)
})
assert.True(t, updated)
})
Convey("Then the update method of the struct has been called", func() {
So(updated, ShouldBeTrue)
})
})
})
t.Run("when the config contains unknown options", func(t *testing.T) {
t.Parallel()
updated := false
c := testconf{
String: "default string",
Int: 1,
Invariant: "should not change",
inUpdate: func() { updated = true },
}
tmpDir := t.TempDir()
file := filepath.Join(tmpDir, "test.conf")
content := []byte(`{"String": "config string", "Foo": "blah"}`)
err := os.WriteFile(file, content, 0o644)
require.NoError(t, err)
err = LoadAndUpdateFile(file, &c)
require.NoError(t, err)
newContent, err := os.ReadFile(file)
require.NoError(t, err)
assert.NotContains(t, string(newContent), "Foo")
assert.True(t, updated)
})
}

8
go.mod
View file

@ -2,10 +2,10 @@ module code.bcarlin.xyz/go/conf
go 1.17
require github.com/smartystreets/goconvey v1.7.2
require github.com/stretchr/testify v1.9.0
require (
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/smartystreets/assertions v1.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

32
go.sum
View file

@ -1,13 +1,19 @@
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs=
github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

1
test_data/invalid.json Normal file
View file

@ -0,0 +1 @@
String: not json

1
test_data/valid.json Normal file
View file

@ -0,0 +1 @@
{"String": "config string", "Int": 42}