remove unecessary inexistant block panic + add test
the hcl library will error for us
This commit is contained in:
parent
219c80b1e6
commit
0102f5b6fa
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
potato {
|
||||
}
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue