diff --git a/d2compiler/compile_test.go b/d2compiler/compile_test.go index 78dbd5365..c7c6267da 100644 --- a/d2compiler/compile_test.go +++ b/d2compiler/compile_test.go @@ -610,6 +610,11 @@ x: { expErr: `d2/testdata/d2compiler/TestCompile/md_block_string_err.d2:4:19: unexpected text after md block string. See https://d2lang.com/tour/text#advanced-block-strings. d2/testdata/d2compiler/TestCompile/md_block_string_err.d2:5:1: block string must be terminated with |`, }, + { + name: "no_empty_block_strings", + text: `Text: |md |`, + expErr: `d2/testdata/d2compiler/TestCompile/no_empty_block_strings.d2:1:1: block string cannot be empty`, + }, { name: "underscore_edge_existing", diff --git a/testdata/d2compiler/TestCompile/no_empty_block_strings.exp.json b/testdata/d2compiler/TestCompile/no_empty_block_strings.exp.json new file mode 100644 index 000000000..be534202f --- /dev/null +++ b/testdata/d2compiler/TestCompile/no_empty_block_strings.exp.json @@ -0,0 +1,12 @@ +{ + "graph": null, + "err": { + "ioerr": null, + "errs": [ + { + "range": "d2/testdata/d2compiler/TestCompile/no_empty_block_strings.d2,0:0:0-0:11:11", + "errmsg": "d2/testdata/d2compiler/TestCompile/no_empty_block_strings.d2:1:1: block string cannot be empty" + } + ] + } +}