summaryrefslogtreecommitdiff
path: root/src/testdir/test_goto.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-05-26 18:39:32 +0200
committerBram Moolenaar <Bram@vim.org>2018-05-26 18:39:32 +0200
commit6b69e5c646faecf2a686bfe71dc17a2a1c6d344f (patch)
treec495ed7a88fa04a7eb6c4130a02061d9975caa13 /src/testdir/test_goto.vim
parent22c105640cdef25d98390f973d2ed53dd9039f6e (diff)
downloadvim-git-6b69e5c646faecf2a686bfe71dc17a2a1c6d344f.tar.gz
patch 8.1.0024: % command not testded on #ifdef and commentv8.1.0024
Problem: % command not testded on #ifdef and comment. Solution: Add tests. (Dominique Pelle, closes #2956)
Diffstat (limited to 'src/testdir/test_goto.vim')
-rw-r--r--src/testdir/test_goto.vim62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/testdir/test_goto.vim b/src/testdir/test_goto.vim
index ea67fe738..c0235b170 100644
--- 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