github.com/graywolf-at-work-2/terraform-vendor@v1.4.5/internal/configs/configload/loader_test.go (about)

     1  package configload
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/hcl/v2"
     7  	"github.com/zclconf/go-cty/cty"
     8  )
     9  
    10  func assertNoDiagnostics(t *testing.T, diags hcl.Diagnostics) bool {
    11  	t.Helper()
    12  	return assertDiagnosticCount(t, diags, 0)
    13  }
    14  
    15  func assertDiagnosticCount(t *testing.T, diags hcl.Diagnostics, want int) bool {
    16  	t.Helper()
    17  	if len(diags) != want {
    18  		t.Errorf("wrong number of diagnostics %d; want %d", len(diags), want)
    19  		for _, diag := range diags {
    20  			t.Logf("- %s", diag)
    21  		}
    22  		return true
    23  	}
    24  	return false
    25  }
    26  func assertResultCtyEqual(t *testing.T, got, want cty.Value) bool {
    27  	t.Helper()
    28  	if !got.RawEquals(want) {
    29  		t.Errorf("wrong result\ngot:  %#v\nwant: %#v", got, want)
    30  		return true
    31  	}
    32  	return false
    33  }