1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
# Test resolution of as many link types as possible in VimWiki syntax
# This relies on the line numbers for each type of link in link_syntax.wiki and
# link_syntax/nested.wiki, which seems primitive, but does seem to work.
# Links in a top-level page {{{
Execute (Assure link_syntax.wiki exists):
Log "Testing links in a top-level page with native syntax."
VimwikiIndex 1
VimwikiGoto link_syntax
AssertEqual $HOME . '/testwiki/link_syntax.wiki', expand('%')
Do (Check plain wiki page link to index):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:1\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
Do (Check absolute-in-wiki page link to index with leading slash):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:2\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
# //foo "absolute" links - these are also checked in link_generation.vader:
Do (Check absolute-on-filesystem page link to /tmp/some_page with 2 leading slashes):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:3\<CR>
\<CR>
:AssertEqual '/tmp/some_page.wiki', expand('%')\<CR>
Do (Check absolute-on-filesystem page link to index using tilde for homedir):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:4\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
Do (Check diary link):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:5\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/diary/2020-07-22.wiki', expand('%')\<CR>
Do (Check link to nested page):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:6\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')\<CR>
Do (Check relative link to nested page with ./link_syntax/nested):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax\<CR>
:7\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')\<CR>
# }}}
# Links in a nested file {{{
Execute (Assure link_syntax/nested.wiki exists):
Log "Testing links in a nested page with native syntax."
VimwikiIndex 1
VimwikiGoto link_syntax/nested
AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')
Do (Nested: Check plain wiki page link to self - link_syntax/nested.wiki):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:1\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/link_syntax/nested.wiki', expand('%')\<CR>
Do (Nested: Check absolute-in-wiki page link to index with leading slash):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:2\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
# //foo "absolute" links - these are also checked in link_generation.vader:
Do (Nested: Check absolute-on-filesystem page link to /tmp/some_page with 2 leading slashes):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:3\<CR>
\<CR>
:AssertEqual '/tmp/some_page.wiki', expand('%')\<CR>
Do (Nested: Check absolute-on-filesystem page link to index using tilde for homedir):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:4\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/index.wiki', expand('%')\<CR>
Do (Nested: Check diary link):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:5\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/diary/2020-07-22.wiki', expand('%')\<CR>
Do (Nested: Check relative link to page in parent directory):
:VimwikiIndex 1\<CR>
:VimwikiGoto link_syntax/nested\<CR>
:6\<CR>
\<CR>
:AssertEqual $HOME . '/testwiki/link_syntax.wiki', expand('%')\<CR>
# }}}
# To be perfectly honest I don't know why or if this is necessary, but without
# it I was getting leftover tabs for the last file visited here. -- brennen
Execute (Clean):
call ReloadVimwiki()
|