|
|
|
@ -9,7 +9,19 @@ import (
|
|
|
|
|
"code.ndumas.com/ndumas/obsidian-markdown"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var SingleWikilink = []tc{
|
|
|
|
|
var wikilinkWithEscapeCharacters = []tc{
|
|
|
|
|
{
|
|
|
|
|
name: "wikilink",
|
|
|
|
|
in: `[[wiki\]link]]`,
|
|
|
|
|
expected: []markdown.Lexeme{
|
|
|
|
|
{Typ: markdown.LexOpenLink, Val: "[["},
|
|
|
|
|
{Typ: markdown.LexIdent, Val: `wiki\]link`},
|
|
|
|
|
{Typ: markdown.LexCloseLink, Val: "]]"},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var singleWikilink = []tc{
|
|
|
|
|
{
|
|
|
|
|
name: "wikilink",
|
|
|
|
|
in: "[[wikilink]]",
|
|
|
|
@ -197,8 +209,25 @@ var SingleWikilink = []tc{
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Test_ObsidianWikilinks_LinksWithEscapeCharacters(t *testing.T) {
|
|
|
|
|
for _, tc := range wikilinkWithEscapeCharacters {
|
|
|
|
|
mut, test := mutateTestCase(
|
|
|
|
|
tc,
|
|
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
[]markdown.Lexeme{
|
|
|
|
|
{Typ: markdown.LexText, Val: ""},
|
|
|
|
|
},
|
|
|
|
|
[]markdown.Lexeme{
|
|
|
|
|
{Typ: markdown.LexText, Val: ""},
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
t.Run(mut.name, test)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Test_ObsidianWikilinks_LinksEndOfMultiLineInput(t *testing.T) {
|
|
|
|
|
for _, tc := range SingleWikilink {
|
|
|
|
|
for _, tc := range singleWikilink {
|
|
|
|
|
mut, test := mutateTestCase(
|
|
|
|
|
tc,
|
|
|
|
|
" test data please ignore.\nbling blonk more lines\nbling blong\nthis is a",
|
|
|
|
@ -219,7 +248,7 @@ func Test_ObsidianWikilinks_LinksEndOfMultiLineInput(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Test_ObsidianWikilinks_LinksStartOfMultiLineInput(t *testing.T) {
|
|
|
|
|
for _, tc := range SingleWikilink {
|
|
|
|
|
for _, tc := range singleWikilink {
|
|
|
|
|
mut, test := mutateTestCase(
|
|
|
|
|
tc,
|
|
|
|
|
"",
|
|
|
|
@ -240,7 +269,7 @@ func Test_ObsidianWikilinks_LinksStartOfMultiLineInput(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Test_ObsidianWikilinks_LinksStartOfInput(t *testing.T) {
|
|
|
|
|
for _, tc := range SingleWikilink {
|
|
|
|
|
for _, tc := range singleWikilink {
|
|
|
|
|
mut, test := mutateTestCase(
|
|
|
|
|
tc,
|
|
|
|
|
"",
|
|
|
|
@ -258,7 +287,7 @@ func Test_ObsidianWikilinks_LinksStartOfInput(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Test_ObsidianWikilinks_LinksEndOfInput(t *testing.T) {
|
|
|
|
|
for _, tc := range SingleWikilink {
|
|
|
|
|
for _, tc := range singleWikilink {
|
|
|
|
|
mut, test := mutateTestCase(
|
|
|
|
|
tc,
|
|
|
|
|
"this is a ",
|
|
|
|
@ -276,7 +305,7 @@ func Test_ObsidianWikilinks_LinksEndOfInput(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
func Test_ObsidianWikilinks_Basic(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
for _, tc := range SingleWikilink {
|
|
|
|
|
for _, tc := range singleWikilink {
|
|
|
|
|
mut, test := mutateTestCase(
|
|
|
|
|
tc,
|
|
|
|
|
"",
|
|
|
|
|