summaryrefslogtreecommitdiff
path: root/src/testdir/test_normal.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-04-27 18:00:34 +0200
committerBram Moolenaar <Bram@vim.org>2019-04-27 18:00:34 +0200
commitc6b37db1ba704455daa8f9e78bc1c2492fb81f40 (patch)
treeefcf0a80525a0fc79ae3f5b9f24ba0330f51ee1e /src/testdir/test_normal.vim
parente13a3901cae0afb4d2af30d497696af08029fd81 (diff)
downloadvim-git-c6b37db1ba704455daa8f9e78bc1c2492fb81f40.tar.gz
patch 8.1.1214: old style testsv8.1.1214
Problem: Old style tests. Solution: Move tests from test14 to new style test files. (Yegappan Lakshmanan, closes #4308)
Diffstat (limited to 'src/testdir/test_normal.vim')
-rw-r--r--src/testdir/test_normal.vim92
1 files changed, 90 insertions, 2 deletions
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 19e68116c..39c66f8fe 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -1358,11 +1358,21 @@ func Test_normal23_K()
bw!
return
endif
- set keywordprg=man\ --pager=cat
+
+ if has('mac')
+ " In MacOS, the option for specifying a pager is different
+ set keywordprg=man\ -P\ cat
+ else
+ set keywordprg=man\ --pager=cat
+ endif
" Test for using man
2
let a = execute('unsilent norm! K')
- call assert_match("man --pager=cat 'man'", a)
+ if has('mac')
+ call assert_match("man -P cat 'man'", a)
+ else
+ call assert_match("man --pager=cat 'man'", a)
+ endif
" clean up
let &keywordprg = k
@@ -2559,3 +2569,81 @@ func Test_message_when_using_ctrl_c()
bwipe!
endfunc
+
+" Test for '[m', ']m', '[M' and ']M'
+" Jumping to beginning and end of methods in Java-like languages
+func Test_java_motion()
+ new
+ a
+Piece of Java
+{
+ tt m1 {
+ t1;
+ } e1
+
+ tt m2 {
+ t2;
+ } e2
+
+ tt m3 {
+ if (x)
+ {
+ t3;
+ }
+ } e3
+}
+.
+
+ normal gg
+
+ normal 2]maA
+ call assert_equal("\ttt m1 {A", getline('.'))
+ call assert_equal([3, 9, 16], [line('.'), col('.'), virtcol('.')])
+
+ normal j]maB
+ call assert_equal("\ttt m2 {B", getline('.'))
+ call assert_equal([7, 9, 16], [line('.'), col('.'), virtcol('.')])
+
+ normal ]maC
+ call assert_equal("\ttt m3 {C", getline('.'))
+ call assert_equal([11, 9, 16], [line('.'), col('.'), virtcol('.')])
+
+ normal [maD
+ call assert_equal("\ttt m3 {DC", getline('.'))
+ call assert_equal([11, 9, 16], [line('.'), col('.'), virtcol('.')])
+
+ normal k2[maE
+ call assert_equal("\ttt m1 {EA", getline('.'))
+ call assert_equal([3, 9, 16], [line('.'), col('.'), virtcol('.')])
+
+ normal 3[maF
+ call assert_equal("{F", getline('.'))
+ call assert_equal([2, 2, 2], [line('.'), col('.'), virtcol('.')])
+
+ normal ]MaG
+ call assert_equal("\t}G e1", getline('.'))
+ call assert_equal([5, 3, 10], [line('.'), col('.'), virtcol('.')])
+
+ normal j2]MaH
+ call assert_equal("\t}H e3", getline('.'))
+ call assert_equal([16, 3, 10], [line('.'), col('.'), virtcol('.')])
+
+ normal ]M]M
+ normal aI
+ call assert_equal("}I", getline('.'))
+ call assert_equal([17, 2, 2], [line('.'), col('.'), virtcol('.')])
+
+ normal 2[MaJ
+ call assert_equal("\t}JH e3", getline('.'))
+ call assert_equal([16, 3, 10], [line('.'), col('.'), virtcol('.')])
+
+ normal k[MaK
+ call assert_equal("\t}K e2", getline('.'))
+ call assert_equal([9, 3, 10], [line('.'), col('.'), virtcol('.')])
+
+ normal 3[MaL
+ call assert_equal("{LF", getline('.'))
+ call assert_equal([2, 2, 2], [line('.'), col('.'), virtcol('.')])
+
+ close!
+endfunc