X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/0da5ba9d719b818909d85bacdad2ce5d860c9e94..81e1f07a8482b34ea8c59f6800e7e8dec7bf56b9:/test/map.vader diff --git a/test/map.vader b/test/map.vader index 6cf0cee..ea96182 100644 --- a/test/map.vader +++ b/test/map.vader @@ -1,3 +1,55 @@ +Given mkd; +a c + +Execute (gx autolink): + let b:url = 'http://b' + let b:line = getline(1) + let b:func = Markdown_GetFunc('vim-markdown/ftplugin/mkd.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 mkd; +a http://b.bb c + +Execute (gx implicit autolink): + let b:url = 'http://b.bb' + let b:line = getline(1) + let b:func = Markdown_GetFunc('vim-markdown/ftplugin/mkd.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; +[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/mkd.vim', 'Markdown_GetUrlForPosition') + " TODO would be cool if all of the following gave the link. + 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; +a [b](c) d + +Execute (gx autolink): + let b:url = 'c' + let b:line = getline(1) + let b:func = Markdown_GetFunc('vim-markdown/ftplugin/mkd.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 mkd; # a