From 1af68968833675bebf907b099326cf4e206708d5 Mon Sep 17 00:00:00 2001 From: donglixiaoche Date: Wed, 22 Mar 2023 12:12:04 +0800 Subject: [PATCH] fix: revert near_bad_connected compile_test --- d2compiler/compile_test.go | 11 +++++++++++ .../TestCompile/near_bad_connected.exp.json | 12 ++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 testdata/d2compiler/TestCompile/near_bad_connected.exp.json diff --git a/d2compiler/compile_test.go b/d2compiler/compile_test.go index 122ea4874..a7d40329e 100644 --- a/d2compiler/compile_test.go +++ b/d2compiler/compile_test.go @@ -1524,6 +1524,17 @@ d2/testdata/d2compiler/TestCompile/near-invalid.d2:14:9: near keys cannot be set `, expErr: `d2/testdata/d2compiler/TestCompile/near_bad_constant.d2:1:9: near key "txop-center" must be the absolute path to a shape or one of the following constants: top-left, top-center, top-right, center-left, center-right, bottom-left, bottom-center, bottom-right`, }, + { + name: "near_bad_connected", + + text: ` + x: { + near: top-center + } + x -> y + `, + expErr: `d2/testdata/d2compiler/TestCompile/near_bad_connected.d2:2:9: constant near keys cannot be set on connected shapes`, + }, { name: "nested_near_constant", diff --git a/testdata/d2compiler/TestCompile/near_bad_connected.exp.json b/testdata/d2compiler/TestCompile/near_bad_connected.exp.json new file mode 100644 index 000000000..76c9d6301 --- /dev/null +++ b/testdata/d2compiler/TestCompile/near_bad_connected.exp.json @@ -0,0 +1,12 @@ +{ + "graph": null, + "err": { + "ioerr": null, + "errs": [ + { + "range": "d2/testdata/d2compiler/TestCompile/near_bad_connected.d2,1:8:13-1:18:23", + "errmsg": "d2/testdata/d2compiler/TestCompile/near_bad_connected.d2:2:9: constant near keys cannot be set on connected shapes" + } + ] + } +}