Skip to content

Commit

Permalink
WIP - tests
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Nov 30, 2022
1 parent 9f07ba7 commit 16e2fc6
Showing 1 changed file with 100 additions and 0 deletions.
100 changes: 100 additions & 0 deletions decoder/reference_origins_collect_hcl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,106 @@ tup = [ var.three ]
},
},
},
{
// TODO
"cyclical origin referring back to the attribute",
&schema.BodySchema{
Attributes: map[string]*schema.AttributeSchema{
"attr": {
Address: &schema.AttributeAddrSchema{
// TODO
},
Expr: schema.ExprConstraints{
schema.TraversalExpr{},
},
},
},
},
`attr = root.attr`,
reference.Origins{},
},
{
// TODO
"cyclical origin referring back to the attribute with implied address",
&schema.BodySchema{
Blocks: map[string]*schema.BlockSchema{
"blk": {
Address: &schema.BlockAddrSchema{
// TODO
},
Body: &schema.BodySchema{
Attributes: map[string]*schema.AttributeSchema{
"attr": {
Expr: schema.ExprConstraints{
schema.TraversalExpr{},
},
},
},
},
},
},
},
`blk {
attr = blk.attr
}
`,
reference.Origins{},
},
{
// TODO
"cyclical origin referring back to the block with implied address",
&schema.BodySchema{
Blocks: map[string]*schema.BlockSchema{
"blk": {
Address: &schema.BlockAddrSchema{
// TODO
},
Body: &schema.BodySchema{
Attributes: map[string]*schema.AttributeSchema{
"attr": {
Expr: schema.ExprConstraints{
schema.TraversalExpr{},
},
},
},
},
},
},
},
`blk {
attr = blk
}
`,
reference.Origins{},
},
{
// TODO
"cyclical origin referring to another attribute in the same the block",
&schema.BodySchema{
Blocks: map[string]*schema.BlockSchema{
"blk": {
Address: &schema.BlockAddrSchema{
// TODO
},
Body: &schema.BodySchema{
Attributes: map[string]*schema.AttributeSchema{
"attr": {
Expr: schema.ExprConstraints{
schema.TraversalExpr{},
},
},
},
},
},
},
},
`blk {
foo = "test"
attr = blk.foo
}
`,
reference.Origins{},
},
}
for i, tc := range testCases {
t.Run(fmt.Sprintf("%d/%s", i, tc.name), func(t *testing.T) {
Expand Down

0 comments on commit 16e2fc6

Please sign in to comment.