d2ir: Add filter error tests
This commit is contained in:
parent
43166110b8
commit
6b73a61bd2
6 changed files with 1243 additions and 3 deletions
|
|
@ -466,6 +466,9 @@ func (c *compiler) _ampersandFilter(f *Field, refctx *RefContext) bool {
|
|||
if refctx.Key.Value.ScalarBox().Unbox().ScalarString() != f2.Primary_.Value.ScalarString() {
|
||||
return false
|
||||
}
|
||||
} else if refctx.Key.Value.Unbox() != nil {
|
||||
c.errorf(refctx.Key, "ampersand filters cannot be composites")
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
|
|
|
|||
|
|
@ -51,4 +51,44 @@ jeremy: {
|
|||
}
|
||||
|
||||
runa(t, tca)
|
||||
|
||||
t.Run("errors", func(t *testing.T) {
|
||||
tca := []testCase{
|
||||
{
|
||||
name: "bad-syntax",
|
||||
run: func(t testing.TB) {
|
||||
_, err := compile(t, `jacob.style: {
|
||||
fill: red
|
||||
multiple: true
|
||||
}
|
||||
|
||||
*.&style: {
|
||||
fill: red
|
||||
multiple: true
|
||||
}
|
||||
`)
|
||||
assert.ErrorString(t, err, `TestCompile/filters/errors/bad-syntax.d2:6:3: unexpected text after map key
|
||||
TestCompile/filters/errors/bad-syntax.d2:9:1: unexpected map termination character } in file map`)
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "composite",
|
||||
run: func(t testing.TB) {
|
||||
_, err := compile(t, `jacob.style: {
|
||||
fill: red
|
||||
multiple: true
|
||||
}
|
||||
*: {
|
||||
&style: {
|
||||
fill: red
|
||||
multiple: true
|
||||
}
|
||||
}
|
||||
`)
|
||||
assert.ErrorString(t, err, `TestCompile/filters/errors/composite.d2:6:2: ampersand filters cannot be composites`)
|
||||
},
|
||||
},
|
||||
}
|
||||
runa(t, tca)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -323,10 +323,9 @@ task.** -> fast
|
|||
{
|
||||
name: "glob-edge-glob-index",
|
||||
run: func(t testing.TB) {
|
||||
m, err := compile(t, `(* -> b)[*].style.fill: red
|
||||
_, err := compile(t, `(* -> b)[*].style.fill: red
|
||||
`)
|
||||
assert.ErrorString(t, err, `TestCompile/patterns/errors/glob-edge-glob-index.d2:1:2: indexed edge does not exist`)
|
||||
assertQuery(t, m, 0, 0, nil, "")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1098,7 +1098,7 @@ func (p *parser) parseUnquotedString(inKey bool) (s *d2ast.UnquotedString) {
|
|||
}
|
||||
if inKey {
|
||||
switch r {
|
||||
case ':', '.', '<', '>':
|
||||
case ':', '.', '<', '>', '&':
|
||||
p.rewind()
|
||||
return s
|
||||
case '-':
|
||||
|
|
|
|||
749
testdata/d2ir/TestCompile/filters/errors/bad-syntax.exp.json
generated
vendored
Normal file
749
testdata/d2ir/TestCompile/filters/errors/bad-syntax.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,749 @@
|
|||
{
|
||||
"fields": [
|
||||
{
|
||||
"name": "jacob",
|
||||
"composite": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "style",
|
||||
"composite": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "fill",
|
||||
"primary": {
|
||||
"value": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:7:22-1:10:25",
|
||||
"value": [
|
||||
{
|
||||
"string": "red",
|
||||
"raw_string": "red"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"context": {
|
||||
"edge": null,
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:10:25",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:7:22-1:10:25",
|
||||
"value": [
|
||||
{
|
||||
"string": "red",
|
||||
"raw_string": "red"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "multiple",
|
||||
"primary": {
|
||||
"value": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:11:37-2:15:41",
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35",
|
||||
"value": [
|
||||
{
|
||||
"string": "multiple",
|
||||
"raw_string": "multiple"
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35",
|
||||
"value": [
|
||||
{
|
||||
"string": "multiple",
|
||||
"raw_string": "multiple"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"context": {
|
||||
"edge": null,
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:15:41",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35",
|
||||
"value": [
|
||||
{
|
||||
"string": "multiple",
|
||||
"raw_string": "multiple"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"boolean": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:11:37-2:15:41",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"edges": null
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:6:6-0:11:11",
|
||||
"value": [
|
||||
{
|
||||
"string": "style",
|
||||
"raw_string": "style"
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:11:11",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:5:5",
|
||||
"value": [
|
||||
{
|
||||
"string": "jacob",
|
||||
"raw_string": "jacob"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:6:6-0:11:11",
|
||||
"value": [
|
||||
{
|
||||
"string": "style",
|
||||
"raw_string": "style"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"context": {
|
||||
"edge": null,
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-3:1:43",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:11:11",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:5:5",
|
||||
"value": [
|
||||
{
|
||||
"string": "jacob",
|
||||
"raw_string": "jacob"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:6:6-0:11:11",
|
||||
"value": [
|
||||
{
|
||||
"string": "style",
|
||||
"raw_string": "style"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:13:13-3:1:43",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:10:25",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:7:22-1:10:25",
|
||||
"value": [
|
||||
{
|
||||
"string": "red",
|
||||
"raw_string": "red"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"map_key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:15:41",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35",
|
||||
"value": [
|
||||
{
|
||||
"string": "multiple",
|
||||
"raw_string": "multiple"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"boolean": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:11:37-2:15:41",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "&style",
|
||||
"composite": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "fill",
|
||||
"primary": {
|
||||
"value": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,6:8:65-6:11:68",
|
||||
"value": [
|
||||
{
|
||||
"string": "red",
|
||||
"raw_string": "red"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:6:63",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:6:63",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:6:63",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"context": {
|
||||
"edge": null,
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:11:68",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:6:63",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:6:63",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,6:8:65-6:11:68",
|
||||
"value": [
|
||||
{
|
||||
"string": "red",
|
||||
"raw_string": "red"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "multiple",
|
||||
"primary": {
|
||||
"value": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,7:12:81-7:16:85",
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:10:79",
|
||||
"value": [
|
||||
{
|
||||
"string": "multiple",
|
||||
"raw_string": "multiple"
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:10:79",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:10:79",
|
||||
"value": [
|
||||
{
|
||||
"string": "multiple",
|
||||
"raw_string": "multiple"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"context": {
|
||||
"edge": null,
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:16:85",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:10:79",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:10:79",
|
||||
"value": [
|
||||
{
|
||||
"string": "multiple",
|
||||
"raw_string": "multiple"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"boolean": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,7:12:81-7:16:85",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"edges": null
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,5:2:47-5:8:53",
|
||||
"value": [
|
||||
{
|
||||
"string": "&style",
|
||||
"raw_string": "&style"
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,5:0:45-5:8:53",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,5:0:45-5:1:46",
|
||||
"value": [
|
||||
{
|
||||
"string": "*",
|
||||
"raw_string": "*"
|
||||
}
|
||||
],
|
||||
"pattern": [
|
||||
"*"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,5:2:47-5:8:53",
|
||||
"value": [
|
||||
{
|
||||
"string": "&style",
|
||||
"raw_string": "&style"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"context": {
|
||||
"edge": null,
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,5:0:45-8:1:87",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,5:0:45-5:8:53",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,5:0:45-5:1:46",
|
||||
"value": [
|
||||
{
|
||||
"string": "*",
|
||||
"raw_string": "*"
|
||||
}
|
||||
],
|
||||
"pattern": [
|
||||
"*"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,5:2:47-5:8:53",
|
||||
"value": [
|
||||
{
|
||||
"string": "&style",
|
||||
"raw_string": "&style"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,5:10:55-8:1:87",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:11:68",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:6:63",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,6:2:59-6:6:63",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,6:8:65-6:11:68",
|
||||
"value": [
|
||||
{
|
||||
"string": "red",
|
||||
"raw_string": "red"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"map_key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:16:85",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:10:79",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,7:2:71-7:10:79",
|
||||
"value": [
|
||||
{
|
||||
"string": "multiple",
|
||||
"raw_string": "multiple"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"boolean": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,7:12:81-7:16:85",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"edges": null
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:5:5",
|
||||
"value": [
|
||||
{
|
||||
"string": "jacob",
|
||||
"raw_string": "jacob"
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:11:11",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:5:5",
|
||||
"value": [
|
||||
{
|
||||
"string": "jacob",
|
||||
"raw_string": "jacob"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:6:6-0:11:11",
|
||||
"value": [
|
||||
{
|
||||
"string": "style",
|
||||
"raw_string": "style"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"context": {
|
||||
"edge": null,
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-3:1:43",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:11:11",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:0:0-0:5:5",
|
||||
"value": [
|
||||
{
|
||||
"string": "jacob",
|
||||
"raw_string": "jacob"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:6:6-0:11:11",
|
||||
"value": [
|
||||
{
|
||||
"string": "style",
|
||||
"raw_string": "style"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,0:13:13-3:1:43",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:10:25",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:1:16-1:5:20",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,1:7:22-1:10:25",
|
||||
"value": [
|
||||
{
|
||||
"string": "red",
|
||||
"raw_string": "red"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"map_key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:15:41",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:1:27-2:9:35",
|
||||
"value": [
|
||||
{
|
||||
"string": "multiple",
|
||||
"raw_string": "multiple"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"boolean": {
|
||||
"range": "TestCompile/filters/errors/bad-syntax.d2,2:11:37-2:15:41",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"edges": null
|
||||
}
|
||||
449
testdata/d2ir/TestCompile/filters/errors/composite.exp.json
generated
vendored
Normal file
449
testdata/d2ir/TestCompile/filters/errors/composite.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,449 @@
|
|||
{
|
||||
"fields": [
|
||||
{
|
||||
"name": "jacob",
|
||||
"composite": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "style",
|
||||
"composite": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "fill",
|
||||
"primary": {
|
||||
"value": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:7:73-8:10:76",
|
||||
"value": [
|
||||
{
|
||||
"string": "red",
|
||||
"raw_string": "red"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"context": {
|
||||
"edge": null,
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:1:67-8:10:76",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:7:73-8:10:76",
|
||||
"value": [
|
||||
{
|
||||
"string": "red",
|
||||
"raw_string": "red"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "multiple",
|
||||
"primary": {
|
||||
"value": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:11:88-9:15:92",
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86",
|
||||
"value": [
|
||||
{
|
||||
"string": "multiple",
|
||||
"raw_string": "multiple"
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86",
|
||||
"value": [
|
||||
{
|
||||
"string": "multiple",
|
||||
"raw_string": "multiple"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"context": {
|
||||
"edge": null,
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:1:78-9:15:92",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86",
|
||||
"value": [
|
||||
{
|
||||
"string": "multiple",
|
||||
"raw_string": "multiple"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"boolean": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:11:88-9:15:92",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"edges": null
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:6:57-7:11:62",
|
||||
"value": [
|
||||
{
|
||||
"string": "style",
|
||||
"raw_string": "style"
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:0:51-7:11:62",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:0:51-7:5:56",
|
||||
"value": [
|
||||
{
|
||||
"string": "jacob",
|
||||
"raw_string": "jacob"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:6:57-7:11:62",
|
||||
"value": [
|
||||
{
|
||||
"string": "style",
|
||||
"raw_string": "style"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"context": {
|
||||
"edge": null,
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:0:51-10:1:94",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:0:51-7:11:62",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:0:51-7:5:56",
|
||||
"value": [
|
||||
{
|
||||
"string": "jacob",
|
||||
"raw_string": "jacob"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:6:57-7:11:62",
|
||||
"value": [
|
||||
{
|
||||
"string": "style",
|
||||
"raw_string": "style"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:13:64-10:1:94",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:1:67-8:10:76",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:7:73-8:10:76",
|
||||
"value": [
|
||||
{
|
||||
"string": "red",
|
||||
"raw_string": "red"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"map_key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:1:78-9:15:92",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86",
|
||||
"value": [
|
||||
{
|
||||
"string": "multiple",
|
||||
"raw_string": "multiple"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"boolean": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:11:88-9:15:92",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"edges": null
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:0:51-7:5:56",
|
||||
"value": [
|
||||
{
|
||||
"string": "jacob",
|
||||
"raw_string": "jacob"
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:0:51-7:11:62",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:0:51-7:5:56",
|
||||
"value": [
|
||||
{
|
||||
"string": "jacob",
|
||||
"raw_string": "jacob"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:6:57-7:11:62",
|
||||
"value": [
|
||||
{
|
||||
"string": "style",
|
||||
"raw_string": "style"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"context": {
|
||||
"edge": null,
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:0:51-10:1:94",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:0:51-7:11:62",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:0:51-7:5:56",
|
||||
"value": [
|
||||
{
|
||||
"string": "jacob",
|
||||
"raw_string": "jacob"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:6:57-7:11:62",
|
||||
"value": [
|
||||
{
|
||||
"string": "style",
|
||||
"raw_string": "style"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"map": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,7:13:64-10:1:94",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:1:67-8:10:76",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:1:67-8:5:71",
|
||||
"value": [
|
||||
{
|
||||
"string": "fill",
|
||||
"raw_string": "fill"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,8:7:73-8:10:76",
|
||||
"value": [
|
||||
{
|
||||
"string": "red",
|
||||
"raw_string": "red"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"map_key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:1:78-9:15:92",
|
||||
"key": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:1:78-9:9:86",
|
||||
"value": [
|
||||
{
|
||||
"string": "multiple",
|
||||
"raw_string": "multiple"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"boolean": {
|
||||
"range": "TestCompile/filters/errors/composite.d2,9:11:88-9:15:92",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"edges": null
|
||||
}
|
||||
Loading…
Reference in a new issue