From be33bd2c2046d3f7247a5d12190dca26714e3da8 Mon Sep 17 00:00:00 2001 From: Nick Dumas Date: Wed, 5 Jul 2023 13:20:56 -0400 Subject: [PATCH] expand escape character test cases --- lexer_test.go | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/lexer_test.go b/lexer_test.go index 3191418..5f8b6a5 100644 --- a/lexer_test.go +++ b/lexer_test.go @@ -11,7 +11,16 @@ import ( var wikilinkWithEscapeCharacters = []tc{ { - name: "wikilink", + name: "wikilink with escaped close link", + in: `[[wiki\]\]link]]`, + expected: []markdown.Lexeme{ + {Typ: markdown.LexOpenLink, Val: "[["}, + {Typ: markdown.LexIdent, Val: `wiki\]\]link`}, + {Typ: markdown.LexCloseLink, Val: "]]"}, + }, + }, + { + name: "wikilink with partial escaped close link", in: `[[wiki\]link]]`, expected: []markdown.Lexeme{ {Typ: markdown.LexOpenLink, Val: "[["}, @@ -19,6 +28,42 @@ var wikilinkWithEscapeCharacters = []tc{ {Typ: markdown.LexCloseLink, Val: "]]"}, }, }, + { + name: "wikilink with escaped alias", + in: `[[wiki\|link]]`, + expected: []markdown.Lexeme{ + {Typ: markdown.LexOpenLink, Val: "[["}, + {Typ: markdown.LexIdent, Val: `wiki\|link`}, + {Typ: markdown.LexCloseLink, Val: "]]"}, + }, + }, + { + name: "wikilink with escaped blockref", + in: `[[wiki\#\^link]]`, + expected: []markdown.Lexeme{ + {Typ: markdown.LexOpenLink, Val: "[["}, + {Typ: markdown.LexIdent, Val: `wiki\#\^link`}, + {Typ: markdown.LexCloseLink, Val: "]]"}, + }, + }, + { + name: "wikilink with partial escaped blockref", + in: `[[wiki\^link]]`, + expected: []markdown.Lexeme{ + {Typ: markdown.LexOpenLink, Val: "[["}, + {Typ: markdown.LexIdent, Val: `wiki\^link`}, + {Typ: markdown.LexCloseLink, Val: "]]"}, + }, + }, + { + name: "wikilink with escaped header", + in: `[[wiki\#link]]`, + expected: []markdown.Lexeme{ + {Typ: markdown.LexOpenLink, Val: "[["}, + {Typ: markdown.LexIdent, Val: `wiki\#link`}, + {Typ: markdown.LexCloseLink, Val: "]]"}, + }, + }, } var singleWikilink = []tc{