Add test case for validate JSON diags

pull/38413/head
Daniel Banck 4 weeks ago committed by Daniel Banck
parent 50ac6cf0e3
commit 7c828ce3c0

@ -577,6 +577,22 @@ func TestValidate_json(t *testing.T) {
}
}
func TestValidate_ensure_json_diags(t *testing.T) {
output, code := setupTest(t, "validate-invalid", "-json", "-var", "foo")
if code != 1 {
t.Fatalf("Should have failed: %d\n\n%s", code, output.Stderr())
}
gotString := output.Stdout()
var got map[string]any
err := json.Unmarshal([]byte(gotString), &got)
if err != nil {
t.Fatalf("Test did not produce valid JSON: %s", err)
}
}
func TestValidateWithInvalidListResource(t *testing.T) {
td := t.TempDir()
cases := []struct {

Loading…
Cancel
Save