remove unecessary inexistant block panic + add test

the hcl library will error for us
This commit is contained in:
Adrien Delorme 2020-01-06 16:56:42 +01:00
parent 219c80b1e6
commit 0102f5b6fa
3 changed files with 10 additions and 2 deletions

View File

@ -127,8 +127,6 @@ func (p *Parser) parseFile(f *hcl.File, cfg *PackerConfig) hcl.Diagnostics {
}
cfg.Builds = append(cfg.Builds, build)
default:
panic(fmt.Sprintf("unexpected block type %q", block.Type)) // TODO(azr): err
}
}

View File

@ -0,0 +1,3 @@
potato {
}

View File

@ -90,6 +90,13 @@ func TestParser_complete(t *testing.T) {
getBuildsWantBuilds: []packer.Build{},
getBuildsWantDiags: true,
},
{name: "unknown block type",
parser: defaultParser,
args: parseTestArgs{"testdata/unknown"},
parseWantCfg: &PackerConfig{},
parseWantDiags: true,
parseWantDiagHasErrors: true,
},
}
testParse(t, tests)
}