File tree 2 files changed +59
-1
lines changed
2 files changed +59
-1
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ func ParseAttributes(a *C.char) (resp C.parseResponse) {
63
63
64
64
var diags hcl.Diagnostics
65
65
hclMap := make (jsonObj )
66
- c := converter {}
66
+ c := converter {[] byte ( input ) }
67
67
68
68
attrs , attrsDiags := hclFile .Body .JustAttributes ()
69
69
diags = diags .Extend (attrsDiags )
Original file line number Diff line number Diff line change @@ -85,3 +85,61 @@ def test_heredoc():
85
85
EOT
86
86
"""
87
87
assert pygohcl .attributes_loads (s ) == {"var" : "hey\n you\n " }
88
+
89
+
90
+ def test_complex_objects ():
91
+ s = """
92
+ var = [
93
+ {
94
+ a = 1
95
+ b = 2
96
+ },
97
+ {
98
+ a = "1"
99
+ b = false
100
+ },
101
+ {
102
+ a = [1, 2, 3]
103
+ b = [4, 5, 6]
104
+ },
105
+ {
106
+ c = {
107
+ a = 1
108
+ b = [true, false]
109
+ }
110
+ }
111
+ ]
112
+ """
113
+ assert pygohcl .attributes_loads (s ) == {
114
+ "var" : [
115
+ {
116
+ "a" : 1 ,
117
+ "b" : 2 ,
118
+ },
119
+ {
120
+ "a" : "1" ,
121
+ "b" : False ,
122
+ },
123
+ {
124
+ "a" : [
125
+ 1 ,
126
+ 2 ,
127
+ 3 ,
128
+ ],
129
+ "b" : [
130
+ 4 ,
131
+ 5 ,
132
+ 6 ,
133
+ ],
134
+ },
135
+ {
136
+ "c" : {
137
+ "a" : 1 ,
138
+ "b" : [
139
+ True ,
140
+ False ,
141
+ ],
142
+ },
143
+ },
144
+ ]
145
+ }
You can’t perform that action at this time.
0 commit comments