diff --git a/lexer_test.go b/lexer_test.go index 6034657..9fe1eea 100644 --- a/lexer_test.go +++ b/lexer_test.go @@ -272,7 +272,41 @@ var singleWikilink = []tc{ }, } -func Test_ObsidianWikilinks_LinksWithEscapeCharacters(t *testing.T) { +func Test_ObsidianWikilinks_TextWithEscapeCharacters(t *testing.T) { + for _, tc := range singleWikilink { + tc.name = "escape characters preceding " + tc.name + mut, test := mutateTestCase( + tc, + `foo\[\[not a link, but this is`, + "", + []markdown.Lexeme{ + {Typ: markdown.LexText, Val: `foo\[\[not a link, but this is`}, + }, + []markdown.Lexeme{ + {Typ: markdown.LexText, Val: ""}, + }, + ) + t.Run(mut.name, test) + } + + for _, tc := range singleWikilink { + tc.name = "escape characters following " + tc.name + mut, test := mutateTestCase( + tc, + "", + `foo\[\[not a link, but this is`, + []markdown.Lexeme{ + {Typ: markdown.LexText, Val: ""}, + }, + []markdown.Lexeme{ + {Typ: markdown.LexText, Val: `foo\[\[not a link, but this is`}, + }, + ) + t.Run(mut.name, test) + } +} + +func Test_ObsidianWikilinks_EscapeCharacters(t *testing.T) { for _, tc := range wikilinkWithEscapeCharacters { mut, test := mutateTestCase( tc,