MCPcopy Create free account
hub / github.com/AdRoll/baker / TestUserConfigSimple

Function TestUserConfigSimple

user_config_test.go:35–61  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33}
34
35func TestUserConfigSimple(t *testing.T) {
36 // This test checks that a single user configuration is correctly decoded.
37 const toml = `
38[[user]]
39name="MyConfiG"
40
41 [user.config]
42 field1 = 1
43 field2 = "hello!"`
44
45 type myConfig struct {
46 Field1 int
47 Field2 string
48 }
49 mycfg := myConfig{}
50 userCfg := baker.UserDesc{Name: "myconfig", Config: &mycfg}
51
52 _, err := fillComponentsAndLoadConfig(t, toml, userCfg)
53 if err != nil {
54 t.Fatal(err)
55 }
56
57 want := myConfig{Field1: 1, Field2: "hello!"}
58 if mycfg != want {
59 t.Errorf("got %#v, want %#v", mycfg, want)
60 }
61}
62
63func TestUserConfigMultiple(t *testing.T) {
64 // This test checks that we can provide multiple user configurations.

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected