Fix resolution of leading-slash links, add link tests (#1108)

Hopefully this solves #1084, "Page links with leading slash lead to a
file in working directory, not a page at the root of the wiki", introduced
in 850aace.

It also adds a set of tests for different kinds of wiki links:

  - api_base_resolve_link.vader
  - link_syntax_markdown.vader
  - link_syntax_vimwiki.vader

Includes some fixes for locally-failing tests, removes a test from
test/map.vader and comments out test/config_vars.vader entirely for the
moment.

Code by : Brennen Bearnes <code@p1k3.com>
This commit is contained in:
Brennen Bearnes
2021-04-06 20:09:37 -06:00
committed by GitHub
parent 618893be00
commit f396e8a494
17 changed files with 484 additions and 124 deletions
+16 -2
View File
@@ -148,7 +148,7 @@ Expect (3 Words []()):
####################
Execute (Log):
Log 'Absolute links'
Log 'Absolute links: full paths and in-wiki'
# For markdown {{{2
# ------------------
@@ -162,6 +162,7 @@ Given vimwiki(some wiki link):
[test1](//$HOME/in_home1)
[test2](//~/in_home2)
[test3](///tmp/in_tmp)
[test4](/in_current_wiki)
Do (Check in_home1):
\<Cr>
@@ -175,6 +176,12 @@ Do (Check in_tmp):
jj\<Cr>
:AssertEqual expand('%'), '/tmp/in_tmp.md'\<Cr>
# Here, assuming that "current wiki" means the working directory, since
# no wiki is currently defined:
Do (Check in_current_wiki):
jjj\<Cr>
:AssertEqual expand('%'), '/testplugin/in_current_wiki.md'\<Cr>
# For Wiki {{{2
# ------------------
@@ -187,6 +194,7 @@ Given vimwiki(some wiki link):
[[//$HOME/in_home1]]
[[//~/in_home2]]
[[///tmp/in_tmp]]
[[/in_current_wiki]]
Do (Check in_home1):
\<Cr>
@@ -200,6 +208,12 @@ Do (Check in_tmp):
jj\<Cr>
:AssertEqual expand('%'), '/tmp/in_tmp.wiki'\<Cr>
# Here, assuming that "current wiki" means the working directory, since
# no wiki is currently defined:
Do (Check in_current_wiki):
jjj\<Cr>
:AssertEqual expand('%'), '/testplugin/in_current_wiki.wiki'\<Cr>
Execute(Clean: temporary):
call ReloadVimwiki()
call DeleteFile('$HOME/in_home1.md')
@@ -212,7 +226,7 @@ Execute(Clean: temporary):
Execute (Log):
Log 'Link with dot'
Given vimwiki (filnames with dots):
Given vimwiki (filenames with dots):
part1.part2.part3
part1.part2.part3.md
noext