(t *testing.T)
| 1238 | } |
| 1239 | |
| 1240 | func TestExpressionVariables(t *testing.T) { |
| 1241 | tests := []struct { |
| 1242 | Src string |
| 1243 | Want []hcl.Traversal |
| 1244 | }{ |
| 1245 | { |
| 1246 | `{"a":true}`, |
| 1247 | nil, |
| 1248 | }, |
| 1249 | { |
| 1250 | `{"a":"${foo}"}`, |
| 1251 | []hcl.Traversal{ |
| 1252 | { |
| 1253 | hcl.TraverseRoot{ |
| 1254 | Name: "foo", |
| 1255 | SrcRange: hcl.Range{ |
| 1256 | Filename: "test.json", |
| 1257 | Start: hcl.Pos{Line: 1, Column: 9, Byte: 8}, |
| 1258 | End: hcl.Pos{Line: 1, Column: 12, Byte: 11}, |
| 1259 | }, |
| 1260 | }, |
| 1261 | }, |
| 1262 | }, |
| 1263 | }, |
| 1264 | { |
| 1265 | `{"a":["${foo}"]}`, |
| 1266 | []hcl.Traversal{ |
| 1267 | { |
| 1268 | hcl.TraverseRoot{ |
| 1269 | Name: "foo", |
| 1270 | SrcRange: hcl.Range{ |
| 1271 | Filename: "test.json", |
| 1272 | Start: hcl.Pos{Line: 1, Column: 10, Byte: 9}, |
| 1273 | End: hcl.Pos{Line: 1, Column: 13, Byte: 12}, |
| 1274 | }, |
| 1275 | }, |
| 1276 | }, |
| 1277 | }, |
| 1278 | }, |
| 1279 | { |
| 1280 | `{"a":{"b":"${foo}"}}`, |
| 1281 | []hcl.Traversal{ |
| 1282 | { |
| 1283 | hcl.TraverseRoot{ |
| 1284 | Name: "foo", |
| 1285 | SrcRange: hcl.Range{ |
| 1286 | Filename: "test.json", |
| 1287 | Start: hcl.Pos{Line: 1, Column: 14, Byte: 13}, |
| 1288 | End: hcl.Pos{Line: 1, Column: 17, Byte: 16}, |
| 1289 | }, |
| 1290 | }, |
| 1291 | }, |
| 1292 | }, |
| 1293 | }, |
| 1294 | { |
| 1295 | `{"a":{"${foo}":"b"}}`, |
| 1296 | []hcl.Traversal{ |
| 1297 | { |
nothing calls this directly
no test coverage detected