(t *testing.T)
| 32 | } |
| 33 | |
| 34 | func TestReadSingleConfig(t *testing.T) { |
| 35 | t.Parallel() |
| 36 | a := assertions.New(t) |
| 37 | |
| 38 | _, filename, _, _ := runtime.Caller(0) |
| 39 | |
| 40 | first := path.Join(filepath.Dir(filename), "first.yml") |
| 41 | second := path.Join(filepath.Dir(filename), "second.yml") |
| 42 | _ = second |
| 43 | |
| 44 | defaults := &singleFileConfig{} |
| 45 | |
| 46 | mgr := InitializeWithDefaults("empty", "empty", defaults) |
| 47 | a.So(mgr, should.NotBeNil) |
| 48 | |
| 49 | err := mgr.Parse("--config", first) |
| 50 | a.So(err, should.BeNil) |
| 51 | |
| 52 | err = mgr.ReadInConfig() |
| 53 | a.So(err, should.BeNil) |
| 54 | |
| 55 | res := new(singleFileConfig) |
| 56 | err = mgr.Unmarshal(res) |
| 57 | a.So(err, should.BeNil) |
| 58 | |
| 59 | a.So(res.Foo, should.Resemble, "10") |
| 60 | a.So(res.Bar, should.Resemble, map[string]string{ |
| 61 | "a": "baz", |
| 62 | "b": "quu", |
| 63 | }) |
| 64 | } |
| 65 | |
| 66 | type multiFileConfig struct { |
| 67 | ConfigPaths []string `name:"config"` |
nothing calls this directly
no test coverage detected