From bb465277c570f2acb6f171f58f1517e44cc3a1d3 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Mon, 8 May 2023 12:59:39 -0700 Subject: [PATCH] fix move container --- d2oracle/edit.go | 94 ++- d2oracle/edit_test.go | 235 ++++++- ...> include_descendants_edge_ref_1.exp.json} | 92 +-- .../include_descendants_edge_ref_2.exp.json | 283 +++++++++ .../include_descendants_edge_ref_3.exp.json | 363 +++++++++++ .../include_descendants_edge_ref_4.exp.json | 508 +++++++++++++++ .../include_descendants_edge_ref_5.exp.json | 584 ++++++++++++++++++ ...on => include_descendants_flat_1.exp.json} | 34 +- .../include_descendants_flat_2.exp.json | 389 ++++++++++++ .../include_descendants_flat_3.exp.json | 383 ++++++++++++ .../include_descendants_flat_4.exp.json | 383 ++++++++++++ ...son => include_descendants_map_1.exp.json} | 36 +- .../include_descendants_map_2.exp.json | 492 +++++++++++++++ .../include_descendants_nested_1.exp.json | 256 ++++++++ .../include_descendants_nested_2.exp.json | 309 +++++++++ 15 files changed, 4336 insertions(+), 105 deletions(-) rename testdata/d2oracle/TestMove/{include_descendants_edge_ref.exp.json => include_descendants_edge_ref_1.exp.json} (89%) create mode 100644 testdata/d2oracle/TestMove/include_descendants_edge_ref_2.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_edge_ref_3.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_edge_ref_4.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_edge_ref_5.exp.json rename testdata/d2oracle/TestMove/{include_descendants_flat.exp.json => include_descendants_flat_1.exp.json} (91%) create mode 100644 testdata/d2oracle/TestMove/include_descendants_flat_2.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_flat_3.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_flat_4.exp.json rename testdata/d2oracle/TestMove/{include_descendants_map.exp.json => include_descendants_map_1.exp.json} (90%) create mode 100644 testdata/d2oracle/TestMove/include_descendants_map_2.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_nested_1.exp.json create mode 100644 testdata/d2oracle/TestMove/include_descendants_nested_2.exp.json diff --git a/d2oracle/edit.go b/d2oracle/edit.go index ca15bbc72..e5ba39edc 100644 --- a/d2oracle/edit.go +++ b/d2oracle/edit.go @@ -1546,7 +1546,7 @@ func move(g *d2graph.Graph, key, newKey string, includeDescendants bool) (*d2gra // 4. Slice. // -- The key is moving from its current scope out to a less nested scope if isCrossScope { - if len(ida) == 1 || includeDescendants { + if (!includeDescendants && len(ida) == 1) || (includeDescendants && ref.KeyPathIndex == 0) { // 1. Transplant absKey, err := d2parser.ParseKey(ref.ScopeObj.AbsID()) if err != nil { @@ -1583,19 +1583,28 @@ func move(g *d2graph.Graph, key, newKey string, includeDescendants bool) (*d2gra } appendUniqueMapKey(toScope, detachedMK) - } else if len(ida) > 1 && (!isExplicit || go2.Contains(mostNestedRefs, ref)) { + } else if ((!includeDescendants && len(ida) > 1) || (includeDescendants && ref.KeyPathIndex > 0)) && (!isExplicit || go2.Contains(mostNestedRefs, ref)) { // 2. Split detachedMK := &d2ast.Key{Key: cloneKey(ref.MapKey.Key)} - detachedMK.Key.Path = []*d2ast.StringBox{ref.Key.Path[ref.KeyPathIndex]} + if includeDescendants { + detachedMK.Key.Path = append([]*d2ast.StringBox{}, ref.Key.Path[ref.KeyPathIndex:]...) + } else { + detachedMK.Key.Path = []*d2ast.StringBox{ref.Key.Path[ref.KeyPathIndex]} + } if ref.KeyPathIndex == len(ref.Key.Path)-1 { withReserved, withoutReserved := filterReserved(ref.MapKey.Value) detachedMK.Value = withReserved ref.MapKey.Value = withoutReserved } - ref.Key.Path = append(ref.Key.Path[:ref.KeyPathIndex], ref.Key.Path[ref.KeyPathIndex+1:]...) + if includeDescendants { + ref.Key.Path = ref.Key.Path[:ref.KeyPathIndex] + } else { + ref.Key.Path = append(ref.Key.Path[:ref.KeyPathIndex], ref.Key.Path[ref.KeyPathIndex+1:]...) + } appendUniqueMapKey(toScope, detachedMK) } else if len(getCommonPath(ak, ak2)) > 0 { // 3. Extend + // This case does not make sense for includeDescendants newKeyPath := ref.Key.Path[:ref.KeyPathIndex] newKeyPath = append(newKeyPath, mk2.Key.Path[len(getCommonPath(ak, ak2)):]...) ref.Key.Path = append(newKeyPath, ref.Key.Path[ref.KeyPathIndex+1:]...) @@ -1640,34 +1649,67 @@ func move(g *d2graph.Graph, key, newKey string, includeDescendants bool) (*d2gra continue } - 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 { + 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), } - detachedMK.Key.Path = []*d2ast.StringBox{ref.Key.Path[ref.KeyPathIndex]} - appendUniqueMapKey(toScope, detachedMK) - - ref.Key.Path = append(ref.Key.Path[:ref.KeyPathIndex], ref.Key.Path[ref.KeyPathIndex+1:]...) - } else { - // When moving a node connected to an edge, we have to ensure parents continue to exist - // e.g. the `c` out of `a.b.c -> ...` - // `a.b` needs to exist - if len(go2.Filter(ref.Key.Path, func(x *d2ast.StringBox) bool { return x.Unbox().ScalarString() != "_" })) > 1 { - detachedK := cloneKey(ref.Key) - detachedK.Path = detachedK.Path[:len(detachedK.Path)-1] - ensureNode(g, refEdges, ref.ScopeObj, ref.Scope, ref.MapKey, detachedK, false) + oldPath, err := pathFromScope(g, mk, ref.ScopeObj) + if err != nil { + return nil, err } - newPath, err := pathFromScope(g, mk2, ref.ScopeObj) if err != nil { return nil, err } - ref.Key.Path = newPath + if includeDescendants { + // When including descendants, the only thing that gets dropped, if any, is the uncommon leading path of new key and key + // E.g. when moving `a.b` to `x.b` with edge ref key of `a.b.c`, then changing it to `x.b.c` will drop `a` + diff := len(oldPath) - len(newPath) + // Only need to check uncommon path if the lengths are the same + if diff == 0 { + diff = len(getUncommonPath(d2graph.Key(&d2ast.KeyPath{Path: oldPath}), d2graph.Key(&d2ast.KeyPath{Path: newPath}))) + } + // If the old key is longer than the new key, we already know all the diff would be dropped + if diff > 0 { + detachedMK.Key.Path = append([]*d2ast.StringBox{}, ref.Key.Path[ref.KeyPathIndex-diff:ref.KeyPathIndex]...) + appendUniqueMapKey(ref.Scope, detachedMK) + } + } else { + detachedMK.Key.Path = []*d2ast.StringBox{ref.Key.Path[ref.KeyPathIndex]} + appendUniqueMapKey(toScope, detachedMK) + } + + if includeDescendants { + ref.Key.Path = append(ref.Key.Path[:ref.KeyPathIndex-len(oldPath)+1], append(newPath, ref.Key.Path[ref.KeyPathIndex+1:]...)...) + } else { + ref.Key.Path = append(ref.Key.Path[:ref.KeyPathIndex], ref.Key.Path[ref.KeyPathIndex+1:]...) + } + } else { + // When moving a node connected to an edge, we have to ensure parents continue to exist + // e.g. the `c` out of `a.b.c -> ...` + // `a.b` needs to exist + newPath, err := pathFromScope(g, mk2, ref.ScopeObj) + if err != nil { + return nil, err + } + if len(go2.Filter(ref.Key.Path, func(x *d2ast.StringBox) bool { return x.Unbox().ScalarString() != "_" })) > 1 { + detachedK := cloneKey(ref.Key) + if includeDescendants { + detachedK.Path = detachedK.Path[:len(detachedK.Path)-len(newPath)] + } else { + detachedK.Path = detachedK.Path[:len(detachedK.Path)-1] + } + ensureNode(g, refEdges, ref.ScopeObj, ref.Scope, ref.MapKey, detachedK, false) + } + + if includeDescendants { + ref.Key.Path = append(ref.Key.Path[:ref.KeyPathIndex-1], append(newPath, ref.Key.Path[ref.KeyPathIndex+len(newPath):]...)...) + } else { + ref.Key.Path = newPath + } } } @@ -2133,6 +2175,16 @@ func getCommonPath(a, b []string) []string { return out } +func getUncommonPath(a, b []string) []string { + var out []string + for i := 0; i < len(a) && i < len(b); i++ { + if a[i] != b[i] { + out = a[:i+1] + } + } + return out +} + func edgeTrimCommon(mk *d2ast.Key) { if len(mk.Edges) != 1 { return diff --git a/d2oracle/edit_test.go b/d2oracle/edit_test.go index 0397bcefe..b13ed7d51 100644 --- a/d2oracle/edit_test.go +++ b/d2oracle/edit_test.go @@ -3871,7 +3871,7 @@ Square 3: { `, }, { - name: "include_descendants_flat", + name: "include_descendants_flat_1", text: `x.y z `, @@ -3885,7 +3885,50 @@ z `, }, { - name: "include_descendants_map", + name: "include_descendants_flat_2", + text: `a.x.y +a.z +`, + key: `a.x`, + newKey: `a.z.x`, + includeDescendants: true, + + exp: `a +a.z: { + x.y +} +`, + }, + { + name: "include_descendants_flat_3", + text: `a.x.y +a.z +`, + key: `a.x`, + newKey: `x`, + includeDescendants: true, + + exp: `a +a.z +x.y +`, + }, + { + name: "include_descendants_flat_4", + text: `a.x.y +a.z +`, + key: `a.x.y`, + newKey: `y`, + includeDescendants: true, + + exp: `a.x +a.z +y +`, + }, + { + name: "include_descendants_map_1", text: `x: { y } @@ -3900,6 +3943,30 @@ z y } } +`, + }, + { + name: "include_descendants_map_2", + text: `x: { + y: { + c + } + y.b +} +x.y.b +z +`, + key: `x.y`, + newKey: `a`, + includeDescendants: true, + + exp: `x +x +z +a: { + c +} +a.b `, }, { @@ -3965,7 +4032,7 @@ z `, }, { - name: "include_descendants_edge_ref", + name: "include_descendants_edge_ref_1", text: `x z x.a -> x.b @@ -3978,6 +4045,92 @@ x.a -> x.b x } z.x.a -> z.x.b +`, + }, + { + name: "include_descendants_edge_ref_2", + text: `x -> y.z +`, + key: `y.z`, + newKey: `z`, + includeDescendants: true, + + exp: `x -> z +y +`, + }, + { + name: "include_descendants_edge_ref_3", + text: `x -> y.z.a +`, + key: `y.z`, + newKey: `z`, + includeDescendants: true, + + exp: `x -> z.a +y +`, + }, + { + name: "include_descendants_edge_ref_4", + text: `x -> y.z.a +b +`, + key: `y.z`, + newKey: `b.z`, + includeDescendants: true, + + exp: `x -> b.z.a +b +y +`, + }, + { + name: "include_descendants_edge_ref_5", + text: `foo: { + x -> y.z.a + b +} +`, + key: `foo.y.z`, + newKey: `foo.b.z`, + includeDescendants: true, + + exp: `foo: { + x -> b.z.a + b + y +} +`, + }, + { + name: "include_descendants_nested_1", + text: `y.z +b +`, + key: `y.z`, + newKey: `b.z`, + includeDescendants: true, + + exp: `y +b: { + z +} +`, + }, + { + name: "include_descendants_nested_2", + text: `y.z +y.b +`, + key: `y.z`, + newKey: `y.b.z`, + includeDescendants: true, + + exp: `y +y.b: { + z +} `, }, { @@ -6300,6 +6453,82 @@ y exp: `{ "x": "z.x 2", "x.y": "z.x 2.y" +}`, + }, + { + name: "include_descendants_edge_ref", + text: `x -> y.z +`, + key: `y.z`, + newKey: `z`, + includeDescendants: true, + + exp: `{ + "(x -> y.z)[0]": "(x -> z)[0]", + "y.z": "z" +}`, + }, + { + name: "include_descendants_edge_ref_2", + text: `x -> y.z +`, + key: `y.z`, + newKey: `z`, + includeDescendants: true, + + exp: `{ + "(x -> y.z)[0]": "(x -> z)[0]", + "y.z": "z" +}`, + }, + { + name: "include_descendants_edge_ref_3", + text: `x -> y.z.a +`, + key: `y.z`, + newKey: `z`, + includeDescendants: true, + + exp: `{ + "(x -> y.z.a)[0]": "(x -> z.a)[0]", + "y.z": "z", + "y.z.a": "z.a" +}`, + }, + { + name: "include_descendants_edge_ref_4", + text: `x -> y.z.a +b +`, + key: `y.z`, + newKey: `b.z`, + includeDescendants: true, + + exp: `{ + "(x -> y.z.a)[0]": "(x -> b.z.a)[0]", + "y.z": "b.z", + "y.z.a": "b.z.a" +}`, + }, + { + 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: `{ + "x": "z.x", + "x.(a -> b)[0]": "z.x.(a -> b)[0]", + "x.(a -> b)[1]": "z.x.(a -> b)[1]", + "x.a": "z.x.a", + "x.b": "z.x.b" }`, }, { diff --git a/testdata/d2oracle/TestMove/include_descendants_edge_ref.exp.json b/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.exp.json similarity index 89% rename from testdata/d2oracle/TestMove/include_descendants_edge_ref.exp.json rename to testdata/d2oracle/TestMove/include_descendants_edge_ref_1.exp.json index 3509825c1..fcaf3d582 100644 --- a/testdata/d2oracle/TestMove/include_descendants_edge_ref.exp.json +++ b/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.exp.json @@ -3,17 +3,17 @@ "name": "", "isFolderOnly": false, "ast": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,0:0:0-4:0:26", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,0:0:0-2:1:10", "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,0:0:0-0:1:1", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,0:0:0-0:1:1", "value": [ { "string": "z", @@ -27,17 +27,17 @@ "primary": {}, "value": { "map": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,0:3:3-2:0:9", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,1:2:7-1:3:8", "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,1:2:7-1:3:8", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,1:2:7-1:3:8", "value": [ { "string": "x", @@ -59,16 +59,16 @@ }, { "map_key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:14:25", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:0:11-3:14:25", "edges": [ { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:14:25", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:0:11-3:14:25", "src": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:5:16", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:0:11-3:1:12", "value": [ { "string": "z", @@ -79,7 +79,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:2:13-3:3:14", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:2:13-3:3:14", "value": [ { "string": "x", @@ -90,7 +90,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:4:15-3:5:16", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:4:15-3:5:16", "value": [ { "string": "a", @@ -103,11 +103,11 @@ }, "src_arrow": "", "dst": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:9:20-3:14:25", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:9:20-3:10:21", "value": [ { "string": "z", @@ -118,7 +118,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:11:22-3:12:23", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:11:22-3:12:23", "value": [ { "string": "x", @@ -129,7 +129,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:13:24-3:14:25", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:13:24-3:14:25", "value": [ { "string": "b", @@ -215,11 +215,11 @@ "references": [ { "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,0:0:0-0:1:1", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,0:0:0-0:1:1", "value": [ { "string": "z", @@ -235,11 +235,11 @@ }, { "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:5:16", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:0:11-3:1:12", "value": [ { "string": "z", @@ -250,7 +250,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:2:13-3:3:14", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:2:13-3:3:14", "value": [ { "string": "x", @@ -261,7 +261,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:4:15-3:5:16", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:4:15-3:5:16", "value": [ { "string": "a", @@ -277,11 +277,11 @@ }, { "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:9:20-3:14:25", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:9:20-3:10:21", "value": [ { "string": "z", @@ -292,7 +292,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:11:22-3:12:23", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:11:22-3:12:23", "value": [ { "string": "x", @@ -303,7 +303,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:13:24-3:14:25", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:13:24-3:14:25", "value": [ { "string": "b", @@ -346,11 +346,11 @@ "references": [ { "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,1:2:7-1:3:8", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,1:2:7-1:3:8", "value": [ { "string": "x", @@ -366,11 +366,11 @@ }, { "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:5:16", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:0:11-3:1:12", "value": [ { "string": "z", @@ -381,7 +381,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:2:13-3:3:14", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:2:13-3:3:14", "value": [ { "string": "x", @@ -392,7 +392,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:4:15-3:5:16", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:4:15-3:5:16", "value": [ { "string": "a", @@ -408,11 +408,11 @@ }, { "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:9:20-3:14:25", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:9:20-3:10:21", "value": [ { "string": "z", @@ -423,7 +423,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:11:22-3:12:23", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:11:22-3:12:23", "value": [ { "string": "x", @@ -434,7 +434,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:13:24-3:14:25", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:13:24-3:14:25", "value": [ { "string": "b", @@ -477,11 +477,11 @@ "references": [ { "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:0:11-3:5:16", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:0:11-3:1:12", "value": [ { "string": "z", @@ -492,7 +492,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:2:13-3:3:14", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:2:13-3:3:14", "value": [ { "string": "x", @@ -503,7 +503,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:4:15-3:5:16", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:4:15-3:5:16", "value": [ { "string": "a", @@ -546,11 +546,11 @@ "references": [ { "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:9:20-3:14:25", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:9:20-3:10:21", "value": [ { "string": "z", @@ -561,7 +561,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:11:22-3:12:23", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:11:22-3:12:23", "value": [ { "string": "x", @@ -572,7 +572,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref.d2,3:13:24-3:14:25", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_1.d2,3:13:24-3:14:25", "value": [ { "string": "b", diff --git a/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.exp.json b/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.exp.json new file mode 100644 index 000000000..019333be7 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.exp.json @@ -0,0 +1,283 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,0:0:0-2:0:9", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,0:0:0-0:6:6", + "edges": [ + { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,0:0:0-0:6:6", + "src": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,0:5:5-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,0:5:5-0:6:6", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,1:0:7-1:1:8", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,1:0:7-1:1:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,1:0:7-1:1:8", + "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": [ + { + "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": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "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": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,0:5:5-0:6:6", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,0:5:5-0:6:6", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "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": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,1:0:7-1:1:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_2.d2,1:0:7-1:1:8", + "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_edge_ref_3.exp.json b/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.exp.json new file mode 100644 index 000000000..9cdadea96 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.exp.json @@ -0,0 +1,363 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:0:0-2:0:11", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:0:0-0:8:8", + "edges": [ + { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:0:0-0:8:8", + "src": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:5:5-0:8:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:5:5-0:6:6", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:7:7-0:8:8", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,1:0:9-1:1:10", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,1:0:9-1:1:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,1:0:9-1:1: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": [ + { + "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": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "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": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:5:5-0:8:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:5:5-0:6:6", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:7:7-0:8:8", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "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": "a", + "id_val": "a", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:5:5-0:8:8", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:5:5-0:6:6", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,0:7:7-0:8:8", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 1, + "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": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,1:0:9-1:1:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_3.d2,1:0:9-1:1:10", + "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_edge_ref_4.exp.json b/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.exp.json new file mode 100644 index 000000000..1a4a2ff4d --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.exp.json @@ -0,0 +1,508 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:0:0-3:0:15", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:0:0-0:10:10", + "edges": [ + { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:0:0-0:10:10", + "src": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:5:5-0:10:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:5:5-0:6:6", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:7:7-0:8:8", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:9:9-0:10:10", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,1:0:11-1:1:12", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,1:0:11-1:1:12", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,1:0:11-1:1:12", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,2:0:13-2:1:14", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,2:0:13-2:1:14", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,2:0:13-2:1:14", + "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": [ + { + "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": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "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": "b", + "id_val": "b", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:5:5-0:10:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:5:5-0:6:6", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:7:7-0:8:8", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:9:9-0:10:10", + "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_4.d2,1:0:11-1:1:12", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,1:0:11-1:1:12", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:5:5-0:10:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:5:5-0:6:6", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:7:7-0:8:8", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:9:9-0:10:10", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "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": "a", + "id_val": "a", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:5:5-0:10:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:5:5-0:6:6", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:7:7-0:8:8", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,0:9:9-0:10:10", + "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": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,2:0:13-2:1:14", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_4.d2,2:0:13-2:1:14", + "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_edge_ref_5.exp.json b/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.exp.json new file mode 100644 index 000000000..283221e09 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.exp.json @@ -0,0 +1,584 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,0:0:0-5:0:30", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,0:0:0-4:1:29", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,0:0:0-0:3:3", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,0:0:0-0:3:3", + "value": [ + { + "string": "foo", + "raw_string": "foo" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,0:5:5-4:0:28", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:2:9-1:12:19", + "edges": [ + { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:2:9-1:12:19", + "src": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:2:9-1:3:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:2:9-1:3:10", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:7:14-1:12:19", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:7:14-1:8:15", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:9:16-1:10:17", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:11:18-1:12:19", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,2:2:22-2:3:23", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,2:2:22-2:3:23", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,2:2:22-2:3:23", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,3:2:26-3:3:27", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,3:2:26-3:3:27", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,3:2:26-3:3:27", + "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": [ + { + "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": "foo", + "id_val": "foo", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,0:0:0-0:3:3", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,0:0:0-0:3:3", + "value": [ + { + "string": "foo", + "raw_string": "foo" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "foo" + }, + "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_5.d2,1:2:9-1:3:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:2:9-1:3:10", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "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": "b", + "id_val": "b", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:7:14-1:12:19", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:7:14-1:8:15", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:9:16-1:10:17", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:11:18-1:12:19", + "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_5.d2,2:2:22-2:3:23", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,2:2:22-2:3:23", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:7:14-1:12:19", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:7:14-1:8:15", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:9:16-1:10:17", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:11:18-1:12:19", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "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": "a", + "id_val": "a", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:7:14-1:12:19", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:7:14-1:8:15", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:9:16-1:10:17", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,1:11:18-1:12:19", + "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": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,3:2:26-3:3:27", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_edge_ref_5.d2,3:2:26-3:3:27", + "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_flat.exp.json b/testdata/d2oracle/TestMove/include_descendants_flat_1.exp.json similarity index 91% rename from testdata/d2oracle/TestMove/include_descendants_flat.exp.json rename to testdata/d2oracle/TestMove/include_descendants_flat_1.exp.json index 77727c65c..c7fe1680b 100644 --- a/testdata/d2oracle/TestMove/include_descendants_flat.exp.json +++ b/testdata/d2oracle/TestMove/include_descendants_flat_1.exp.json @@ -3,17 +3,17 @@ "name": "", "isFolderOnly": false, "ast": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,0:0:0-3:0:13", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.d2,0:0:0-2:1:12", "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,0:0:0-0:1:1", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.d2,0:0:0-0:1:1", "value": [ { "string": "z", @@ -27,17 +27,17 @@ "primary": {}, "value": { "map": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,0:3:3-2:0:11", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.d2,1:2:7-1:5:10", "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:2:7-1:5:10", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.d2,1:2:7-1:3:8", "value": [ { "string": "x", @@ -48,7 +48,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:4:9-1:5:10", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.d2,1:4:9-1:5:10", "value": [ { "string": "y", @@ -103,11 +103,11 @@ "references": [ { "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,0:0:0-0:1:1", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.d2,0:0:0-0:1:1", "value": [ { "string": "z", @@ -150,11 +150,11 @@ "references": [ { "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:2:7-1:5:10", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.d2,1:2:7-1:3:8", "value": [ { "string": "x", @@ -165,7 +165,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:4:9-1:5:10", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.d2,1:4:9-1:5:10", "value": [ { "string": "y", @@ -208,11 +208,11 @@ "references": [ { "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:2:7-1:5:10", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.d2,1:2:7-1:3:8", "value": [ { "string": "x", @@ -223,7 +223,7 @@ }, { "unquoted_string": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat.d2,1:4:9-1:5:10", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_1.d2,1:4:9-1:5:10", "value": [ { "string": "y", diff --git a/testdata/d2oracle/TestMove/include_descendants_flat_2.exp.json b/testdata/d2oracle/TestMove/include_descendants_flat_2.exp.json new file mode 100644 index 000000000..6f1a77e95 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_flat_2.exp.json @@ -0,0 +1,389 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,0:0:0-4:0:17", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,0:0:0-0:1:1", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,0:0:0-0:1:1", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,1:0:2-3:1:16", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,1:0:2-1:3:5", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,1:0:2-1:1:3", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,1:2:4-1:3:5", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,1:5:7-3:0:15", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,2:2:11-2:5:14", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,2:2:11-2:5:14", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,2:2:11-2:3:12", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,2:4:13-2:5:14", + "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": "a", + "id_val": "a", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,0:0:0-0:1:1", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,1:0:2-1:3:5", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,1:0:2-1:1:3", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,1:2:4-1:3:5", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "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": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,1:0:2-1:3:5", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,1:0:2-1:1:3", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,1:2:4-1:3:5", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "key_path_index": 1, + "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_2.d2,2:2:11-2:5:14", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,2:2:11-2:3:12", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,2:4:13-2:5:14", + "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_2.d2,2:2:11-2:5:14", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,2:2:11-2:3:12", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_2.d2,2:4:13-2:5:14", + "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_flat_3.exp.json b/testdata/d2oracle/TestMove/include_descendants_flat_3.exp.json new file mode 100644 index 000000000..c808f2c1d --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_flat_3.exp.json @@ -0,0 +1,383 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,0:0:0-3:0:10", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,0:0:0-0:1:1", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,0:0:0-0:1:1", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,1:0:2-1:3:5", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,1:0:2-1:3:5", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,1:0:2-1:1:3", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,1:2:4-1:3:5", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,2:0:6-2:3:9", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,2:0:6-2:3:9", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,2:0:6-2:1:7", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,2:2:8-2:3:9", + "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": "a", + "id_val": "a", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,0:0:0-0:1:1", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,1:0:2-1:3:5", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,1:0:2-1:1:3", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,1:2:4-1:3:5", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "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": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,1:0:2-1:3:5", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,1:0:2-1:1:3", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,1:2:4-1:3:5", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "key_path_index": 1, + "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_3.d2,2:0:6-2:3:9", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,2:0:6-2:1:7", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,2:2:8-2:3:9", + "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_3.d2,2:0:6-2:3:9", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,2:0:6-2:1:7", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_3.d2,2:2:8-2:3:9", + "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_flat_4.exp.json b/testdata/d2oracle/TestMove/include_descendants_flat_4.exp.json new file mode 100644 index 000000000..278b3de45 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_flat_4.exp.json @@ -0,0 +1,383 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,0:0:0-3:0:10", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,0:0:0-0:3:3", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,0:0:0-0:3:3", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,0:0:0-0:1:1", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,0:2:2-0:3:3", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,1:0:4-1:3:7", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,1:0:4-1:3:7", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,1:0:4-1:1:5", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,1:2:6-1:3:7", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,2:0:8-2:1:9", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,2:0:8-2:1:9", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,2:0:8-2:1:9", + "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": "a", + "id_val": "a", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,0:0:0-0:3:3", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,0:0:0-0:1:1", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,0:2:2-0:3:3", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,1:0:4-1:3:7", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,1:0:4-1:1:5", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,1:2:6-1:3:7", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "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": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,0:0:0-0:3:3", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,0:0:0-0:1:1", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,0:2:2-0:3:3", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 1, + "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": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,1:0:4-1:3:7", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,1:0:4-1:1:5", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,1:2:6-1:3:7", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "key_path_index": 1, + "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": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,2:0:8-2:1:9", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_flat_4.d2,2:0:8-2:1:9", + "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_map.exp.json b/testdata/d2oracle/TestMove/include_descendants_map_1.exp.json similarity index 90% rename from testdata/d2oracle/TestMove/include_descendants_map.exp.json rename to testdata/d2oracle/TestMove/include_descendants_map_1.exp.json index 48fd1df71..4ed6904f5 100644 --- a/testdata/d2oracle/TestMove/include_descendants_map.exp.json +++ b/testdata/d2oracle/TestMove/include_descendants_map_1.exp.json @@ -3,17 +3,17 @@ "name": "", "isFolderOnly": false, "ast": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,0:0:0-5:0:24", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.d2,0:0:0-4:1:23", "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,0:0:0-0:1:1", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.d2,0:0:0-0:1:1", "value": [ { "string": "z", @@ -27,17 +27,17 @@ "primary": {}, "value": { "map": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,0:3:3-4:0:22", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.d2,1:2:7-3:3:21", "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,1:2:7-1:3:8", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.d2,1:2:7-1:3:8", "value": [ { "string": "x", @@ -51,17 +51,17 @@ "primary": {}, "value": { "map": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,1:5:10-3:2:20", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.d2,2:4:16-2:5:17", "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,2:4:16-2:5:17", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.d2,2:4:16-2:5:17", "value": [ { "string": "y", @@ -121,11 +121,11 @@ "references": [ { "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,0:0:0-0:1:1", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.d2,0:0:0-0:1:1", "value": [ { "string": "z", @@ -168,11 +168,11 @@ "references": [ { "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,1:2:7-1:3:8", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.d2,1:2:7-1:3:8", "value": [ { "string": "x", @@ -215,11 +215,11 @@ "references": [ { "key": { - "range": "d2/testdata/d2oracle/TestMove/include_descendants_map.d2,2:4:16-2:5:17", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.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", + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_1.d2,2:4:16-2:5:17", "value": [ { "string": "y", diff --git a/testdata/d2oracle/TestMove/include_descendants_map_2.exp.json b/testdata/d2oracle/TestMove/include_descendants_map_2.exp.json new file mode 100644 index 000000000..f142a1f98 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_map_2.exp.json @@ -0,0 +1,492 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,0:0:0-7:0:21", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,0:0:0-0:1:1", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,1:0:2-1:1:3", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,1:0:2-1:1:3", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,1:0:2-1:1:3", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,2:0:4-2:1:5", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,2:0:4-2:1:5", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,2:0:4-2:1:5", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,3:0:6-5:1:16", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,3:0:6-3:1:7", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,3:0:6-3:1:7", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,3:3:9-5:0:15", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,4:2:13-4:3:14", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,4:2:13-4:3:14", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,4:2:13-4:3:14", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,6:0:17-6:3:20", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,6:0:17-6:3:20", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,6:0:17-6:1:18", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,6:2:19-6:3:20", + "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": "x", + "id_val": "x", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,0:0:0-0:1:1", + "value": [ + { + "string": "x", + "raw_string": "x" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,1:0:2-1:1:3", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,1:0:2-1:1:3", + "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": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,2:0:4-2:1:5", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,2:0:4-2:1:5", + "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": "a", + "id_val": "a", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,3:0:6-3:1:7", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,3:0:6-3:1:7", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,6:0:17-6:3:20", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,6:0:17-6:1:18", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,6:2:19-6:3:20", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "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": "c", + "id_val": "c", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,4:2:13-4:3:14", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,4:2:13-4:3:14", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "c" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "b", + "id_val": "b", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,6:0:17-6:3:20", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,6:0:17-6:1:18", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_map_2.d2,6:2:19-6:3:20", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 1, + "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_nested_1.exp.json b/testdata/d2oracle/TestMove/include_descendants_nested_1.exp.json new file mode 100644 index 000000000..c8334c5b0 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_nested_1.exp.json @@ -0,0 +1,256 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,0:0:0-4:0:13", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,0:0:0-0:1:1", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,0:0:0-0:1:1", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,1:0:2-3:1:12", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,1:0:2-1:1:3", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,1:0:2-1:1:3", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,1:3:5-3:0:11", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,2:2:9-2:3:10", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,2:2:9-2:3:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,2:2:9-2:3:10", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "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": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,0:0:0-0:1:1", + "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": "b", + "id_val": "b", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,1:0:2-1:1:3", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,1:0:2-1:1:3", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,2:2:9-2:3:10", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_1.d2,2:2:9-2:3:10", + "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 + } + ] + }, + "err": "" +} diff --git a/testdata/d2oracle/TestMove/include_descendants_nested_2.exp.json b/testdata/d2oracle/TestMove/include_descendants_nested_2.exp.json new file mode 100644 index 000000000..ffcdc9ec2 --- /dev/null +++ b/testdata/d2oracle/TestMove/include_descendants_nested_2.exp.json @@ -0,0 +1,309 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,0:0:0-4:0:15", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,0:0:0-0:1:1", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,0:0:0-0:1:1", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + }, + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,1:0:2-3:1:14", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,1:0:2-1:3:5", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,1:0:2-1:1:3", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,1:2:4-1:3:5", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,1:5:7-3:0:13", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,2:2:11-2:3:12", + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,2:2:11-2:3:12", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,2:2:11-2:3:12", + "value": [ + { + "string": "z", + "raw_string": "z" + } + ] + } + } + ] + }, + "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": "y", + "id_val": "y", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,0:0:0-0:1:1", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,0:0:0-0:1:1", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,1:0:2-1:3:5", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,1:0:2-1:1:3", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,1:2:4-1:3:5", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "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": "b", + "id_val": "b", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,1:0:2-1:3:5", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,1:0:2-1:1:3", + "value": [ + { + "string": "y", + "raw_string": "y" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,1:2:4-1:3:5", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": -1 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": { + "value": "" + } + }, + "zIndex": 0 + }, + { + "id": "z", + "id_val": "z", + "references": [ + { + "key": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,2:2:11-2:3:12", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2oracle/TestMove/include_descendants_nested_2.d2,2:2:11-2:3:12", + "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 + } + ] + }, + "err": "" +}