remove unecessary inexistant block panic + add test

the hcl library will error for us
pull/8569/head
Adrien Delorme 6 years ago
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
}
}

@ -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…
Cancel
Save