(t *testing.T)
| 103 | } |
| 104 | |
| 105 | func 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 | |
| 134 | func TestUserConfigExtraConfigDefinition(t *testing.T) { |
| 135 | // This test checks that NewConfigFromToml succeeds if some user |
nothing calls this directly
no test coverage detected