opentofu/internal/command/views/test_test.go
Martin Atkins ffe056bacb Move command/ to internal/command/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00

33 lines
899 B
Go

package views
import (
"strings"
"testing"
"github.com/hashicorp/terraform/internal/command/arguments"
"github.com/hashicorp/terraform/internal/moduletest"
"github.com/hashicorp/terraform/internal/terminal"
)
func TestTest(t *testing.T) {
streams, close := terminal.StreamsForTesting(t)
baseView := NewView(streams)
view := NewTest(baseView, arguments.TestOutput{
JUnitXMLFile: "",
})
results := map[string]*moduletest.Suite{}
view.Results(results)
output := close(t)
gotOutput := strings.TrimSpace(output.All())
wantOutput := `No tests defined. This module doesn't have any test suites to run.`
if gotOutput != wantOutput {
t.Errorf("wrong output\ngot:\n%s\nwant:\n%s", gotOutput, wantOutput)
}
// TODO: Test more at this layer. For now, the main UI output tests for
// the "terraform test" command are in the command package as part of
// the overall command tests.
}