Added unit test for continue in root route error (#768)

* Added unit test for continue in root route error

* replaced %v with %q
This commit is contained in:
Conor Broderick 2017-05-09 09:11:40 +01:00 committed by Fabian Reinartz
parent c9163bd689
commit a77bfb44d6
2 changed files with 24 additions and 0 deletions

View File

@ -52,6 +52,7 @@ func Load(s string) (*Config, error) {
return nil, errors.New("no route provided in config") return nil, errors.New("no route provided in config")
} }
// Check if continue in root route.
if cfg.Route.Continue { if cfg.Route.Continue {
return nil, errors.New("cannot have continue in root route") return nil, errors.New("cannot have continue in root route")
} }

View File

@ -37,3 +37,26 @@ route:
t.Errorf("\nexpected:\n%v\ngot:\n%v", expected, err.Error()) t.Errorf("\nexpected:\n%v\ngot:\n%v", expected, err.Error())
} }
} }
func TestContinueErrorInRouteRoot(t *testing.T) {
in := `
route:
receiver: team-X-mails
continue: true
receivers:
- name: 'team-X-mails'
`
_, err := Load(in)
expected := "cannot have continue in root route"
if err == nil {
t.Fatalf("no error returned, expeceted:\n%q", expected)
}
if err.Error() != expected {
t.Errorf("\nexpected:\n%q\ngot:\n%q", expected, err.Error())
}
}