X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/c3a600c42a1374530ecc1b681f26595ea5f22ee2..fc679c4c0fd36b93ce0cc3e88348df9b35b6a43b:/test/map.vader?ds=inline diff --git a/test/map.vader b/test/map.vader index 51bde78..92947f5 100644 --- a/test/map.vader +++ b/test/map.vader @@ -1,52 +1,56 @@ -Given mkd; +Given markdown; a c Execute (gx autolink): let b:url = 'http://b' let b:line = getline(1) - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, 'a') + 1), '' - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, '<') + 1), b:url - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, 'h') + 1), b:url - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, '>') + 1), b:url - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, 'c') + 1), '' - -Given mkd; + let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition') + AssertEqual b:func(1, match(b:line, 'a') + 1), '' + AssertEqual b:func(1, match(b:line, '<') + 1), b:url + AssertEqual b:func(1, match(b:line, 'h') + 1), b:url + AssertEqual b:func(1, match(b:line, '>') + 1), b:url + AssertEqual b:func(1, match(b:line, 'c') + 1), '' + +Given markdown; a http://b.bb c Execute (gx implicit autolink): let b:url = 'http://b.bb' let b:line = getline(1) - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, 'a') + 1), '' - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, 'h') + 1), b:url - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, 'c') + 1), '' + let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition') + AssertEqual b:func(1, match(b:line, 'a') + 1), '' + AssertEqual b:func(1, match(b:line, 'h') + 1), b:url + AssertEqual b:func(1, match(b:line, 'c') + 1), '' -Given mkd; +Given markdown; [a]: http://b "c" Execute (gx link reference definition): let b:url = 'http://b' let b:line = getline(1) + let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition') " TODO would be cool if all of the following gave the link. - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, 'a') + 1), '' - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, 'h') + 1), b:url - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, 'c') + 1), '' + AssertEqual b:func(1, match(b:line, 'a') + 1), '' + AssertEqual b:func(1, match(b:line, 'h') + 1), b:url + AssertEqual b:func(1, match(b:line, 'c') + 1), '' -Given mkd; +Given markdown; a [b](c) d Execute (gx autolink): let b:url = 'c' let b:line = getline(1) - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, 'a') + 1), '' - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, '[') + 1), b:url - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, 'b') + 1), b:url - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, ']') + 1), b:url - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, '(') + 1), b:url - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, 'c') + 1), b:url - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, ')') + 1), b:url - AssertEqual b:Markdown_GetUrlForPosition(1, match(b:line, 'd') + 1), '' - -Given mkd; + let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition') + AssertEqual b:func(1, match(b:line, 'a') + 1), '' + AssertEqual b:func(1, match(b:line, '[') + 1), b:url + AssertEqual b:func(1, match(b:line, 'b') + 1), b:url + AssertEqual b:func(1, match(b:line, ']') + 1), b:url + AssertEqual b:func(1, match(b:line, '(') + 1), b:url + AssertEqual b:func(1, match(b:line, 'c') + 1), b:url + AssertEqual b:func(1, match(b:line, ')') + 1), b:url + AssertEqual b:func(1, match(b:line, 'd') + 1), '' + +Given markdown; # a b @@ -62,7 +66,7 @@ Execute (]] same level): normal [[ AssertEqual line('.'), 1 -Given mkd; +Given markdown; # a b @@ -78,7 +82,7 @@ Execute (]] different levels level): normal [[ AssertEqual line('.'), 1 -Given mkd; +Given markdown; # a b @@ -98,7 +102,7 @@ Execute (][ different levels level): normal [] AssertEqual line('.'), 1 -Given mkd; +Given markdown; # a b @@ -108,16 +112,3 @@ Execute (]c): AssertEqual line('.'), 3 normal ]c AssertEqual line('.'), 1 - -Given mkd; -# a - -Execute (Toc does not set nomodifiable on other files): - " Sanity check. - Assert &modifiable - - :Toc - :lclose - :edit a - - Assert &modifiable