diff options
Diffstat (limited to 'src/nvim/testdir/test_goto.vim')
-rw-r--r-- | src/nvim/testdir/test_goto.vim | 59 |
1 files changed, 44 insertions, 15 deletions
diff --git a/src/nvim/testdir/test_goto.vim b/src/nvim/testdir/test_goto.vim index 19513b315a..49095400ef 100644 --- a/src/nvim/testdir/test_goto.vim +++ b/src/nvim/testdir/test_goto.vim @@ -334,21 +334,24 @@ endfunc func Test_motion_if_elif_else_endif() new - a -/* Test pressing % on #if, #else #elsif and #endif, - * with nested #if - */ -#if FOO -/* ... */ -# if BAR -/* ... */ -# endif -#elif BAR -/* ... */ -#else -/* ... */ -#endif -. + let lines =<< trim END + /* Test pressing % on #if, #else #elsif and #endif, + * with nested #if + */ + #if FOO + /* ... */ + # if BAR + /* ... */ + # endif + #elif BAR + /* ... */ + #else + /* ... */ + #endif + + #define FOO 1 + END + call setline(1, lines) /#if FOO norm % call assert_equal([9, 1], getpos('.')[1:2]) @@ -364,6 +367,30 @@ func Test_motion_if_elif_else_endif() norm $% call assert_equal([6, 1], getpos('.')[1:2]) + " Test for [# and ]# command + call cursor(5, 1) + normal [# + call assert_equal([4, 1], getpos('.')[1:2]) + call cursor(5, 1) + normal ]# + call assert_equal([9, 1], getpos('.')[1:2]) + call cursor(10, 1) + normal [# + call assert_equal([9, 1], getpos('.')[1:2]) + call cursor(10, 1) + normal ]# + call assert_equal([11, 1], getpos('.')[1:2]) + + " Finding a match before the first line or after the last line should fail + normal gg + call assert_beeps('normal [#') + normal G + call assert_beeps('normal ]#') + + " Finding a match for a macro definition (#define) should fail + normal G + call assert_beeps('normal %') + bw! endfunc @@ -393,3 +420,5 @@ func Test_motion_c_comment() bw! endfunc + +" vim: shiftwidth=2 sts=2 expandtab |