mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 08:51:02 -06:00
20 lines
333 B
Go
20 lines
333 B
Go
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)
|
|
}
|
|
}
|