@@ -29,6 +29,7 @@ pre_operations {
29
29
}
30
30
`
31
31
32
+
32
33
func TestSqlxParser (t * testing.T ) {
33
34
tests := []struct {
34
35
name string
@@ -143,6 +144,51 @@ limit 100
143
144
},
144
145
wantErr : false ,
145
146
},
147
+ {
148
+ name : "Config block with multiple curly braces in a single line" ,
149
+ content : `
150
+ config {
151
+ type: 'table',
152
+ schema: 'yyy',
153
+ description: 'some descrtition', bigquery: { partitionBy: "foo",
154
+ clusterBy: ["bar", "baz"],
155
+ }, tags: ["tag1", "tag2"] }
156
+ SELECT
157
+ FOO
158
+ , BAR
159
+ , BAZ
160
+ FROM ${ref({schema:'dataset_name', name:'table_name'})}
161
+ ` ,
162
+ expected : sqlxParserMeta {
163
+ numLines : 12 ,
164
+ configBlockMeta : ConfigBlockMeta {
165
+ exsists : true ,
166
+ startOfConfigBlock : 2 ,
167
+ endOfConfigBlock : 7 ,
168
+ configBlockContent : `
169
+ config {
170
+ type: 'table',
171
+ schema: 'yyy',
172
+ description: 'some descrtition', bigquery: { partitionBy: "foo",
173
+ clusterBy: ["bar", "baz"],
174
+ }, tags: ["tag1", "tag2"] }
175
+ ` ,
176
+ },
177
+ sqlBlocksMeta : SqlBlockMeta {
178
+ exsists : true ,
179
+ startOfSqlBlock : 8 ,
180
+ endOfSqlBlock : 12 ,
181
+ sqlBlockContent : `SELECT
182
+ FOO
183
+ , BAR
184
+ , BAZ
185
+ FROM ${ref({schema:'dataset_name', name:'table_name'})}
186
+ ` ,
187
+ formattedSqlBlockContent : "" ,
188
+ },
189
+ },
190
+ wantErr : false ,
191
+ },
146
192
}
147
193
148
194
for _ , tt := range tests {
0 commit comments