Skip to content

Commit

Permalink
decoder: Update legacy tests for ObjectExpr
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Mar 14, 2023
1 parent 5acddf8 commit fd9193b
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 170 deletions.
64 changes: 28 additions & 36 deletions decoder/expression_candidates_legacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,13 @@ func TestLegacyDecoder_CandidateAtPos_expressions(t *testing.T) {
"object as expression",
map[string]*schema.AttributeSchema{
"attr": {
Expr: schema.ExprConstraints{
schema.ObjectExpr{
Attributes: schema.ObjectExprAttributes{
"first": &schema.AttributeSchema{
Expr: schema.LiteralTypeOnly(cty.String),
},
"second": &schema.AttributeSchema{
Expr: schema.LiteralTypeOnly(cty.Number),
},
Constraint: schema.Object{
Attributes: schema.ObjectAttributes{
"first": &schema.AttributeSchema{
Constraint: schema.LiteralType{Type: cty.String},
},
"second": &schema.AttributeSchema{
Constraint: schema.LiteralType{Type: cty.Number},
},
},
},
Expand Down Expand Up @@ -179,15 +177,13 @@ func TestLegacyDecoder_CandidateAtPos_expressions(t *testing.T) {
"object as expression - attribute",
map[string]*schema.AttributeSchema{
"attr": {
Expr: schema.ExprConstraints{
schema.ObjectExpr{
Attributes: schema.ObjectExprAttributes{
"first": &schema.AttributeSchema{
Expr: schema.LiteralTypeOnly(cty.String),
},
"second": &schema.AttributeSchema{
Expr: schema.LiteralTypeOnly(cty.Number),
},
Constraint: schema.Object{
Attributes: schema.ObjectAttributes{
"first": &schema.AttributeSchema{
Constraint: schema.LiteralType{Type: cty.String},
},
"second": &schema.AttributeSchema{
Constraint: schema.LiteralType{Type: cty.Number},
},
},
},
Expand Down Expand Up @@ -249,15 +245,13 @@ func TestLegacyDecoder_CandidateAtPos_expressions(t *testing.T) {
"object as expression - attributes partially declared",
map[string]*schema.AttributeSchema{
"attr": {
Expr: schema.ExprConstraints{
schema.ObjectExpr{
Attributes: schema.ObjectExprAttributes{
"first": &schema.AttributeSchema{
Expr: schema.LiteralTypeOnly(cty.String),
},
"second": &schema.AttributeSchema{
Expr: schema.LiteralTypeOnly(cty.Number),
},
Constraint: schema.Object{
Attributes: schema.ObjectAttributes{
"first": &schema.AttributeSchema{
Constraint: schema.LiteralType{Type: cty.String},
},
"second": &schema.AttributeSchema{
Constraint: schema.LiteralType{Type: cty.Number},
},
},
},
Expand Down Expand Up @@ -298,15 +292,13 @@ func TestLegacyDecoder_CandidateAtPos_expressions(t *testing.T) {
"object as expression - attribute key unknown",
map[string]*schema.AttributeSchema{
"attr": {
Expr: schema.ExprConstraints{
schema.ObjectExpr{
Attributes: schema.ObjectExprAttributes{
"first": &schema.AttributeSchema{
Expr: schema.LiteralTypeOnly(cty.String),
},
"second": &schema.AttributeSchema{
Expr: schema.LiteralTypeOnly(cty.Number),
},
Constraint: schema.Object{
Attributes: schema.ObjectAttributes{
"first": &schema.AttributeSchema{
Constraint: schema.LiteralType{Type: cty.String},
},
"second": &schema.AttributeSchema{
Constraint: schema.LiteralType{Type: cty.Number},
},
},
},
Expand Down
Loading

0 comments on commit fd9193b

Please sign in to comment.