backend: TestBackendConfig to allow nil config body

This is not normally considered valid, but since this is a test helper
we will allow it and just treat it as an empty body.
pull/19086/head
Martin Atkins 8 years ago
parent 8565c7460e
commit 1c007473ba

@ -27,6 +27,13 @@ func TestBackendConfig(t *testing.T, b Backend, c hcl.Body) Backend {
var diags tfdiags.Diagnostics
// To make things easier for test authors, we'll allow a nil body here
// (even though that's not normally valid) and just treat it as an empty
// body.
if c == nil {
c = hcl.EmptyBody()
}
schema := b.ConfigSchema()
spec := schema.DecoderSpec()
obj, decDiags := hcldec.Decode(c, spec, nil)

Loading…
Cancel
Save