diff --git a/command/output_test.go b/command/output_test.go index f84642269..e8d469029 100644 --- a/command/output_test.go +++ b/command/output_test.go @@ -161,7 +161,8 @@ func TestOutput_blank(t *testing.T) { &terraform.ModuleState{ Path: []string{"root"}, Outputs: map[string]string{ - "foo": "bar", + "foo": "bar", + "name": "john-doe", }, }, }, @@ -181,9 +182,16 @@ func TestOutput_blank(t *testing.T) { "-state", statePath, "", } - if code := c.Run(args); code != 1 { + + if code := c.Run(args); code != 0 { t.Fatalf("bad: \n%s", ui.ErrorWriter.String()) } + + expectedOutput := "foo = bar\nname = john-doe\n" + output := ui.OutputWriter.String() + if output != expectedOutput { + t.Fatalf("Expected output: %#v\ngiven: %#v", expectedOutput, output) + } } func TestOutput_manyArgs(t *testing.T) {