Skip to content

Commit

Permalink
add tests for tfsdk tags on embedded structs
Browse files Browse the repository at this point in the history
  • Loading branch information
austinvalle committed Jul 25, 2024
1 parent 2ccf8f2 commit 2be48eb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/reflect/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ func TestGetStructTags(t *testing.T) {
"field5": {1},
},
},
"embedded-struct-err-cannot-have-tfsdk-tag": {
in: struct {
ExampleStruct `tfsdk:"example_field"` // Can't put a tfsdk tag here
}{},
expectedErr: errors.New(`example_field: embedded struct field ExampleStruct cannot have tfsdk tag`),
},
"embedded-struct-err-invalid": {
in: struct {
StructWithInvalidTag // Contains an invalid "tfsdk" tag
Expand Down Expand Up @@ -179,6 +185,12 @@ func TestGetStructTags(t *testing.T) {
"field5": {1},
},
},
"embedded-struct-ptr-err-cannot-have-tfsdk-tag": {
in: struct {
*ExampleStruct `tfsdk:"example_field"` // Can't put a tfsdk tag here
}{},
expectedErr: errors.New(`example_field: embedded struct field ExampleStruct cannot have tfsdk tag`),
},
"embedded-struct-ptr-err-duplicate-fields": {
in: struct {
*EmbedWithDuplicates
Expand Down

0 comments on commit 2be48eb

Please sign in to comment.