(t *testing.T)
| 33 | } |
| 34 | |
| 35 | func TestUserConfigSimple(t *testing.T) { |
| 36 | // This test checks that a single user configuration is correctly decoded. |
| 37 | const toml = ` |
| 38 | [[user]] |
| 39 | name="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 | |
| 63 | func TestUserConfigMultiple(t *testing.T) { |
| 64 | // This test checks that we can provide multiple user configurations. |
nothing calls this directly
no test coverage detected