mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Add test for nil *os.File in ReadState
This commit is contained in:
parent
0c1b138719
commit
92cea2478d
@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
@ -1577,6 +1578,20 @@ func TestReadStateNewVersion(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestReadStateEmptyOrNilFile(t *testing.T) {
|
||||
var emptyState bytes.Buffer
|
||||
_, err := ReadState(&emptyState)
|
||||
if err != ErrNoState {
|
||||
t.Fatal("expected ErrNostate, got", err)
|
||||
}
|
||||
|
||||
var nilFile *os.File
|
||||
_, err = ReadState(nilFile)
|
||||
if err != ErrNoState {
|
||||
t.Fatal("expected ErrNostate, got", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReadStateTFVersion(t *testing.T) {
|
||||
type tfVersion struct {
|
||||
Version int `json:"version"`
|
||||
|
Loading…
Reference in New Issue
Block a user