update compile test

This commit is contained in:
Gavin Nishizawa 2023-05-08 18:41:47 -07:00
parent aff2c5c68e
commit 590a18c8bd
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD
2 changed files with 822 additions and 12 deletions

View file

@ -2373,11 +2373,17 @@ d2/testdata/d2compiler/TestCompile/grid_edge.d2:6:2: edges in grid diagrams are
a
b
c
d.invalid descendant
d.valid descendant
e: {
grid-rows: 1
grid-columns: 2
a
b
}
}
`,
expErr: `d2/testdata/d2compiler/TestCompile/grid_nested.d2:2:2: "grid-rows" can only be used on containers with one level of nesting right now. ("hey.d" has nested "invalid descendant")
d2/testdata/d2compiler/TestCompile/grid_nested.d2:3:2: "grid-columns" can only be used on containers with one level of nesting right now. ("hey.d" has nested "invalid descendant")`,
expErr: ``,
},
{
name: "classes",

View file

@ -1,16 +1,820 @@
{
"graph": null,
"err": {
"ioerr": null,
"errs": [
"graph": {
"name": "",
"isFolderOnly": false,
"ast": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,0:0:0-16:0:125",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,0:0:0-15:1:124",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,0:0:0-0:3:3",
"value": [
{
"string": "hey",
"raw_string": "hey"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,0:5:5-15:0:123",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,1:1:8-1:15:22",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,1:1:8-1:10:17",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,1:1:8-1:10:17",
"value": [
{
"string": "grid-rows",
"raw_string": "grid-rows"
}
]
}
}
]
},
"primary": {},
"value": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,1:12:19-1:15:22",
"raw": "200",
"value": "200"
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,2:1:24-2:18:41",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,2:1:24-2:13:36",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,2:1:24-2:13:36",
"value": [
{
"string": "grid-columns",
"raw_string": "grid-columns"
}
]
}
}
]
},
"primary": {},
"value": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,2:15:38-2:18:41",
"raw": "200",
"value": "200"
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,4:1:44-4:2:45",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,4:1:44-4:2:45",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,4:1:44-4:2:45",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,5:1:47-5:2:48",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,5:1:47-5:2:48",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,5:1:47-5:2:48",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,6:1:50-6:2:51",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,6:1:50-6:2:51",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,6:1:50-6:2:51",
"value": [
{
"string": "c",
"raw_string": "c"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,7:1:53-7:19:71",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,7:1:53-7:19:71",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,7:1:53-7:2:54",
"value": [
{
"string": "d",
"raw_string": "d"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,7:3:55-7:19:71",
"value": [
{
"string": "valid descendant",
"raw_string": "valid descendant"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,8:1:73-14:2:122",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,8:1:73-8:2:74",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,8:1:73-8:2:74",
"value": [
{
"string": "e",
"raw_string": "e"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,8:4:76-14:1:121",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,9:2:80-9:14:92",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,9:2:80-9:11:89",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,9:2:80-9:11:89",
"value": [
{
"string": "grid-rows",
"raw_string": "grid-rows"
}
]
}
}
]
},
"primary": {},
"value": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,9:13:91-9:14:92",
"raw": "1",
"value": "1"
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,10:2:95-10:17:110",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,10:2:95-10:14:107",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,10:2:95-10:14:107",
"value": [
{
"string": "grid-columns",
"raw_string": "grid-columns"
}
]
}
}
]
},
"primary": {},
"value": {
"number": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,10:16:109-10:17:110",
"raw": "2",
"value": "2"
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,12:2:114-12:3:115",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,12:2:114-12:3:115",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,12:2:114-12:3:115",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"primary": {},
"value": {}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,13:2:118-13:3:119",
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,13:2:118-13:3:119",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,13:2:118-13:3:119",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
}
]
},
"primary": {},
"value": {}
}
}
]
}
}
}
}
]
}
}
}
}
]
},
"root": {
"id": "",
"id_val": "",
"attributes": {
"label": {
"value": ""
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": ""
},
"direction": {
"value": ""
},
"constraint": {
"value": ""
}
},
"zIndex": 0
},
"edges": null,
"objects": [
{
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,1:1:8-1:15:22",
"errmsg": "d2/testdata/d2compiler/TestCompile/grid_nested.d2:2:2: \"grid-rows\" can only be used on containers with one level of nesting right now. (\"hey.d\" has nested \"invalid descendant\")"
"id": "hey",
"id_val": "hey",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,0:0:0-0:3:3",
"value": [
{
"string": "hey",
"raw_string": "hey"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "hey"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": {
"value": ""
},
"gridRows": {
"value": "200"
},
"gridColumns": {
"value": "200"
}
},
"zIndex": 0
},
{
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,2:1:24-2:18:41",
"errmsg": "d2/testdata/d2compiler/TestCompile/grid_nested.d2:3:2: \"grid-columns\" can only be used on containers with one level of nesting right now. (\"hey.d\" has nested \"invalid descendant\")"
"id": "a",
"id_val": "a",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,4:1:44-4:2:45",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,4:1:44-4:2:45",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "a"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": {
"value": ""
}
},
"zIndex": 0
},
{
"id": "b",
"id_val": "b",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,5:1:47-5:2:48",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,5:1:47-5:2:48",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "b"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": {
"value": ""
}
},
"zIndex": 0
},
{
"id": "c",
"id_val": "c",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,6:1:50-6:2:51",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,6:1:50-6:2:51",
"value": [
{
"string": "c",
"raw_string": "c"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "c"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": {
"value": ""
}
},
"zIndex": 0
},
{
"id": "d",
"id_val": "d",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,7:1:53-7:19:71",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,7:1:53-7:2:54",
"value": [
{
"string": "d",
"raw_string": "d"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,7:3:55-7:19:71",
"value": [
{
"string": "valid descendant",
"raw_string": "valid descendant"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "d"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": {
"value": ""
}
},
"zIndex": 0
},
{
"id": "valid descendant",
"id_val": "valid descendant",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,7:1:53-7:19:71",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,7:1:53-7:2:54",
"value": [
{
"string": "d",
"raw_string": "d"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,7:3:55-7:19:71",
"value": [
{
"string": "valid descendant",
"raw_string": "valid descendant"
}
]
}
}
]
},
"key_path_index": 1,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "valid descendant"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": {
"value": ""
}
},
"zIndex": 0
},
{
"id": "e",
"id_val": "e",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,8:1:73-8:2:74",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,8:1:73-8:2:74",
"value": [
{
"string": "e",
"raw_string": "e"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "e"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": {
"value": ""
},
"gridRows": {
"value": "1"
},
"gridColumns": {
"value": "2"
}
},
"zIndex": 0
},
{
"id": "a",
"id_val": "a",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,12:2:114-12:3:115",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,12:2:114-12:3:115",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "a"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": {
"value": ""
}
},
"zIndex": 0
},
{
"id": "b",
"id_val": "b",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,13:2:118-13:3:119",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile/grid_nested.d2,13:2:118-13:3:119",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "b"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": {
"value": ""
}
},
"zIndex": 0
}
]
}
},
"err": null
}