github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/builtin/providers/ignition/provider_test.go (about)

     1  package ignition
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/terraform/helper/schema"
     7  	"github.com/hashicorp/terraform/terraform"
     8  )
     9  
    10  var testProviders = map[string]terraform.ResourceProvider{
    11  	"ignition": Provider(),
    12  }
    13  
    14  func TestProvider(t *testing.T) {
    15  	if err := Provider().(*schema.Provider).InternalValidate(); err != nil {
    16  		t.Fatalf("err: %s", err)
    17  	}
    18  }
    19  
    20  func TestValidateUnit(t *testing.T) {
    21  	if err := validateUnitContent(""); err == nil {
    22  		t.Fatalf("error not found, expected error")
    23  	}
    24  
    25  	if err := validateUnitContent("[foo]qux"); err == nil {
    26  		t.Fatalf("error not found, expected error")
    27  	}
    28  
    29  	if err := validateUnitContent("[foo]\nqux=foo\nfoo"); err == nil {
    30  		t.Fatalf("error not found, expected error")
    31  	}
    32  }