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
|
" Calling functions is required here; the commands are unknown because of the
" gitcommit resource
Before:
find **/gitcommit_converted.gitcommit
normal! gg
unlet! g:link_heading
unlet! b:link_heading
unlet! b:link_heading_before
unlet! b:link_skip_line
After:
unlet! g:link_heading
unlet! b:link_heading
unlet! b:link_heading_before
unlet! b:link_skip_line
Execute (Valid peek, from single reference link on line, [0]):
let b:link_heading = 'Links:'
let b:link_heading_before = '^# Please enter'
call cursor(6, 20)
let expected = 'link.vim: https://github.com/example/project/wiki'
let out = execute('LinkPeek')
let last_mes = split(out, "\n")[-1]
AssertEqual expected, last_mes
Execute (Valid peek, from multiple reference links on line, [3]):
let b:link_heading = 'Links:'
let b:link_heading_before = '^# Please enter'
call cursor(8, 50)
let expected = 'link.vim: https://docs.example.com/developer-guide'
let out = execute('LinkPeek')
let last_mes = split(out, "\n")[-1]
AssertEqual expected, last_mes
Execute (Invalid peek, from reference section):
let b:link_heading = 'Links:'
let b:link_heading_before = '^# Please enter'
call cursor(17, 1)
let expected = 'link.vim: Can only peek reference links'
let out = execute('LinkPeek')
let last_mes = split(out, "\n")[-1]
AssertEqual expected, last_mes
Execute (Invalid peek, label [1] not found in reference section):
let b:link_heading = 'Links:'
let b:link_heading_before = '^# Please enter'
18 delete
call cursor(7, 25)
let out = execute('LinkPeek')
let expected = 'link.vim: Could not locate reference'
let first_mes = split(out, "\n")[0]
AssertEqual expected, first_mes
|