Merge pull request #1 from nopcoder/fix/load-unrecognized-keys

Fix error on unrecognized configuration keys
This commit is contained in:
Su Yang 2023-01-09 22:10:03 +08:00 committed by GitHub
commit f90fc7ce77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 13 deletions

View file

@ -425,6 +425,7 @@ var hooksLoadFromFileTests = []struct {
{"", false, true},
// failures
{"missing.json", false, false},
{"testdata/unrecognized.yaml", false, false},
}
func TestHooksLoadFromFile(t *testing.T) {
@ -434,6 +435,7 @@ func TestHooksLoadFromFile(t *testing.T) {
for _, tt := range hooksLoadFromFileTests {
h := &Hooks{}
err := h.LoadFromFile(tt.path, tt.asTemplate)
t.Log(err)
if (err == nil) != tt.ok {
t.Errorf(err.Error())
}