Skip to content

Commit 16e2fc6

Browse files
committed
WIP - tests
1 parent 9f07ba7 commit 16e2fc6

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

decoder/reference_origins_collect_hcl_test.go

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,106 @@ tup = [ var.three ]
10151015
},
10161016
},
10171017
},
1018+
{
1019+
// TODO
1020+
"cyclical origin referring back to the attribute",
1021+
&schema.BodySchema{
1022+
Attributes: map[string]*schema.AttributeSchema{
1023+
"attr": {
1024+
Address: &schema.AttributeAddrSchema{
1025+
// TODO
1026+
},
1027+
Expr: schema.ExprConstraints{
1028+
schema.TraversalExpr{},
1029+
},
1030+
},
1031+
},
1032+
},
1033+
`attr = root.attr`,
1034+
reference.Origins{},
1035+
},
1036+
{
1037+
// TODO
1038+
"cyclical origin referring back to the attribute with implied address",
1039+
&schema.BodySchema{
1040+
Blocks: map[string]*schema.BlockSchema{
1041+
"blk": {
1042+
Address: &schema.BlockAddrSchema{
1043+
// TODO
1044+
},
1045+
Body: &schema.BodySchema{
1046+
Attributes: map[string]*schema.AttributeSchema{
1047+
"attr": {
1048+
Expr: schema.ExprConstraints{
1049+
schema.TraversalExpr{},
1050+
},
1051+
},
1052+
},
1053+
},
1054+
},
1055+
},
1056+
},
1057+
`blk {
1058+
attr = blk.attr
1059+
}
1060+
`,
1061+
reference.Origins{},
1062+
},
1063+
{
1064+
// TODO
1065+
"cyclical origin referring back to the block with implied address",
1066+
&schema.BodySchema{
1067+
Blocks: map[string]*schema.BlockSchema{
1068+
"blk": {
1069+
Address: &schema.BlockAddrSchema{
1070+
// TODO
1071+
},
1072+
Body: &schema.BodySchema{
1073+
Attributes: map[string]*schema.AttributeSchema{
1074+
"attr": {
1075+
Expr: schema.ExprConstraints{
1076+
schema.TraversalExpr{},
1077+
},
1078+
},
1079+
},
1080+
},
1081+
},
1082+
},
1083+
},
1084+
`blk {
1085+
attr = blk
1086+
}
1087+
`,
1088+
reference.Origins{},
1089+
},
1090+
{
1091+
// TODO
1092+
"cyclical origin referring to another attribute in the same the block",
1093+
&schema.BodySchema{
1094+
Blocks: map[string]*schema.BlockSchema{
1095+
"blk": {
1096+
Address: &schema.BlockAddrSchema{
1097+
// TODO
1098+
},
1099+
Body: &schema.BodySchema{
1100+
Attributes: map[string]*schema.AttributeSchema{
1101+
"attr": {
1102+
Expr: schema.ExprConstraints{
1103+
schema.TraversalExpr{},
1104+
},
1105+
},
1106+
},
1107+
},
1108+
},
1109+
},
1110+
},
1111+
`blk {
1112+
foo = "test"
1113+
attr = blk.foo
1114+
}
1115+
`,
1116+
reference.Origins{},
1117+
},
10181118
}
10191119
for i, tc := range testCases {
10201120
t.Run(fmt.Sprintf("%d/%s", i, tc.name), func(t *testing.T) {

0 commit comments

Comments
 (0)