diff --git a/d2ir/import_test.go b/d2ir/import_test.go index 05c95aafb..e53f4daed 100644 --- a/d2ir/import_test.go +++ b/d2ir/import_test.go @@ -10,50 +10,50 @@ func testCompileImports(t *testing.T) { t.Parallel() tca := []testCase{ - { - name: "value", - run: func(t testing.TB) { - m, err := compileFS(t, "index.d2", map[string]string{ - "index.d2": "x: @x.d2", - "x.d2": `shape: circle + { + name: "value", + run: func(t testing.TB) { + m, err := compileFS(t, "index.d2", map[string]string{ + "index.d2": "x: @x.d2", + "x.d2": `shape: circle label: meow`, - }) - assert.Success(t, err) - assertQuery(t, m, 3, 0, nil, "") - assertQuery(t, m, 2, 0, nil, "x") - assertQuery(t, m, 0, 0, "circle", "x.shape") - assertQuery(t, m, 0, 0, "meow", "x.label") - }, - }, - { - name: "nested", - run: func(t testing.TB) { - m, err := compileFS(t, "index.d2", map[string]string{ - "index.d2": "x: @x.y", - "x.d2": `y: { + }) + assert.Success(t, err) + assertQuery(t, m, 3, 0, nil, "") + assertQuery(t, m, 2, 0, nil, "x") + assertQuery(t, m, 0, 0, "circle", "x.shape") + assertQuery(t, m, 0, 0, "meow", "x.label") + }, + }, + { + name: "nested", + run: func(t testing.TB) { + m, err := compileFS(t, "index.d2", map[string]string{ + "index.d2": "x: @x.y", + "x.d2": `y: { shape: circle label: meow }`, - }) - assert.Success(t, err) - assertQuery(t, m, 3, 0, nil, "") - assertQuery(t, m, 2, 0, nil, "x") - assertQuery(t, m, 0, 0, "circle", "x.shape") - assertQuery(t, m, 0, 0, "meow", "x.label") - }, - }, - { - name: "spread", - run: func(t testing.TB) { - m, err := compileFS(t, "index.d2", map[string]string{ - "index.d2": "...@x.d2", - "x.d2": "x: wowa", - }) - assert.Success(t, err) - assertQuery(t, m, 1, 0, nil, "") - assertQuery(t, m, 0, 0, "wowa", "x") - }, - }, + }) + assert.Success(t, err) + assertQuery(t, m, 3, 0, nil, "") + assertQuery(t, m, 2, 0, nil, "x") + assertQuery(t, m, 0, 0, "circle", "x.shape") + assertQuery(t, m, 0, 0, "meow", "x.label") + }, + }, + { + name: "spread", + run: func(t testing.TB) { + m, err := compileFS(t, "index.d2", map[string]string{ + "index.d2": "...@x.d2", + "x.d2": "x: wowa", + }) + assert.Success(t, err) + assertQuery(t, m, 1, 0, nil, "") + assertQuery(t, m, 0, 0, "wowa", "x") + }, + }, } runa(t, tca) diff --git a/d2parser/parse.go b/d2parser/parse.go index b13d1609f..efa1e2e06 100644 --- a/d2parser/parse.go +++ b/d2parser/parse.go @@ -59,7 +59,7 @@ func Parse(path string, r io.RuneReader, opts *ParseOptions) (*d2ast.Map, error) func ParseKey(key string) (*d2ast.KeyPath, error) { p := &parser{ reader: strings.NewReader(key), - err: &ParseError{}, + err: &ParseError{}, } k := p.parseKey() @@ -75,7 +75,7 @@ func ParseKey(key string) (*d2ast.KeyPath, error) { func ParseMapKey(mapKey string) (*d2ast.Key, error) { p := &parser{ reader: strings.NewReader(mapKey), - err: &ParseError{}, + err: &ParseError{}, } mk := p.parseMapKey() @@ -91,7 +91,7 @@ func ParseMapKey(mapKey string) (*d2ast.Key, error) { func ParseValue(value string) (d2ast.Value, error) { p := &parser{ reader: strings.NewReader(value), - err: &ParseError{}, + err: &ParseError{}, } v := p.parseValue() diff --git a/go.sum b/go.sum index 83097b0cd..545957784 100644 --- a/go.sum +++ b/go.sum @@ -329,10 +329,6 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -oss.terrastruct.com/util-go v0.0.0-20230320053557-dcb5aac7d972 h1:HS7fg2GzGsqRLApsoh7ztaLMvXzxSln/Hfz4wy4tIDA= -oss.terrastruct.com/util-go v0.0.0-20230320053557-dcb5aac7d972/go.mod h1:eMWv0sOtD9T2RUl90DLWfuShZCYp4NrsqNpI8eqO6U4= -oss.terrastruct.com/util-go v0.0.0-20230604220107-5ffc52e2e534 h1:6RWrCAg2bzrmGCXd063nkqaHYJHd3KiN3lVfchm4o5I= -oss.terrastruct.com/util-go v0.0.0-20230604220107-5ffc52e2e534/go.mod h1:eMWv0sOtD9T2RUl90DLWfuShZCYp4NrsqNpI8eqO6U4= oss.terrastruct.com/util-go v0.0.0-20230604222829-11c3c60fec14 h1:oy5vtt6O2qYxeSpqWhyevrdUenFfuhphixozUlpL6qY= oss.terrastruct.com/util-go v0.0.0-20230604222829-11c3c60fec14/go.mod h1:eMWv0sOtD9T2RUl90DLWfuShZCYp4NrsqNpI8eqO6U4= rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4=