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

Function TestUserConfigExtraConfigInTOML

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

Source from the content-addressed store, hash-verified

103}
104
105func TestUserConfigExtraConfigInTOML(t *testing.T) {
106 // This test checks that each user configuration in TOML must be defined
107 // of NewConfigFromToml fails.
108 const toml = `
109 # This is defined in baker.UserDesc
110 [[user]]
111 name="configA"
112
113 [user.config]
114 field1 = 23
115
116 # This is not defined in baker.UserDesc
117 [[user]]
118 name="configB"
119
120 # with a comment
121 [user.config]
122 field1 = ["a", "b", "c", "d"]`
123
124 type configA struct{ Field1 int }
125 cfga := configA{}
126 ucfga := baker.UserDesc{Name: "configa", Config: &cfga}
127
128 _, err := fillComponentsAndLoadConfig(t, toml, ucfga)
129 if err == nil {
130 t.Errorf(`want an error since configB is not defined as a baker.UserDesc, got nil`)
131 }
132}
133
134func TestUserConfigExtraConfigDefinition(t *testing.T) {
135 // This test checks that NewConfigFromToml succeeds if some user

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected