diff --git a/d2compiler/compile_test.go b/d2compiler/compile_test.go index 3c7c024eb..701dad396 100644 --- a/d2compiler/compile_test.go +++ b/d2compiler/compile_test.go @@ -1723,6 +1723,50 @@ y } }, }, + { + name: "reserved_quoted/1", + text: `x: { + "label": hello +} +`, + assertions: func(t *testing.T, g *d2graph.Graph) { + assert.Equal(t, 2, len(g.Objects)) + }, + }, + { + name: "reserved_quoted/2", + text: `my_table: { + shape: sql_table + width: 200 + height: 200 + "shape": string + "icon": string + "width": int + "height": int +} + `, + assertions: func(t *testing.T, g *d2graph.Graph) { + assert.Equal(t, 4, len(g.Objects[0].SQLTable.Columns)) + assert.Equal(t, `"shape"`, g.Objects[0].SQLTable.Columns[0].Name.Label) + }, + }, + { + name: "reserved_quoted/3", + text: `*."shape" +x + `, + assertions: func(t *testing.T, g *d2graph.Graph) { + assert.Equal(t, 2, len(g.Objects)) + assert.Equal(t, `x.'"shape"'`, g.Objects[0].AbsID()) + }, + }, + { + name: "reserved_quoted/4", + text: `x."style"."fill"`, + assertions: func(t *testing.T, g *d2graph.Graph) { + assert.Equal(t, 3, len(g.Objects)) + }, + }, { name: "errors/reserved_icon_style",