github.com/graywolf-at-work-2/terraform-vendor@v1.4.5/internal/command/views/test_test.go (about)

     1  package views
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  
     7  	"github.com/hashicorp/terraform/internal/command/arguments"
     8  	"github.com/hashicorp/terraform/internal/moduletest"
     9  	"github.com/hashicorp/terraform/internal/terminal"
    10  )
    11  
    12  func TestTest(t *testing.T) {
    13  	streams, close := terminal.StreamsForTesting(t)
    14  	baseView := NewView(streams)
    15  	view := NewTest(baseView, arguments.TestOutput{
    16  		JUnitXMLFile: "",
    17  	})
    18  
    19  	results := map[string]*moduletest.Suite{}
    20  	view.Results(results)
    21  
    22  	output := close(t)
    23  	gotOutput := strings.TrimSpace(output.All())
    24  	wantOutput := `No tests defined. This module doesn't have any test suites to run.`
    25  	if gotOutput != wantOutput {
    26  		t.Errorf("wrong output\ngot:\n%s\nwant:\n%s", gotOutput, wantOutput)
    27  	}
    28  
    29  	// TODO: Test more at this layer. For now, the main UI output tests for
    30  	// the "terraform test" command are in the command package as part of
    31  	// the overall command tests.
    32  }