Mercurial > vim
changeset 14013:a04738ab7670 v8.1.0024
patch 8.1.0024: % command not testded on #ifdef and comment
commit https://github.com/vim/vim/commit/6b69e5c646faecf2a686bfe71dc17a2a1c6d344f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 26 18:39:32 2018 +0200
patch 8.1.0024: % command not testded on #ifdef and comment
Problem: % command not testded on #ifdef and comment.
Solution: Add tests. (Dominique Pelle, closes https://github.com/vim/vim/issues/2956)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 26 May 2018 18:45:05 +0200 |
parents | e1050685ad5c |
children | 9d29a6eff754 |
files | src/testdir/test_goto.vim src/version.c |
diffstat | 2 files changed, 64 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_goto.vim +++ b/src/testdir/test_goto.vim @@ -309,3 +309,65 @@ func Test_gd_local_block() \ ] call XTest_goto_decl('1gd', lines, 11, 11) 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 +. + /#if FOO + norm % + call assert_equal([9, 1], getpos('.')[1:2]) + norm % + call assert_equal([11, 1], getpos('.')[1:2]) + norm % + call assert_equal([13, 1], getpos('.')[1:2]) + norm % + call assert_equal([4, 1], getpos('.')[1:2]) + /# if BAR + norm $% + call assert_equal([8, 1], getpos('.')[1:2]) + norm $% + call assert_equal([6, 1], getpos('.')[1:2]) + + bw! +endfunc + +func Test_motion_c_comment() + new + a +/* + * Test pressing % on beginning/end + * of C comments. + */ +/* Another comment */ +. + norm gg0% + call assert_equal([4, 3], getpos('.')[1:2]) + norm % + call assert_equal([1, 1], getpos('.')[1:2]) + norm gg0l% + call assert_equal([4, 3], getpos('.')[1:2]) + norm h% + call assert_equal([1, 1], getpos('.')[1:2]) + + norm G^ + norm % + call assert_equal([5, 21], getpos('.')[1:2]) + norm % + call assert_equal([5, 1], getpos('.')[1:2]) + + bw! +endfunc