summaryrefslogtreecommitdiff
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
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)
-rw-r--r--src/Makefile2
-rw-r--r--src/testdir/Make_all.mak1
-rw-r--r--src/testdir/Make_vms.mms1
-rw-r--r--src/testdir/test14.in100
-rw-r--r--src/testdir/test14.ok26
-rw-r--r--src/testdir/test_edit.vim16
-rw-r--r--src/testdir/test_normal.vim92
-rw-r--r--src/testdir/test_search.vim24
-rw-r--r--src/testdir/test_substitute.vim49
-rw-r--r--src/testdir/test_visual.vim24
-rw-r--r--src/version.c2
11 files changed, 206 insertions, 131 deletions
diff --git a/src/Makefile b/src/Makefile
index 0e719ea12..3692e18d6 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2175,7 +2175,7 @@ test_libvterm:
# These do not depend on the executable, compile it when needed.
test1 \
test_eval \
- test3 test14 test17 \
+ test3 test17 \
test29 test30 test37 test39 \
test42 test44 test48 test49 \
test52 test59 \
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index 276bbeec5..91db070fd 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -14,7 +14,6 @@ SCRIPTS_FIRST = \
# Tests that run on all systems.
SCRIPTS_ALL = \
test3.out \
- test14.out \
test29.out \
test37.out \
test39.out \
diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms
index 4155923d5..8a92b4af2 100644
--- a/src/testdir/Make_vms.mms
+++ b/src/testdir/Make_vms.mms
@@ -74,7 +74,6 @@ VIMPROG = <->vim.exe
.SUFFIXES : .out .in
SCRIPT = test1.out test3.out \
- test14.out \
test29.out \
test30.out test37.out test39.out \
test42.out test44.out test48.out test49.out \
diff --git a/src/testdir/test14.in b/src/testdir/test14.in
deleted file mode 100644
index 3fc39fe4d..000000000
--- a/src/testdir/test14.in
+++ /dev/null
@@ -1,100 +0,0 @@
-Tests for "vaBiB", end could be wrong.
-Also test ":s/pat/sub/" with different ~s in sub.
-Also test for ^Vxff and ^Vo123 in Insert mode.
-Also test "[m", "]m", "[M" and "]M"
-Also test search()
-
-STARTTEST
-:so small.vim
-:set belloff=all
-/Start cursor here
-vaBiBD:?Bug?,/Piece/-2w! test.out
-/^- Bug
-:s/u/~u~/
-:s/i/~u~/
-:s/o/~~~/
-:.w >>test.out
-:if has("ebcdic")
-: let tt = "o\<C-V>193\<C-V>xc2\<C-V>o303 \<C-V>90a\<C-V>xfg\<C-V>o578\<Esc>"
-:else
-: let tt = "o\<C-V>65\<C-V>x42\<C-V>o103 \<C-V>33a\<C-V>xfg\<C-V>o78\<Esc>"
-:endif
-:exe "normal " . tt
-:unlet tt
-:.w >>test.out
-:set vb
-/^Piece
-2]maA:.w >>test.out
-j]maB:.w >>test.out
-]maC:.w >>test.out
-[maD:.w >>test.out
-k2[maE:.w >>test.out
-3[maF:.w >>test.out
-]MaG:.w >>test.out
-j2]MaH:.w >>test.out
-]M]MaI:.w >>test.out
-2[MaJ:.w >>test.out
-k[MaK:.w >>test.out
-3[MaL:.w >>test.out
-:"
-/^foobar
-:let startline = line('.')
-:call search('foobar', 'c')
-:call append(line('$'), line('.') - startline)
-j:call search('^$', 'c')
-:call append(line('$'), line('.') - startline)
-:call search('^$', 'bc')
-:call append(line('$'), line('.') - startline)
-/two
-:call search('.', 'c')
-:call append(line('$'), getline('.')[col('.') - 1:])
-:"
-/^substitute
-:s/foo/bar/
-:$put =@/
-/^substitute
-:keeppatterns s/asdf/xyz/
-:$put =@/
-/^substitute
-Y:$put =@0
-/bar /e
-:$put =@0
--:keeppatterns /xyz
-0dn:/^search()/,$w >>test.out
-:qa!
-ENDTEST
-
-- Bug in "vPPPP" on this text (Webb):
- {
- cmd;
- {
- cmd; /* <-- Start cursor here */
- {
- }
- }
- }
-
-Piece of Java
-{
- tt m1 {
- t1;
- } e1
-
- tt m2 {
- t2;
- } e2
-
- tt m3 {
- if (x)
- {
- t3;
- }
- } e3
-}
-
-foobar
-
-substitute foo asdf
-
-one two
-search()
diff --git a/src/testdir/test14.ok b/src/testdir/test14.ok
deleted file mode 100644
index 0aa2db3f9..000000000
--- a/src/testdir/test14.ok
+++ /dev/null
@@ -1,26 +0,0 @@
-- Bug in "vPPPP" on this text (Webb):
- {
- }
-- Bug uuun "vPPPP" uuuuuuuuun this text (Webb):
-ABC !ag8
- tt m1 {A
- tt m2 {B
- tt m3 {C
- tt m3 {DC
- tt m1 {EA
-{F
- }G e1
- }H e3
-}I
- }JH e3
- }K e2
-{LF
-search()
-0
-1
-1
-two
-foo
-^substitute
-substitute bar xyz
-xyz
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index b35497fc2..381e09cb4 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -1447,3 +1447,19 @@ func Test_leave_insert_autocmd()
au! InsertLeave
iunmap x
endfunc
+
+" Test for inserting characters using CTRL-V followed by a number.
+func Test_edit_special_chars()
+ new
+
+ if has("ebcdic")
+ let t = "o\<C-V>193\<C-V>xc2\<C-V>o303 \<C-V>90a\<C-V>xfg\<C-V>o578\<Esc>"
+ else
+ let t = "o\<C-V>65\<C-V>x42\<C-V>o103 \<C-V>33a\<C-V>xfg\<C-V>o78\<Esc>"
+ endif
+
+ exe "normal " . t
+ call assert_equal("ABC !a\<C-O>g\<C-G>8", getline(2))
+
+ close!
+endfunc
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
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index 525d0d200..d59f39dc7 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -1265,3 +1265,27 @@ func Test_incsearch_add_char_under_cursor()
set incsearch&
bwipe!
endfunc
+
+" Test for the search() function with match at the cursor position
+func Test_search_match_at_curpos()
+ new
+ call append(0, ['foobar', '', 'one two', ''])
+
+ normal gg
+
+ call search('foobar', 'c')
+ call assert_equal([1, 1], [line('.'), col('.')])
+
+ normal j
+ call search('^$', 'c')
+ call assert_equal([2, 1], [line('.'), col('.')])
+
+ call search('^$', 'bc')
+ call assert_equal([2, 1], [line('.'), col('.')])
+
+ exe "normal /two\<CR>"
+ call search('.', 'c')
+ call assert_equal([3, 5], [line('.'), col('.')])
+
+ close!
+endfunc
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim
index 790f2381e..a58b56ec8 100644
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -640,3 +640,52 @@ func Test_nocatch_sub_failure_handling()
bwipe!
endfunc
+
+" Test ":s/pat/sub/" with different ~s in sub.
+func Test_replace_with_tilde()
+ new
+ " Set the last replace string to empty
+ s/^$//
+ call append(0, ['- Bug in "vPPPP" on this text:'])
+ normal gg
+ s/u/~u~/
+ call assert_equal('- Bug in "vPPPP" on this text:', getline(1))
+ s/i/~u~/
+ call assert_equal('- Bug uuun "vPPPP" on this text:', getline(1))
+ s/o/~~~/
+ call assert_equal('- Bug uuun "vPPPP" uuuuuuuuun this text:', getline(1))
+ close!
+endfunc
+
+func Test_replace_keeppatterns()
+ new
+ a
+foobar
+
+substitute foo asdf
+
+one two
+.
+
+ normal gg
+ /^substitute
+ s/foo/bar/
+ call assert_equal('foo', @/)
+ call assert_equal('substitute bar asdf', getline('.'))
+
+ /^substitute
+ keeppatterns s/asdf/xyz/
+ call assert_equal('^substitute', @/)
+ call assert_equal('substitute bar xyz', getline('.'))
+
+ exe "normal /bar /e\<CR>"
+ call assert_equal(15, col('.'))
+ normal -
+ keeppatterns /xyz
+ call assert_equal('bar ', @/)
+ call assert_equal('substitute bar xyz', getline('.'))
+ exe "normal 0dn"
+ call assert_equal('xyz', getline('.'))
+
+ close!
+endfunc
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index abf131c38..27e5614f2 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -404,3 +404,27 @@ func Test_curswant_not_changed()
bwipe!
au! InsertLeave
endfunc
+
+" Tests for "vaBiB", end could be wrong.
+func Test_Visual_Block()
+ new
+ a
+- Bug in "vPPPP" on this text:
+ {
+ cmd;
+ {
+ cmd;\t/* <-- Start cursor here */
+ {
+ }
+ }
+ }
+.
+ normal gg
+ call search('Start cursor here')
+ normal vaBiBD
+ call assert_equal(['- Bug in "vPPPP" on this text:',
+ \ "\t{",
+ \ "\t}"], getline(1, '$'))
+
+ close!
+endfunc
diff --git a/src/version.c b/src/version.c
index 88763e5cf..e6dc264bd 100644
--- a/src/version.c
+++ b/src/version.c
@@ -768,6 +768,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1214,
+/**/
1213,
/**/
1212,