github.com/leg100/ots@v0.0.7-0.20210919080622-034055ced4bd/parser_test.go (about) 1 package ots 2 3 import ( 4 "os" 5 "testing" 6 7 "github.com/stretchr/testify/assert" 8 "github.com/stretchr/testify/require" 9 ) 10 11 func TestParser(t *testing.T) { 12 data, err := os.ReadFile("testdata/terraform.tfstate") 13 require.NoError(t, err) 14 15 state, err := Parse(data) 16 require.NoError(t, err) 17 18 assert.Equal(t, state, &State{ 19 Version: 4, 20 Serial: 2, 21 Lineage: "b2b54b23-e7ea-5500-7b15-fcb68c1d92bb", 22 Outputs: map[string]StateOutput{ 23 "test_output": { 24 Value: "9023256633839603543", 25 Type: "string", 26 }, 27 }, 28 }) 29 }