From 9de66ba0dad710d455164ead435e1199389e3e6b Mon Sep 17 00:00:00 2001 From: Nick Dumas Date: Wed, 5 Jul 2023 14:35:46 -0400 Subject: [PATCH] cleaning tests up --- lexer_test.go | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) 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,