From 43b206cde894bad507d4f2409de40caea26dbf7f Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Sun, 7 May 2023 16:09:57 -0700 Subject: [PATCH] move container --- d2oracle/edit.go | 169 ++- d2oracle/edit_test.go | 296 ++++- testdata/d2oracle/TestMove/flat_near.exp.json | 314 +++++ .../include_descendants_basic.exp.json | 266 ++++ .../include_descendants_conflict.exp.json | 336 +++++ .../include_descendants_edge.exp.json | 365 ++++++ .../include_descendants_edge_child.exp.json | 365 ++++++ .../include_descendants_edge_ref.exp.json | 615 +++++++++ ...e_descendants_edge_ref_underscore.exp.json | 1153 +++++++++++++++++ .../include_descendants_flat.exp.json | 266 ++++ .../include_descendants_grandchild.exp.json | 461 +++++++ .../TestMove/include_descendants_map.exp.json | 262 ++++ .../include_descendants_near.exp.json | 405 ++++++ .../include_descendants_non_conflict.exp.json | 406 ++++++ .../TestMove/include_descendants_sql.exp.json | 290 +++++ 15 files changed, 5905 insertions(+), 64 deletions(-) create mode 100644 testdata/d2oracle/TestMove/flat_near.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_basic.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_conflict.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_edge.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_edge_child.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_edge_ref.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_flat.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_grandchild.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_map.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_near.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_non_conflict.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_sql.exp.json diff --git a/d2oracle/edit.go b/d2oracle/edit.go index d5b0896c1..ca15bbc72 100644 --- a/d2oracle/edit.go +++ b/d2oracle/edit.go @@ -768,7 +768,7 @@ func Delete(g *d2graph.Graph, key string) (_ *d2graph.Graph, err error) { return nil, err } - if err := updateNear(prevG, g, &key, nil); err != nil { + if err := updateNear(prevG, g, &key, nil, false); err != nil { return nil, err } @@ -951,7 +951,7 @@ func renameConflictsToParent(g *d2graph.Graph, key *d2ast.KeyPath) (*d2graph.Gra } for _, k := range renameOrder { var err error - g, err = move(g, k, renames[k]) + g, err = move(g, k, renames[k], false) if err != nil { return nil, err } @@ -1312,7 +1312,7 @@ func Rename(g *d2graph.Graph, key, newName string) (_ *d2graph.Graph, err error) mk.Key.Path[len(mk.Key.Path)-1] = d2ast.MakeValueBox(d2ast.RawString(newName, true)).StringBox() } - return move(g, key, d2format.Format(mk)) + return move(g, key, d2format.Format(mk), false) } func trimReservedSuffix(path []*d2ast.StringBox) []*d2ast.StringBox { @@ -1325,12 +1325,12 @@ func trimReservedSuffix(path []*d2ast.StringBox) []*d2ast.StringBox { } // Does not handle edge keys, on account of edge keys can only be reserved, e.g. (a->b).style.color: red -func Move(g *d2graph.Graph, key, newKey string) (_ *d2graph.Graph, err error) { +func Move(g *d2graph.Graph, key, newKey string, includeDescendants bool) (_ *d2graph.Graph, err error) { defer xdefer.Errorf(&err, "failed to move: %#v to %#v", key, newKey) - return move(g, key, newKey) + return move(g, key, newKey, includeDescendants) } -func move(g *d2graph.Graph, key, newKey string) (*d2graph.Graph, error) { +func move(g *d2graph.Graph, key, newKey string, includeDescendants bool) (*d2graph.Graph, error) { if key == newKey { return g, nil } @@ -1387,7 +1387,7 @@ func move(g *d2graph.Graph, key, newKey string) (*d2graph.Graph, error) { isCrossScope := strings.Join(ak[:len(ak)-1], ".") != strings.Join(ak2[:len(ak2)-1], ".") - if isCrossScope { + if isCrossScope && !includeDescendants { g, err = renameConflictsToParent(g, mk.Key) if err != nil { return nil, err @@ -1546,21 +1546,23 @@ func move(g *d2graph.Graph, key, newKey string) (*d2graph.Graph, error) { // 4. Slice. // -- The key is moving from its current scope out to a less nested scope if isCrossScope { - if len(ida) == 1 { + if len(ida) == 1 || includeDescendants { // 1. Transplant absKey, err := d2parser.ParseKey(ref.ScopeObj.AbsID()) if err != nil { absKey = &d2ast.KeyPath{} } absKey.Path = append(absKey.Path, ref.Key.Path...) - hoistRefChildren(g, absKey, ref) + if !includeDescendants { + hoistRefChildren(g, absKey, ref) + } deleteFromMap(ref.Scope, ref.MapKey) detachedMK := &d2ast.Key{Primary: ref.MapKey.Primary, Key: cloneKey(ref.MapKey.Key)} detachedMK.Key.Path = go2.Filter(detachedMK.Key.Path, func(x *d2ast.StringBox) bool { return x.Unbox().ScalarString() != "_" }) detachedMK.Value = ref.MapKey.Value - if ref.MapKey != nil && ref.MapKey.Value.Map != nil { + if ref.MapKey != nil && ref.MapKey.Value.Map != nil && !includeDescendants { detachedMK.Value.Map = &d2ast.Map{ Range: ref.MapKey.Value.Map.Range, } @@ -1638,9 +1640,11 @@ func move(g *d2graph.Graph, key, newKey string) (*d2graph.Graph, error) { continue } - // When moving a node out of an edge, e.g. the `b` out of `a.b.c -> ...`, - // The edge needs to continue targeting the same thing (c) - if ref.KeyPathIndex != len(ref.Key.Path)-1 { + if includeDescendants { + ref.Key.Path = append(ref.Key.Path[:ref.KeyPathIndex], append(mk2.Key.Path, ref.Key.Path[ref.KeyPathIndex+1:]...)...) + } else if ref.KeyPathIndex != len(ref.Key.Path)-1 { + // When moving a node out of an edge, e.g. the `b` out of `a.b.c -> ...`, + // The edge needs to continue targeting the same thing (c) // Split detachedMK := &d2ast.Key{ Key: cloneKey(ref.Key), @@ -1667,7 +1671,7 @@ func move(g *d2graph.Graph, key, newKey string) (*d2graph.Graph, error) { } } - if err := updateNear(prevG, g, &key, &newKey); err != nil { + if err := updateNear(prevG, g, &key, &newKey, includeDescendants); err != nil { return nil, err } @@ -1742,7 +1746,7 @@ func filterReserved(value d2ast.ValueBox) (with, without d2ast.ValueBox) { // updateNear updates all the Near fields // prevG is the graph before the update (i.e. deletion, rename, move) -func updateNear(prevG, g *d2graph.Graph, from, to *string) error { +func updateNear(prevG, g *d2graph.Graph, from, to *string, includeDescendants bool) error { mk, _ := d2parser.ParseMapKey(*from) if len(mk.Edges) > 0 { return nil @@ -1753,6 +1757,13 @@ func updateNear(prevG, g *d2graph.Graph, from, to *string) error { if len(mk.Key.Path) == 0 { return nil } + + // TODO get rid of repetition + + // Update all the `near` keys that are one level nested + // x: { + // near: z + // } for _, obj := range g.Objects { if obj.Map == nil { continue @@ -1787,7 +1798,7 @@ func updateNear(prevG, g *d2graph.Graph, from, to *string) error { n.MapKey.Value = d2ast.MakeValueBox(d2ast.RawString(v, false)) } } else { - deltas, err := MoveIDDeltas(tmpG, *from, *to) + deltas, err := MoveIDDeltas(tmpG, *from, *to, includeDescendants) if err != nil { return err } @@ -1799,6 +1810,52 @@ func updateNear(prevG, g *d2graph.Graph, from, to *string) error { } } } + + // Update all the `near` keys that are flat (x.near: z) + for _, obj := range g.Objects { + for _, ref := range obj.References { + if ref.MapKey == nil { + continue + } + if ref.MapKey.Key == nil { + continue + } + if len(ref.MapKey.Key.Path) == 0 { + continue + } + if ref.MapKey.Key.Path[len(ref.MapKey.Key.Path)-1].Unbox().ScalarString() == "near" { + k := ref.MapKey.Value.ScalarBox().Unbox().ScalarString() + if strings.EqualFold(k, *from) && to == nil { + deleteFromMap(obj.Map, ref.MapKey) + } else { + valueMK, err := d2parser.ParseMapKey(k) + if err != nil { + return err + } + tmpG, _ := recompile(prevG) + appendMapKey(tmpG.AST, valueMK) + if to == nil { + deltas, err := DeleteIDDeltas(tmpG, *from) + if err != nil { + return err + } + if v, ok := deltas[k]; ok { + ref.MapKey.Value = d2ast.MakeValueBox(d2ast.RawString(v, false)) + } + } else { + deltas, err := MoveIDDeltas(tmpG, *from, *to, includeDescendants) + if err != nil { + return err + } + if v, ok := deltas[k]; ok { + ref.MapKey.Value = d2ast.MakeValueBox(d2ast.RawString(v, false)) + } + } + } + } + } + } + return nil } @@ -2094,7 +2151,7 @@ func edgeTrimCommon(mk *d2ast.Key) { } } -func MoveIDDeltas(g *d2graph.Graph, key, newKey string) (deltas map[string]string, err error) { +func MoveIDDeltas(g *d2graph.Graph, key, newKey string, includeDescendants bool) (deltas map[string]string, err error) { defer xdefer.Errorf(&err, "failed to get deltas for move from %#v to %#v", key, newKey) deltas = make(map[string]string) @@ -2143,48 +2200,50 @@ func MoveIDDeltas(g *d2graph.Graph, key, newKey string) (deltas map[string]strin } } - for _, ch := range obj.ChildrenArray { - chMK, err := d2parser.ParseMapKey(ch.AbsID()) - if err != nil { - return nil, err - } - ida := d2graph.Key(chMK.Key) - if ida[len(ida)-1] == ida[len(ida)-2] { - continue - } - - hoistedAbsID := ch.ID - if obj.Parent != g.Root { - hoistedAbsID = obj.Parent.AbsID() + "." + ch.ID - } - hoistedMK, err := d2parser.ParseMapKey(hoistedAbsID) - if err != nil { - return nil, err - } - - conflictsWithNewID := false - for _, id := range newIDs { - if id == d2format.Format(hoistedMK.Key) { - conflictsWithNewID = true - break - } - } - - if _, ok := g.Root.HasChild(d2graph.Key(hoistedMK.Key)); ok || conflictsWithNewID { - newKey, _, err := generateUniqueKey(g, hoistedAbsID, ignored, newIDs) + if !includeDescendants { + for _, ch := range obj.ChildrenArray { + chMK, err := d2parser.ParseMapKey(ch.AbsID()) if err != nil { return nil, err } - newMK, err := d2parser.ParseMapKey(newKey) + ida := d2graph.Key(chMK.Key) + if ida[len(ida)-1] == ida[len(ida)-2] { + continue + } + + hoistedAbsID := ch.ID + if obj.Parent != g.Root { + hoistedAbsID = obj.Parent.AbsID() + "." + ch.ID + } + hoistedMK, err := d2parser.ParseMapKey(hoistedAbsID) if err != nil { return nil, err } - newAK := d2graph.Key(newMK.Key) - conflictOldIDs[ch] = ch.ID - conflictNewIDs[ch] = newAK[len(newAK)-1] - newIDs = append(newIDs, d2format.Format(newMK.Key)) - } else { - newIDs = append(newIDs, d2format.Format(hoistedMK.Key)) + + conflictsWithNewID := false + for _, id := range newIDs { + if id == d2format.Format(hoistedMK.Key) { + conflictsWithNewID = true + break + } + } + + if _, ok := g.Root.HasChild(d2graph.Key(hoistedMK.Key)); ok || conflictsWithNewID { + newKey, _, err := generateUniqueKey(g, hoistedAbsID, ignored, newIDs) + if err != nil { + return nil, err + } + newMK, err := d2parser.ParseMapKey(newKey) + if err != nil { + return nil, err + } + newAK := d2graph.Key(newMK.Key) + conflictOldIDs[ch] = ch.ID + conflictNewIDs[ch] = newAK[len(newAK)-1] + newIDs = append(newIDs, d2format.Format(newMK.Key)) + } else { + newIDs = append(newIDs, d2format.Format(hoistedMK.Key)) + } } } } @@ -2226,7 +2285,7 @@ func MoveIDDeltas(g *d2graph.Graph, key, newKey string) (deltas map[string]strin id := ak2[len(ak2)-1] tmpRenames := func() func() { - if isCrossScope { + if isCrossScope && !includeDescendants { for _, ch := range obj.ChildrenArray { ch.Parent = obj.Parent } @@ -2246,7 +2305,7 @@ func MoveIDDeltas(g *d2graph.Graph, key, newKey string) (deltas map[string]strin obj.ID = beforeObjID obj.Parent = prevParent - if isCrossScope { + if isCrossScope && !includeDescendants { for _, ch := range obj.ChildrenArray { ch.Parent = obj } diff --git a/d2oracle/edit_test.go b/d2oracle/edit_test.go index 6c5c4a070..0397bcefe 100644 --- a/d2oracle/edit_test.go +++ b/d2oracle/edit_test.go @@ -2234,9 +2234,10 @@ func TestMove(t *testing.T) { skip bool name string - text string - key string - newKey string + text string + key string + newKey string + includeDescendants bool expErr string exp string @@ -2958,7 +2959,7 @@ y newKey: `x.y`, exp: `x: { - near: x.y + near: y y } `, @@ -2988,6 +2989,22 @@ y a: { y } +`, + }, + { + name: "flat_near", + + text: `x.near: y +a +y +`, + key: `y`, + newKey: `a.y`, + + exp: `x.near: a.y +a: { + y +} `, }, { @@ -3851,6 +3868,186 @@ Square: "" Square 3: { Square 2: "" } +`, + }, + { + name: "include_descendants_flat", + text: `x.y +z +`, + key: `x`, + newKey: `z.x`, + includeDescendants: true, + + exp: `z: { + x.y +} +`, + }, + { + name: "include_descendants_map", + text: `x: { + y +} +z +`, + key: `x`, + newKey: `z.x`, + includeDescendants: true, + + exp: `z: { + x: { + y + } +} +`, + }, + { + name: "include_descendants_grandchild", + text: `x: { + y.a + y: { + b + } +} +z +`, + key: `x`, + newKey: `z.x`, + includeDescendants: true, + + exp: `z: { + x: { + y.a + y: { + b + } + } +} +`, + }, + { + name: "include_descendants_sql", + text: `x: { + shape: sql_table + a: b +} +z +`, + key: `x`, + newKey: `z.x`, + includeDescendants: true, + + exp: `z: { + x: { + shape: sql_table + a: b + } +} +`, + }, + { + name: "include_descendants_edge_child", + text: `x: { + a -> b +} +z +`, + key: `x`, + newKey: `z.x`, + includeDescendants: true, + + exp: `z: { + x: { + a -> b + } +} +`, + }, + { + name: "include_descendants_edge_ref", + text: `x +z +x.a -> x.b +`, + key: `x`, + newKey: `z.x`, + includeDescendants: true, + + exp: `z: { + x +} +z.x.a -> z.x.b +`, + }, + { + name: "include_descendants_edge_ref_underscore", + text: `x +z +x.a -> x.b +b: { + _.x.a -> _.x.b +} +`, + key: `x`, + newKey: `z.x`, + includeDescendants: true, + + exp: `z: { + x +} +z.x.a -> z.x.b +b: { + _.z.x.a -> _.z.x.b +} +`, + }, + { + name: "include_descendants_near", + text: `x.y +z +a.near: x.y +`, + key: `x`, + newKey: `z.x`, + includeDescendants: true, + + exp: `z: { + x.y +} +a.near: z.x.y +`, + }, + { + name: "include_descendants_conflict", + text: `x.y +z.x +`, + key: `x`, + newKey: `z.x`, + includeDescendants: true, + + exp: `z: { + x + x 2.y +} +`, + }, + { + name: "include_descendants_non_conflict", + text: `x.y +z.x +y +`, + key: `x`, + newKey: `z.x`, + includeDescendants: true, + + exp: `z: { + x + x 2.y +} +y `, }, } @@ -3868,7 +4065,7 @@ Square 3: { testFunc: func(g *d2graph.Graph) (*d2graph.Graph, error) { objectsBefore := len(g.Objects) var err error - g, err = d2oracle.Move(g, tc.key, tc.newKey) + g, err = d2oracle.Move(g, tc.key, tc.newKey, tc.includeDescendants) if err == nil { objectsAfter := len(g.Objects) if objectsBefore != objectsAfter { @@ -5832,9 +6029,10 @@ func TestMoveIDDeltas(t *testing.T) { testCases := []struct { name string - text string - key string - newKey string + text string + key string + newKey string + includeDescendants bool exp string expErr string @@ -6039,6 +6237,86 @@ y "x 3": "y.x 3", "x 3.x 3": "x 3", "x 3.x 4": "x 5" +}`, + }, + { + name: "include_descendants_flat", + + text: `x.y +z +`, + key: `x`, + newKey: `z.x`, + includeDescendants: true, + + exp: `{ + "x": "z.x", + "x.y": "z.x.y" +}`, + }, + { + name: "include_descendants_map", + + text: `x: { + y +} +z +`, + key: `x`, + newKey: `z.x`, + includeDescendants: true, + + exp: `{ + "x": "z.x", + "x.y": "z.x.y" +}`, + }, + { + name: "include_descendants_conflict", + + text: `x.y +z.x +`, + key: `x`, + newKey: `z.x`, + includeDescendants: true, + + exp: `{ + "x": "z.x 2", + "x.y": "z.x 2.y" +}`, + }, + { + name: "include_descendants_non_conflict", + + text: `x.y +z.x +y +`, + key: `x`, + newKey: `z.x`, + includeDescendants: true, + + exp: `{ + "x": "z.x 2", + "x.y": "z.x 2.y" +}`, + }, + { + name: "include_descendants_sql_table", + + text: `x: { + shape: sql_table + a: b +} +z +`, + key: `x`, + newKey: `z.x`, + includeDescendants: true, + + exp: `{ + "x": "z.x" }`, }, } @@ -6054,7 +6332,7 @@ y t.Fatal(err) } - deltas, err := d2oracle.MoveIDDeltas(g, tc.key, tc.newKey) + deltas, err := d2oracle.MoveIDDeltas(g, tc.key, tc.newKey, tc.includeDescendants) if tc.expErr != "" { if err == nil { t.Fatalf("expected error with: %q", tc.expErr) diff --git a/testdata/d2oracle/TestMove/flat_near.exp.json b/testdata/d2oracle/TestMove/flat_near.exp.json new file mode 100644 index 000000000..817f025d2 --- /dev/null +++ b/testdata/d2oracle/TestMove/flat_near.exp.json @@ -0,0 +1,314 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,0:0:0-4:0:23", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,0:0:0-0:11:11", + "key": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,0:0:0-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,0:2:2-0:6:6", + "value": [ + { + "string": "near", + "raw_string": "near" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,0:8:8-0:11:11", + "value": [ + { + "string": "a.y", + "raw_string": "a.y" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,1:0:12-3:1:22", + "key": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,1:0:12-1:1:13", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,1:0:12-1:1:13", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,1:3:15-3:0:21", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,2:2:19-2:3:20", + "key": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,2:2:19-2:3:20", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,2:2:19-2:3:20", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "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": [ + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,0:0:0-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,0:2:2-0:6:6", + "value": [ + { + "string": "near", + "raw_string": "near" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,0:8:8-0:11:11", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:1:1", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": ",0:2:2-0:3:3", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "a", + "id_val": "a", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,1:0:12-1:1:13", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,1:0:12-1:1:13", + "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": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,2:2:19-2:3:20", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/flat_near.d2,2:2:19-2:3:20", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "y" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + }, + "err": "" +} diff --git a/testdata/d2oracle/TestMove/include_descendants_basic.exp.json b/testdata/d2oracle/TestMove/include_descendants_basic.exp.json new file mode 100644 index 000000000..7b4a5abaf --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_basic.exp.json @@ -0,0 +1,266 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,0:0:0-3:0:13", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,0:0:0-2:1:12", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,0:3:3-2:0:11", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,1:2:7-1:5:10", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,1:2:7-1:5:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,1:4:9-1:5:10", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "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": [ + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "z" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,1:2:7-1:5:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,1:4:9-1:5:10", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,1:2:7-1:5:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_basic.d2,1:4:9-1:5:10", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "y" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + }, + "err": "" +} diff --git a/testdata/d2oracle/TestMove/include_descendants_conflict.exp.json b/testdata/d2oracle/TestMove/include_descendants_conflict.exp.json new file mode 100644 index 000000000..5c70c063b --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_conflict.exp.json @@ -0,0 +1,336 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,0:0:0-4:0:19", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,0:0:0-3:1:18", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,0:3:3-3:0:17", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,1:2:7-1:3:8", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,2:2:11-2:7:16", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,2:2:11-2:7:16", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,2:2:11-2:5:14", + "value": [ + { + "string": "x 2", + "raw_string": "x 2" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,2:6:15-2:7:16", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "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": [ + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "z" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "x 2", + "id_val": "x 2", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,2:2:11-2:7:16", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,2:2:11-2:5:14", + "value": [ + { + "string": "x 2", + "raw_string": "x 2" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,2:6:15-2:7:16", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x 2" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,2:2:11-2:7:16", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,2:2:11-2:5:14", + "value": [ + { + "string": "x 2", + "raw_string": "x 2" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_conflict.d2,2:6:15-2:7:16", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "y" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + }, + "err": "" +} diff --git a/testdata/d2oracle/TestMove/include_descendants_edge.exp.json b/testdata/d2oracle/TestMove/include_descendants_edge.exp.json new file mode 100644 index 000000000..1c0ed8424 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_edge.exp.json @@ -0,0 +1,365 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,0:0:0-5:0:29", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,0:0:0-4:1:28", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,0:3:3-4:0:27", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,1:2:7-3:3:26", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,1:5:10-3:2:25", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,2:4:16-2:10:22", + "edges": [ + { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,2:4:16-2:10:22", + "src": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,2:4:16-2:5:17", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,2:4:16-2:5:17", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,2:9:21-2:10:22", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,2:9:21-2:10:22", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "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": [ + { + "index": 0, + "isCurve": false, + "src_arrow": false, + "dst_arrow": true, + "references": [ + { + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ], + "objects": [ + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "z" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "a", + "id_val": "a", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,2:4:16-2:5:17", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,2:4:16-2:5:17", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "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/d2oracle/TestMove/include_descendants_edge.d2,2:9:21-2:10:22", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge.d2,2:9:21-2:10:22", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + }, + "err": "" +} diff --git a/testdata/d2oracle/TestMove/include_descendants_edge_child.exp.json b/testdata/d2oracle/TestMove/include_descendants_edge_child.exp.json new file mode 100644 index 000000000..8041bc7c9 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_edge_child.exp.json @@ -0,0 +1,365 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,0:0:0-5:0:29", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,0:0:0-4:1:28", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,0:3:3-4:0:27", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,1:2:7-3:3:26", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,1:5:10-3:2:25", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,2:4:16-2:10:22", + "edges": [ + { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,2:4:16-2:10:22", + "src": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,2:4:16-2:5:17", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,2:4:16-2:5:17", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,2:9:21-2:10:22", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,2:9:21-2:10:22", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "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": [ + { + "index": 0, + "isCurve": false, + "src_arrow": false, + "dst_arrow": true, + "references": [ + { + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ], + "objects": [ + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "z" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "a", + "id_val": "a", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,2:4:16-2:5:17", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,2:4:16-2:5:17", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "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/d2oracle/TestMove/include_descendants_edge_child.d2,2:9:21-2:10:22", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_child.d2,2:9:21-2:10:22", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + }, + "err": "" +} diff --git a/testdata/d2oracle/TestMove/include_descendants_edge_ref.exp.json b/testdata/d2oracle/TestMove/include_descendants_edge_ref.exp.json new file mode 100644 index 000000000..3509825c1 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_edge_ref.exp.json @@ -0,0 +1,615 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,0:0:0-4:0:26", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,0:0:0-2:1:10", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,0:3:3-2:0:9", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,1:2:7-1:3:8", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:14:25", + "edges": [ + { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:14:25", + "src": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:5:16", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:1:12", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:2:13-3:3:14", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:4:15-3:5:16", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:9:20-3:14:25", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:9:20-3:10:21", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:11:22-3:12:23", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:13:24-3:14:25", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "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": [ + { + "index": 0, + "isCurve": false, + "src_arrow": false, + "dst_arrow": true, + "references": [ + { + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ], + "objects": [ + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:5:16", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:1:12", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:2:13-3:3:14", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:4:15-3:5:16", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:9:20-3:14:25", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:9:20-3:10:21", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:11:22-3:12:23", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:13:24-3:14:25", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "z" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:5:16", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:1:12", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:2:13-3:3:14", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:4:15-3:5:16", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:9:20-3:14:25", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:9:20-3:10:21", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:11:22-3:12:23", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:13:24-3:14:25", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "a", + "id_val": "a", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:5:16", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:1:12", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:2:13-3:3:14", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:4:15-3:5:16", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 2, + "map_key_edge_index": 0 + } + ], + "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/d2oracle/TestMove/include_descendants_edge_ref.d2,3:9:20-3:14:25", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:9:20-3:10:21", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:11:22-3:12:23", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:13:24-3:14:25", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 2, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + }, + "err": "" +} diff --git a/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.exp.json b/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.exp.json new file mode 100644 index 000000000..6c3f40f55 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.exp.json @@ -0,0 +1,1153 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,0:0:0-7:0:54", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,0:0:0-2:1:10", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,0:3:3-2:0:9", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,1:2:7-1:3:8", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:0:11-3:14:25", + "edges": [ + { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:0:11-3:14:25", + "src": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:0:11-3:5:16", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:0:11-3:1:12", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:2:13-3:3:14", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:4:15-3:5:16", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:9:20-3:14:25", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:9:20-3:10:21", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:11:22-3:12:23", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:13:24-3:14:25", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,4:0:26-6:1:53", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,4:0:26-4:1:27", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,4:0:26-4:1:27", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,4:3:29-6:0:52", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:2:33-5:20:51", + "edges": [ + { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:2:33-5:20:51", + "src": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:2:33-5:9:40", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:2:33-5:3:34", + "value": [ + { + "string": "_", + "raw_string": "_" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:4:35-5:5:36", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:6:37-5:7:38", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:8:39-5:9:40", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:13:44-5:20:51", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:13:44-5:14:45", + "value": [ + { + "string": "_", + "raw_string": "_" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:15:46-5:16:47", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:17:48-5:18:49", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:19:50-5:20:51", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "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": [ + { + "index": 0, + "isCurve": false, + "src_arrow": false, + "dst_arrow": true, + "references": [ + { + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "index": 1, + "isCurve": false, + "src_arrow": false, + "dst_arrow": true, + "references": [ + { + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ], + "objects": [ + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:0:11-3:5:16", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:0:11-3:1:12", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:2:13-3:3:14", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:4:15-3:5:16", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:9:20-3:14:25", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:9:20-3:10:21", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:11:22-3:12:23", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:13:24-3:14:25", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:2:33-5:9:40", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:2:33-5:3:34", + "value": [ + { + "string": "_", + "raw_string": "_" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:4:35-5:5:36", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:6:37-5:7:38", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:8:39-5:9:40", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:13:44-5:20:51", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:13:44-5:14:45", + "value": [ + { + "string": "_", + "raw_string": "_" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:15:46-5:16:47", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:17:48-5:18:49", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:19:50-5:20:51", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "z" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:0:11-3:5:16", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:0:11-3:1:12", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:2:13-3:3:14", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:4:15-3:5:16", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:9:20-3:14:25", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:9:20-3:10:21", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:11:22-3:12:23", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:13:24-3:14:25", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:2:33-5:9:40", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:2:33-5:3:34", + "value": [ + { + "string": "_", + "raw_string": "_" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:4:35-5:5:36", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:6:37-5:7:38", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:8:39-5:9:40", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 2, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:13:44-5:20:51", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:13:44-5:14:45", + "value": [ + { + "string": "_", + "raw_string": "_" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:15:46-5:16:47", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:17:48-5:18:49", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:19:50-5:20:51", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 2, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "a", + "id_val": "a", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:0:11-3:5:16", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:0:11-3:1:12", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:2:13-3:3:14", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:4:15-3:5:16", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 2, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:2:33-5:9:40", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:2:33-5:3:34", + "value": [ + { + "string": "_", + "raw_string": "_" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:4:35-5:5:36", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:6:37-5:7:38", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:8:39-5:9:40", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 3, + "map_key_edge_index": 0 + } + ], + "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/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:9:20-3:14:25", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:9:20-3:10:21", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:11:22-3:12:23", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,3:13:24-3:14:25", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 2, + "map_key_edge_index": 0 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:13:44-5:20:51", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:13:44-5:14:45", + "value": [ + { + "string": "_", + "raw_string": "_" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:15:46-5:16:47", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:17:48-5:18:49", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,5:19:50-5:20:51", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 3, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "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/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,4:0:26-4:1:27", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_underscore.d2,4:0:26-4:1:27", + "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": "" +} diff --git a/testdata/d2oracle/TestMove/include_descendants_flat.exp.json b/testdata/d2oracle/TestMove/include_descendants_flat.exp.json new file mode 100644 index 000000000..77727c65c --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_flat.exp.json @@ -0,0 +1,266 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,0:0:0-3:0:13", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,0:0:0-2:1:12", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,0:3:3-2:0:11", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:2:7-1:5:10", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:2:7-1:5:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:4:9-1:5:10", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "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": [ + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "z" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:2:7-1:5:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:4:9-1:5:10", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:2:7-1:5:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:4:9-1:5:10", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "y" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + }, + "err": "" +} diff --git a/testdata/d2oracle/TestMove/include_descendants_grandchild.exp.json b/testdata/d2oracle/TestMove/include_descendants_grandchild.exp.json new file mode 100644 index 000000000..3c7e78246 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_grandchild.exp.json @@ -0,0 +1,461 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,0:0:0-8:0:49", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,0:0:0-7:1:48", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,0:3:3-7:0:47", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,1:2:7-6:3:46", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,1:5:10-6:2:45", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,2:4:16-2:7:19", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,2:4:16-2:7:19", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,2:4:16-2:5:17", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,2:6:18-2:7:19", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,3:4:24-5:5:42", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,3:4:24-3:5:25", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,3:4:24-3:5:25", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,3:7:27-5:4:41", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,4:6:35-4:7:36", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,4:6:35-4:7:36", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,4:6:35-4:7:36", + "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": [ + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "z" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,2:4:16-2:7:19", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,2:4:16-2:5:17", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,2:6:18-2:7:19", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,3:4:24-3:5:25", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,3:4:24-3:5:25", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "y" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "a", + "id_val": "a", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,2:4:16-2:7:19", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,2:4:16-2:5:17", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,2:6:18-2:7:19", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 1, + "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/d2oracle/TestMove/include_descendants_grandchild.d2,4:6:35-4:7:36", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_grandchild.d2,4:6:35-4:7:36", + "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": "" +} diff --git a/testdata/d2oracle/TestMove/include_descendants_map.exp.json b/testdata/d2oracle/TestMove/include_descendants_map.exp.json new file mode 100644 index 000000000..48fd1df71 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_map.exp.json @@ -0,0 +1,262 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,0:0:0-5:0:24", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,0:0:0-4:1:23", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,0:3:3-4:0:22", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,1:2:7-3:3:21", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,1:5:10-3:2:20", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,2:4:16-2:5:17", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,2:4:16-2:5:17", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,2:4:16-2:5:17", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "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": [ + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "z" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,2:4:16-2:5:17", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,2:4:16-2:5:17", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "y" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + }, + "err": "" +} diff --git a/testdata/d2oracle/TestMove/include_descendants_near.exp.json b/testdata/d2oracle/TestMove/include_descendants_near.exp.json new file mode 100644 index 000000000..95ed643c3 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_near.exp.json @@ -0,0 +1,405 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,0:0:0-4:0:27", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,0:0:0-2:1:12", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,0:3:3-2:0:11", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,1:2:7-1:5:10", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,1:2:7-1:5:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,1:4:9-1:5:10", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,3:0:13-3:13:26", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,3:0:13-3:6:19", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,3:0:13-3:1:14", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,3:2:15-3:6:19", + "value": [ + { + "string": "near", + "raw_string": "near" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,3:8:21-3:13:26", + "value": [ + { + "string": "z.x.y", + "raw_string": "z.x.y" + } + ] + } + } + } + } + ] + }, + "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": [ + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "z" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,1:2:7-1:5:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,1:4:9-1:5:10", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,1:2:7-1:5:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,1:4:9-1:5:10", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "y" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "a", + "id_val": "a", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,3:0:13-3:6:19", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,3:0:13-3:1:14", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,3:2:15-3:6:19", + "value": [ + { + "string": "near", + "raw_string": "near" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "a" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_near.d2,3:8:21-3:13:26", + "path": [ + { + "unquoted_string": { + "range": ",0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": ",0:2:2-0:3:3", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": ",0:4:4-0:5:5", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + }, + "err": "" +} diff --git a/testdata/d2oracle/TestMove/include_descendants_non_conflict.exp.json b/testdata/d2oracle/TestMove/include_descendants_non_conflict.exp.json new file mode 100644 index 000000000..0efe58b19 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_non_conflict.exp.json @@ -0,0 +1,406 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,0:0:0-5:0:21", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,0:0:0-3:1:18", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,0:3:3-3:0:17", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,1:2:7-1:3:8", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,2:2:11-2:7:16", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,2:2:11-2:7:16", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,2:2:11-2:5:14", + "value": [ + { + "string": "x 2", + "raw_string": "x 2" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,2:6:15-2:7:16", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,4:0:19-4:1:20", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,4:0:19-4:1:20", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,4:0:19-4:1:20", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "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": [ + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "z" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "x 2", + "id_val": "x 2", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,2:2:11-2:7:16", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,2:2:11-2:5:14", + "value": [ + { + "string": "x 2", + "raw_string": "x 2" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,2:6:15-2:7:16", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "x 2" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,2:2:11-2:7:16", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,2:2:11-2:5:14", + "value": [ + { + "string": "x 2", + "raw_string": "x 2" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,2:6:15-2:7:16", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "y" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,4:0:19-4:1:20", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_non_conflict.d2,4:0:19-4:1:20", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "y" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + }, + "err": "" +} diff --git a/testdata/d2oracle/TestMove/include_descendants_sql.exp.json b/testdata/d2oracle/TestMove/include_descendants_sql.exp.json new file mode 100644 index 000000000..3daa5414f --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_sql.exp.json @@ -0,0 +1,290 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,0:0:0-6:0:48", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,0:0:0-5:1:47", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,0:3:3-5:0:46", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,1:2:7-4:3:45", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,1:5:10-4:2:44", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,2:4:16-2:20:32", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,2:4:16-2:9:21", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,2:4:16-2:9:21", + "value": [ + { + "string": "shape", + "raw_string": "shape" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,2:11:23-2:20:32", + "value": [ + { + "string": "sql_table", + "raw_string": "sql_table" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,3:4:37-3:8:41", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,3:4:37-3:5:38", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,3:4:37-3:5:38", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,3:7:40-3:8:41", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + } + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "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": [ + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,0:0:0-0:1:1", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "z" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,1:2:7-1:3:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_sql.d2,1:2:7-1:3:8", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "sql_table": { + "columns": [ + { + "name": { + "label": "a", + "fontSize": 0, + "fontFamily": "", + "language": "", + "color": "", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0 + }, + "type": { + "label": "b", + "fontSize": 0, + "fontFamily": "", + "language": "", + "color": "", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0 + }, + "constraint": "", + "reference": "" + } + ] + }, + "attributes": { + "label": { + "value": "x" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "sql_table" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + } + ] + }, + "err": "" +}