opentofu/internal/legacy/terraform/testing.go
2023-05-02 15:33:06 +00:00

23 lines
403 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package terraform
import (
"os"
"testing"
)
// TestStateFile writes the given state to the path.
func TestStateFile(t *testing.T, path string, state *State) {
f, err := os.Create(path)
if err != nil {
t.Fatalf("err: %s", err)
}
defer f.Close()
if err := WriteState(state, f); err != nil {
t.Fatalf("err: %s", err)
}
}