github.com/paybyphone/terraform@v0.9.5-0.20170613192930-9706042ddd51/terraform/testing.go (about)

     1  package terraform
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  )
     7  
     8  // TestStateFile writes the given state to the path.
     9  func TestStateFile(t *testing.T, path string, state *State) {
    10  	f, err := os.Create(path)
    11  	if err != nil {
    12  		t.Fatalf("err: %s", err)
    13  	}
    14  	defer f.Close()
    15  
    16  	if err := WriteState(state, f); err != nil {
    17  		t.Fatalf("err: %s", err)
    18  	}
    19  }