summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-10-26 20:21:44 +0200
committerBram Moolenaar <Bram@vim.org>2017-10-26 20:21:44 +0200
commit15993ce9210e8b8d4bc11e1d640f6447b18d3e6c (patch)
tree1c1558bba5fb9a3bd1cfa6d8d494aeca2bd83097 /src
parent235dddf1f4afe3a40047dbf2aca1bd177b7be18b (diff)
patch 8.0.1221: still too many old style testsv8.0.1221
Problem: Still too many old style tests. Solution: Convert a few more tests to new style. (Yegappan Lakshmanan, closes #2256)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile9
-rw-r--r--src/testdir/Make_all.mak10
-rw-r--r--src/testdir/Make_amiga.mak1
-rw-r--r--src/testdir/Make_dos.mak1
-rw-r--r--src/testdir/Make_ming.mak1
-rw-r--r--src/testdir/Make_vms.mms28
-rw-r--r--src/testdir/main.aap7
-rw-r--r--src/testdir/test19.in33
-rw-r--r--src/testdir/test19.ok10
-rw-r--r--src/testdir/test20.in28
-rw-r--r--src/testdir/test20.ok10
-rw-r--r--src/testdir/test25.in31
-rw-r--r--src/testdir/test25.ok1
-rw-r--r--src/testdir/test28.inbin364 -> 0 bytes
-rw-r--r--src/testdir/test28.ok2
-rw-r--r--src/testdir/test32.in61
-rw-r--r--src/testdir/test32.ok15
-rw-r--r--src/testdir/test38.in35
-rw-r--r--src/testdir/test38.ok13
-rw-r--r--src/testdir/test66.in33
-rw-r--r--src/testdir/test66.ok16
-rw-r--r--src/testdir/test79.inbin3381 -> 0 bytes
-rw-r--r--src/testdir/test79.okbin574 -> 0 bytes
-rw-r--r--src/testdir/test_ins_complete.vim91
-rw-r--r--src/testdir/test_source_utf8.vim30
-rw-r--r--src/testdir/test_substitute.vim206
-rw-r--r--src/testdir/test_tab.vim45
-rw-r--r--src/testdir/test_tagjump.vim37
-rw-r--r--src/testdir/test_undo.vim16
-rw-r--r--src/testdir/test_visual.vim98
-rw-r--r--src/version.c2
31 files changed, 542 insertions, 328 deletions
diff --git a/src/Makefile b/src/Makefile
index a6128178a1..75e528e12d 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2100,13 +2100,12 @@ test1 \
test_listchars \
test_search_mbyte \
test_wordcount \
- test3 test11 test12 test14 test15 test17 test19 \
- test20 test25 test28 test29 \
- test30 test32 test36 test37 test38 test39 \
+ test3 test11 test12 test14 test15 test17 \
+ test29 test30 test36 test37 test39 \
test40 test42 test44 test45 test48 test49 \
test50 test52 test55 test59 \
- test64 test66 test68 test69 \
- test70 test72 test73 test77 test79 \
+ test64 test68 test69 \
+ test70 test72 test73 test77 \
test83 test85 test86 test87 test88 \
test94 test95 test99 test108:
cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index d0afdb5614..6edca56c78 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -16,13 +16,9 @@ SCRIPTS_ALL = \
test3.out \
test14.out \
test15.out \
- test19.out \
- test20.out \
- test28.out \
test29.out \
test36.out \
test37.out \
- test38.out \
test39.out \
test40.out \
test42.out \
@@ -31,12 +27,10 @@ SCRIPTS_ALL = \
test48.out \
test55.out \
test64.out \
- test66.out \
test68.out \
test69.out \
test70.out \
test73.out \
- test79.out \
test88.out \
test94.out \
test95.out \
@@ -65,7 +59,6 @@ SCRIPTS_MORE1 = \
# Tests that run on most systems, but not on Amiga and DOS/Windows.
SCRIPTS_MORE2 = \
test12.out \
- test25.out \
test49.out
@@ -73,7 +66,6 @@ SCRIPTS_MORE2 = \
SCRIPTS_MORE4 = \
test17.out \
test30.out \
- test32.out \
test59.out \
test72.out \
test83.out
@@ -129,6 +121,7 @@ NEW_TESTS = test_arabic.res \
test_hlsearch.res \
test_increment.res \
test_increment_dbcs.res \
+ test_ins_complete.res \
test_job_fails.res \
test_json.res \
test_langmap.res \
@@ -173,6 +166,7 @@ NEW_TESTS = test_arabic.res \
test_substitute.res \
test_syntax.res \
test_system.res \
+ test_tab.res \
test_tcl.res \
test_terminal.res \
test_terminal_fail.res \
diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak
index 7a8eca2e28..4a6bd9f66f 100644
--- a/src/testdir/Make_amiga.mak
+++ b/src/testdir/Make_amiga.mak
@@ -14,7 +14,6 @@ include Make_all.mak
# test10 'errorformat' is different
# test11 "cat" doesn't work properly
# test12 can't unlink a swap file
-# test25 uses symbolic link
# test52 only for Win32
# test85 no Lua interface
# test86, 87 no Python interface
diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak
index 4e0c8f7dbc..52162bccde 100644
--- a/src/testdir/Make_dos.mak
+++ b/src/testdir/Make_dos.mak
@@ -13,7 +13,6 @@ default: nongui
# test2 "\\tmp" doesn't work.
# test10 'errorformat' is different
# test12 can't unlink a swap file
-# test25 uses symbolic link
# test49 fails in various ways
# test97 \{ and \$ are not escaped characters.
diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak
index ea748cd939..11346854fd 100644
--- a/src/testdir/Make_ming.mak
+++ b/src/testdir/Make_ming.mak
@@ -32,7 +32,6 @@ include Make_all.mak
# test2 "\\tmp" doesn't work.
# test10 'errorformat' is different
# test12 can't unlink a swap file
-# test25 uses symbolic link
# test97 \{ and \$ are not escaped characters
SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) $(SCRIPTS_WIN32)
diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms
index 30b671c354..b76c2305d4 100644
--- a/src/testdir/Make_vms.mms
+++ b/src/testdir/Make_vms.mms
@@ -75,21 +75,13 @@ VIMPROG = <->vim.exe
SCRIPT = test1.out test3.out \
test14.out test15.out \
- test19.out test20.out \
- test28.out test29.out test30.out test32.out \
- test36.out test37.out \
- test38.out test39.out test40.out test42.out \
- test44.out test45.out \
- test48.out test49.out \
- test55.out \
- test64.out \
- test66.out test68.out test69.out \
- test72.out \
- test77a.out test79.out \
- test88.out \
- test94.out \
- test95.out test99.out \
- test108.out\
+ test29.out test30.out \
+ test36.out test37.out test39.out \
+ test40.out test42.out test44.out test45.out \
+ test48.out test49.out test55.out \
+ test64.out test68.out test69.out \
+ test72.out test77a.out test88.out \
+ test94.out test95.out test99.out test108.out\
test_autocmd_option.out \
test_breakindent.out \
test_changelist.out \
@@ -110,10 +102,6 @@ SCRIPT = test1.out test3.out \
#
# test30: bug, most probably - a problem around mac format
#
-# test32: VMS is not case sensitive and all filenames are lowercase within Vim
-# (this should be changed in order to preserve the original filename) - should
-# be fixed. VMS allows just one dot in the filename
-#
# test59: Failed/Hangs - VMS does not support spell files (file names
# with too many dots).
#
@@ -131,7 +119,7 @@ GUI_OPTION = -g
.ENDIF
.IFDEF WANT_UNIX
-SCRIPT_UNIX = test10.out test12.out test17.out test25.out test27.out test49.out test73.out
+SCRIPT_UNIX = test10.out test12.out test17.out test27.out test49.out test73.out
.ENDIF
.IFDEF WANT_WIN
diff --git a/src/testdir/main.aap b/src/testdir/main.aap
index 51e60de82c..14afaace63 100644
--- a/src/testdir/main.aap
+++ b/src/testdir/main.aap
@@ -7,11 +7,10 @@ VimProg ?= ../vim
Scripts = test1.out test2.out test3.out test6.out
test11.out
test12.out test13.out test14.out test15.out test17.out
- test18.out test19.out test20.out test21.out
- test25.out test27.out
- test28.out test29.out test30.out test32.out
+ test18.out test21.out
+ test27.out test29.out test30.out
test36.out test37.out
- test38.out test39.out test40.out test42.out
+ test39.out test40.out test42.out
test44.out test45.out test46.out test47.out
test48.out test49.out test74.out
diff --git a/src/testdir/test19.in b/src/testdir/test19.in
deleted file mode 100644
index aafa34e521..0000000000
--- a/src/testdir/test19.in
+++ /dev/null
@@ -1,33 +0,0 @@
-Tests for "r<Tab>" with 'smarttab' and 'expandtab' set/not set.
-Also test that dv_ works correctly
-
-STARTTEST
-:so small.vim
-:set smarttab expandtab ts=8 sw=4
-:" make sure that backspace works, no matter what termcap is used
-:set t_kD=x7f t_kb=x08
-/some
-r :set noexpandtab
-/other
-r
-:" Test replacing with Tabs and then backspacing to undo it
-0wR 
-:" Test replacing with Tabs
-0wR 
-:" Test that copyindent works with expandtab set
-:set expandtab smartindent copyindent ts=8 sw=8 sts=8
-o{
-x:set nosol
-/Second line/
-fwdv_:?^start?,$w! test.out
-:qa!
-ENDTEST
-
-start text
- some test text
-test text
- other test text
- a cde
- f ghi
-test text
- Second line beginning with whitespace
diff --git a/src/testdir/test19.ok b/src/testdir/test19.ok
deleted file mode 100644
index 4146214919..0000000000
--- a/src/testdir/test19.ok
+++ /dev/null
@@ -1,10 +0,0 @@
-start text
- ome test text
-test text
- ther test text
- a cde
- hi
-test text
-{
- x
- with whitespace
diff --git a/src/testdir/test20.in b/src/testdir/test20.in
deleted file mode 100644
index 662a1439f2..0000000000
--- a/src/testdir/test20.in
+++ /dev/null
@@ -1,28 +0,0 @@
-Tests Blockwise Visual when there are TABs before the text.
-First test for undo working properly when executing commands from a register.
-Also test this in an empty buffer.
-
-STARTTEST
-:so tiny.vim
-G0"ay$k@au
-:new
-@auY:quit!
-GP
-/start here$
-"by$jjlld
-/456$
-jj"bP
-:/56$/,$-1w! test.out
-:qa!
-ENDTEST
-
-123456
-234567
-345678
-
-test text test tex start here
- some text
- test text
-test text
-
-OxjAykdd
diff --git a/src/testdir/test20.ok b/src/testdir/test20.ok
deleted file mode 100644
index 7c50ea8db8..0000000000
--- a/src/testdir/test20.ok
+++ /dev/null
@@ -1,10 +0,0 @@
-123start here56
-234start here67
-345start here78
-
-test text test tex rt here
- somext
- tesext
-test text
-
-
diff --git a/src/testdir/test25.in b/src/testdir/test25.in
deleted file mode 100644
index 4139865daf..0000000000
--- a/src/testdir/test25.in
+++ /dev/null
@@ -1,31 +0,0 @@
-Test for jumping to a tag with 'hidden' set, with symbolic link in path of tag.
-This only works for Unix, because of the symbolic link.
-
-STARTTEST
-:so small.vim
-:set hidden
-:" Create a link from test25.dir to the current directory.
-:!rm -f test25.dir
-:!ln -s . test25.dir
-:" Create tags.text, with the current directory name inserted.
-/tags line
-:r !pwd
-d$/test
-hP:.w! tags.test
-:" Try jumping to a tag in the current file, but with a path that contains a
-:" symbolic link. When wrong, this will give the ATTENTION message. The next
-:" space will then be eaten by hit-return, instead of moving the cursor to 'd'.
-:set tags=tags.test
-G x:.w! test.out
-:!rm -f test25.dir tags.test
-:qa!
-ENDTEST
-
-tags line:
-SECTION_OFF /test25.dir/test25.in /^#define SECTION_OFF 3$/
-
-/*tx.c*/
-#define SECTION_OFF 3
-#define NUM_SECTIONS 3
-
-SECTION_OFF
diff --git a/src/testdir/test25.ok b/src/testdir/test25.ok
deleted file mode 100644
index 08fc070b7b..0000000000
--- a/src/testdir/test25.ok
+++ /dev/null
@@ -1 +0,0 @@
-#efine SECTION_OFF 3
diff --git a/src/testdir/test28.in b/src/testdir/test28.in
deleted file mode 100644
index 5542c92666..0000000000
--- a/src/testdir/test28.in
+++ /dev/null
Binary files differ
diff --git a/src/testdir/test28.ok b/src/testdir/test28.ok
deleted file mode 100644
index 911d854655..0000000000
--- a/src/testdir/test28.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-sd
-map __2 asdsecondsdsd0map __5 asd0fifth
diff --git a/src/testdir/test32.in b/src/testdir/test32.in
deleted file mode 100644
index 602d9e5516..0000000000
--- a/src/testdir/test32.in
+++ /dev/null
@@ -1,61 +0,0 @@
-Test for insert expansion
-
-:se cpt=.,w
-* add-expands (word from next line) from other window
-* add-expands (current buffer first)
-* Local expansion, ends in an empty line (unless it becomes a global expansion)
-* starts Local and switches to global add-expansion
-:se cpt=.,w,i
-* i-add-expands and switches to local
-* add-expands lines (it would end in an empty line if it didn't ignored it self)
-:se cpt=kXtestfile
-* checks k-expansion, and file expansion (use Xtest11 instead of test11,
-* because TEST11.OUT may match first on DOS)
-:se cpt=w
-* checks make_cyclic in other window
-:se cpt=u nohid
-* checks unloaded buffer expansion
-* checks adding mode abortion
-:se cpt=t,d
-* tag expansion, define add-expansion interrupted
-* t-expansion
-
-STARTTEST
-:so small.vim
-:se nocp viminfo+=nviminfo cpt=.,w ff=unix | $-2,$w!Xtestfile | set ff&
-:set belloff=all
-:se cot=
-nO#include "Xtestfile"
-ru
-O
-
-
-:se cpt=.,w,i
-kOM
-  
-:se cpt=kXtestfile
-:w Xtest11.one
-:w Xtest11.two
-OIXA
-:" use CTRL-X CTRL-F to complete Xtest11.one, remove it and then use
-:" CTRL-X CTRL-F again to verify this doesn't cause trouble.
-OXddk
-:se cpt=w
-OST
-:se cpt=u nohid
-oOEN
-unl
-:se cpt=t,d def=^\\k* tags=Xtestfile notagbsearch
-O
-a
-:wq! test.out
-ENDTEST
-
-start of testfile
-run1
-run2
-end of testfile
-
-test11 36Gepeto /Tag/
-asd test11file 36G
-Makefile to run
diff --git a/src/testdir/test32.ok b/src/testdir/test32.ok
deleted file mode 100644
index afc4463fac..0000000000
--- a/src/testdir/test32.ok
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "Xtestfile"
-run1 run3
-run3 run3
-
-Makefile to run3
-Makefile to run3
-Makefile to run3
-Xtest11.two
-STARTTEST
-ENDTEST
-unless
-test11file 36Gepeto /Tag/ asd
-asd
-run1 run2
-
diff --git a/src/testdir/test38.in b/src/testdir/test38.in
deleted file mode 100644
index 3e0236251b..0000000000
--- a/src/testdir/test38.in
+++ /dev/null
@@ -1,35 +0,0 @@
-
-Test Virtual replace mode.
-
-STARTTEST
-:so small.vim
-:" make sure that backspace works, no matter what termcap is used
-:set t_kD=x7f t_kb=x08
-ggdGa
-abcdefghi
-jk lmn
- opq rst
-uvwxyz
-gg:set ai
-:set bs=2
-gR0 1
-A
-BCDEFGHIJ
- KL
-MNO
-PQRG:ka
-o0
-abcdefghi
-jk lmn
- opq rst
-uvwxyz
-'ajgR0 1
-A
-BCDEFGHIJ
- KL
-MNO
-PQR:$
-iab cdefghi jkl0gRAB......CDEFGHI.Jo:
-iabcdefghijklmnopqrst0gRAB IJKLMNO QR:wq! test.out
-ENDTEST
-
diff --git a/src/testdir/test38.ok b/src/testdir/test38.ok
deleted file mode 100644
index e10209667b..0000000000
--- a/src/testdir/test38.ok
+++ /dev/null
@@ -1,13 +0,0 @@
- 1
- A
- BCDEFGHIJ
- KL
- MNO
- PQR
- 1
-abcdefghi
-jk lmn
- opq rst
-uvwxyz
-AB......CDEFGHI.Jkl
-AB IJKLMNO QRst
diff --git a/src/testdir/test66.in b/src/testdir/test66.in
deleted file mode 100644
index f1fdce3792..0000000000
--- a/src/testdir/test66.in
+++ /dev/null
@@ -1,33 +0,0 @@
-
-Test for visual block shift and tab characters.
-
-STARTTEST
-:so small.vim
-/^one
-fe4jRugvr1:'<,'>w! test.out
-/^abcdefgh
-4jI j<<11|D
-7|a 
-7|a 
-7|a 4k13|4j<
-:$-5,$w >> test.out
-:$-4,$s/\s\+//g
-4kI j<<
-7|a 
-7|a 
-7|a 4k13|4j3<
-:$-4,$w >> test.out
-:qa!
-ENDTEST
-
-one two three
-one two three
-one two three
-one two three
-one two three
-
-abcdefghijklmnopqrstuvwxyz
-abcdefghijklmnopqrstuvwxyz
-abcdefghijklmnopqrstuvwxyz
-abcdefghijklmnopqrstuvwxyz
-abcdefghijklmnopqrstuvwxyz
diff --git a/src/testdir/test66.ok b/src/testdir/test66.ok
deleted file mode 100644
index 4c3ab0fb56..0000000000
--- a/src/testdir/test66.ok
+++ /dev/null
@@ -1,16 +0,0 @@
-on1 two three
-on1 two three
-on1 two three
-on1 two three
-on1 two three
-
- abcdefghijklmnopqrstuvwxyz
-abcdefghij
- abc defghijklmnopqrstuvwxyz
- abc defghijklmnopqrstuvwxyz
- abc defghijklmnopqrstuvwxyz
- abcdefghijklmnopqrstuvwxyz
-abcdefghij
- abc defghijklmnopqrstuvwxyz
- abc defghijklmnopqrstuvwxyz
- abc defghijklmnopqrstuvwxyz
diff --git a/src/testdir/test79.in b/src/testdir/test79.in
deleted file mode 100644
index 8278bd8000..0000000000
--- a/src/testdir/test79.in
+++ /dev/null
Binary files differ
diff --git a/src/testdir/test79.ok b/src/testdir/test79.ok
deleted file mode 100644
index e22eee0b71..0000000000
--- a/src/testdir/test79.ok
+++ /dev/null
Binary files differ
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
new file mode 100644
index 0000000000..2dd2fb7536
--- /dev/null
+++ b/src/testdir/test_ins_complete.vim
@@ -0,0 +1,91 @@
+
+" Test for insert expansion
+func Test_ins_complete()
+ set ff=unix
+ call writefile(["test11\t36Gepeto\t/Tag/",
+ \ "asd\ttest11file\t36G",
+ \ "Makefile\tto\trun"], 'Xtestfile')
+ call writefile(['', 'start of testfile',
+ \ 'ru',
+ \ 'run1',
+ \ 'run2',
+ \ 'STARTTEST',
+ \ 'ENDTEST',
+ \ 'end of testfile'], 'Xtestdata')
+ set ff&
+
+ enew!
+ edit Xtestdata
+ new
+ call append(0, ['#include "Xtestfile"', ''])
+ call cursor(2, 1)
+
+ set cot=
+ set cpt=.,w
+ " add-expands (word from next line) from other window
+ exe "normal iru\<C-N>\<C-N>\<C-X>\<C-N>\<Esc>\<C-A>"
+ call assert_equal('run1 run3', getline('.'))
+ " add-expands (current buffer first)
+ exe "normal o\<C-P>\<C-X>\<C-N>"
+ call assert_equal('run3 run3', getline('.'))
+ " Local expansion, ends in an empty line (unless it becomes a global
+ " expansion)
+ exe "normal o\<C-X>\<C-P>\<C-P>\<C-P>\<C-P>\<C-P>"
+ call assert_equal('', getline('.'))
+ " starts Local and switches to global add-expansion
+ exe "normal o\<C-X>\<C-P>\<C-P>\<C-X>\<C-X>\<C-N>\<C-X>\<C-N>\<C-N>"
+ call assert_equal('run1 run2', getline('.'))
+
+ set cpt=.,w,i
+ " i-add-expands and switches to local
+ exe "normal OM\<C-N>\<C-X>\<C-N>\<C-X>\<C-N>\<C-X>\<C-X>\<C-X>\<C-P>"
+ call assert_equal("Makefile\tto\trun3", getline('.'))
+ " add-expands lines (it would end in an empty line if it didn't ignored
+ " itself)
+ exe "normal o\<C-X>\<C-L>\<C-X>\<C-L>\<C-P>\<C-P>"
+ call assert_equal("Makefile\tto\trun3", getline('.'))
+ call assert_equal("Makefile\tto\trun3", getline(line('.') - 1))
+
+ set cpt=kXtestfile
+ " checks k-expansion, and file expansion (use Xtest11 instead of test11,
+ " because TEST11.OUT may match first on DOS)
+ write Xtest11.one
+ write Xtest11.two
+ exe "normal o\<C-N>\<Esc>IX\<Esc>A\<C-X>\<C-F>\<C-N>"
+ call assert_equal('Xtest11.two', getline('.'))
+
+ " use CTRL-X CTRL-F to complete Xtest11.one, remove it and then use CTRL-X
+ " CTRL-F again to verify this doesn't cause trouble.
+ exe "normal oXt\<C-X>\<C-F>\<BS>\<BS>\<BS>\<BS>\<BS>\<BS>\<BS>\<BS>\<C-X>\<C-F>"
+ call assert_equal('Xtest11.one', getline('.'))
+ normal ddk
+
+ set cpt=w
+ " checks make_cyclic in other window
+ exe "normal oST\<C-N>\<C-P>\<C-P>\<C-P>\<C-P>"
+ call assert_equal('STARTTEST', getline('.'))
+
+ set cpt=u nohid
+ " checks unloaded buffer expansion
+ only
+ exe "normal oEN\<C-N>"
+ call assert_equal('ENDTEST', getline('.'))
+ " checks adding mode abortion
+ exe "normal ounl\<C-N>\<C-X>\<C-X>\<C-P>"
+ call assert_equal('unless', getline('.'))
+
+ set cpt=t,d def=^\\k* tags=Xtestfile notagbsearch
+ " tag expansion, define add-expansion interrupted
+ exe "normal o\<C-X>\<C-]>\<C-X>\<C-D>\<C-X>\<C-D>\<C-X>\<C-X>\<C-D>\<C-X>\<C-D>\<C-X>\<C-D>\<C-X>\<C-D>"
+ call assert_equal('test11file 36Gepeto /Tag/ asd', getline('.'))
+ " t-expansion
+ exe "normal oa\<C-N>\<Esc>"
+ call assert_equal('asd', getline('.'))
+
+ %bw!
+ call delete('Xtestfile')
+ call delete('Xtest11.one')
+ call delete('Xtest11.two')
+ call delete('Xtestdata')
+ set cpt& cot& def& tags& tagbsearch& hidden&
+endfunc
diff --git a/src/testdir/test_source_utf8.vim b/src/testdir/test_source_utf8.vim
index edb76fc43d..c29c2ec1f3 100644
--- a/src/testdir/test_source_utf8.vim
+++ b/src/testdir/test_source_utf8.vim
@@ -31,3 +31,33 @@ func Test_source_latin()
bwipe!
call delete('Xscript')
endfunc
+
+" Test for sourcing a file with CTRL-V's at the end of the line
+func Test_source_ctrl_v()
+ call writefile(['map __1 afirst',
+ \ 'map __2 asecond',
+ \ 'map __3 athird',
+ \ 'map __4 afourth',
+ \ 'map __5 afifth',
+ \ "map __1 asd\<C-V>",
+ \ "map __2 asd\<C-V>\<C-V>",
+ \ "map __3 asd\<C-V>\<C-V>",
+ \ "map __4 asd\<C-V>\<C-V>\<C-V>",
+ \ "map __5 asd\<C-V>\<C-V>\<C-V>",
+ \ ], 'Xtestfile')
+ source Xtestfile
+ enew!
+ exe "normal __1\<Esc>\<Esc>__2\<Esc>__3\<Esc>\<Esc>__4\<Esc>__5\<Esc>"
+ exe "%s/\<C-J>/0/g"
+ call assert_equal(['sd',
+ \ "map __2 asd\<Esc>secondsd\<Esc>sd0map __5 asd0fifth"],
+ \ getline(1, 2))
+
+ enew!
+ call delete('Xtestfile')
+ unmap __1
+ unmap __2
+ unmap __3
+ unmap __4
+ unmap __5
+endfunc
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim
index cd598dc3ca..1c23f8c6a1 100644
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -294,3 +294,209 @@ func Test_sub_replace_10()
call assert_equal('aa2a3a', substitute('123', '1\|\ze', 'a', 'g'))
call assert_equal('1aaa', substitute('123', '1\zs\|[23]', 'a', 'g'))
endfunc
+
+" Tests for *sub-replace-special* and *sub-replace-expression* on :substitute.
+
+" Execute a list of :substitute command tests
+func Run_SubCmd_Tests(tests)
+ enew!
+ for t in a:tests
+ let start = line('.') + 1
+ let end = start + len(t[2]) - 1
+ exe "normal o" . t[0]
+ call cursor(start, 1)
+ exe t[1]
+ call assert_equal(t[2], getline(start, end), t[1])
+ endfor
+ enew!
+endfunc
+
+func Test_sub_cmd_1()
+ set magic
+ set cpo&
+
+ " List entry format: [input, cmd, output]
+ let tests = [['A', 's/A/&&/', ['AA']],
+ \ ['B', 's/B/\&/', ['&']],
+ \ ['C123456789', 's/C\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)/\0\9\8\7\6\5\4\3\2\1/', ['C123456789987654321']],
+ \ ['D', 's/D/d/', ['d']],
+ \ ['E', 's/E/~/', ['d']],
+ \ ['F', 's/F/\~/', ['~']],
+ \ ['G', 's/G/\ugg/', ['Gg']],
+ \ ['H', 's/H/\Uh\Eh/', ['Hh']],
+ \ ['I', 's/I/\lII/', ['iI']],
+ \ ['J', 's/J/\LJ\EJ/', ['jJ']],
+ \ ['K', 's/K/\Uk\ek/', ['Kk']],
+ \ ['lLl', "s/L/\<C-V>\<C-M>/", ["l\<C-V>", 'l']],
+ \ ['mMm', 's/M/\r/', ['m', 'm']],
+ \ ['nNn', "s/N/\\\<C-V>\<C-M>/", ["n\<C-V>", 'n']],
+ \ ['oOo', 's/O/\n/', ["o\no"]],
+ \ ['pPp', 's/P/\b/', ["p\<C-H>p"]],
+ \ ['qQq', 's/Q/\t/', ["q\tq"]],
+ \ ['rRr', 's/R/\\/', ['r\r']],
+ \ ['sSs', 's/S/\c/', ['scs']],
+ \ ['tTt', "s/T/\<C-V>\<C-J>/", ["t\<C-V>\<C-J>t"]],
+ \ ['U', 's/U/\L\uuUu\l\EU/', ['UuuU']],
+ \ ['V', 's/V/\U\lVvV\u\Ev/', ['vVVv']]
+ \ ]
+ call Run_SubCmd_Tests(tests)
+endfunc
+
+func Test_sub_cmd_2()
+ set nomagic
+ set cpo&
+
+ " List entry format: [input, cmd, output]
+ let tests = [['A', 's/A/&&/', ['&&']],
+ \ ['B', 's/B/\&/', ['B']],
+ \ ['C123456789', 's/\mC\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)/\0\9\8\7\6\5\4\3\2\1/', ['C123456789987654321']],
+ \ ['D', 's/D/d/', ['d']],
+ \ ['E', 's/E/~/', ['~']],
+ \ ['F', 's/F/\~/', ['~']],
+ \ ['G', 's/G/\ugg/', ['Gg']],
+ \ ['H', 's/H/\Uh\Eh/', ['Hh']],
+ \ ['I', 's/I/\lII/', ['iI']],
+ \ ['J', 's/J/\LJ\EJ/', ['jJ']],
+ \ ['K', 's/K/\Uk\ek/', ['Kk']],
+ \ ['lLl', "s/L/\<C-V>\<C-M>/", ["l\<C-V>", 'l']],
+ \ ['mMm', 's/M/\r/', ['m', 'm']],
+ \ ['nNn', "s/N/\\\<C-V>\<C-M>/", ["n\<C-V>", 'n']],
+ \ ['oOo', 's/O/\n/', ["o\no"]],
+ \ ['pPp', 's/P/\b/', ["p\<C-H>p"]],
+ \ ['qQq', 's/Q/\t/', ["q\tq"]],
+ \ ['rRr', 's/R/\\/', ['r\r']],
+ \ ['sSs', 's/S/\c/', ['scs']],
+ \ ['tTt', "s/T/\<C-V>\<C-J>/", ["t\<C-V>\<C-J>t"]],
+ \ ['U', 's/U/\L\uuUu\l\EU/', ['UuuU']],
+ \ ['V', 's/V/\U\lVvV\u\Ev/', ['vVVv']]
+ \ ]
+ call Run_SubCmd_Tests(tests)
+endfunc
+
+func Test_sub_cmd_3()
+ set nomagic
+ set cpo&
+
+ " List entry format: [input, cmd, output]
+ let tests = [['aAa', "s/A/\\='\\'/", ['a\a']],
+ \ ['bBb', "s/B/\\='\\\\'/", ['b\\b']],
+ \ ['cCc', "s/C/\\='\<C-V>\<C-M>'/", ["c\<C-V>", 'c']],
+ \ ['dDd', "s/D/\\='\\\<C-V>\<C-M>'/", ["d\\\<C-V>", 'd']],
+ \ ['eEe', "s/E/\\='\\\\\<C-V>\<C-M>'/", ["e\\\\\<C-V>", 'e']],
+ \ ['fFf', "s/F/\\='\r'/", ['f', 'f']],
+ \ ['gGg', "s/G/\\='\<C-V>\<C-J>'/", ["g\<C-V>", 'g']],
+ \ ['hHh', "s/H/\\='\\\<C-V>\<C-J>'/", ["h\\\<C-V>", 'h']],
+ \ ['iIi', "s/I/\\='\\\\\<C-V>\<C-J>'/", ["i\\\\\<C-V>", 'i']],
+ \ ['jJj', "s/J/\\='\n'/", ['j', 'j']],
+ \ ['kKk', 's/K/\="\r"/', ['k', 'k']],
+ \ ['lLl', 's/L/\="\n"/', ['l', 'l']]
+ \ ]
+ call Run_SubCmd_Tests(tests)
+endfunc
+
+" Test for submatch() on :substitue.
+func Test_sub_cmd_4()
+ set magic&
+ set cpo&
+
+ " List entry format: [input, cmd, output]
+ let tests = [ ['aAa', "s/A/\\=substitute(submatch(0), '.', '\\', '')/",
+ \ ['a\a']],
+ \ ['bBb', "s/B/\\=substitute(submatch(0), '.', '\\', '')/",
+ \ ['b\b']],
+ \ ['cCc', "s/C/\\=substitute(submatch(0), '.', '\<C-V>\<C-M>', '')/",
+ \ ["c\<C-V>", 'c']],
+ \ ['dDd', "s/D/\\=substitute(submatch(0), '.', '\\\<C-V>\<C-M>', '')/",
+ \ ["d\<C-V>", 'd']],
+ \ ['eEe', "s/E/\\=substitute(submatch(0), '.', '\\\\\<C-V>\<C-M>', '')/",
+ \ ["e\\\<C-V>", 'e']],
+ \ ['fFf', "s/F/\\=substitute(submatch(0), '.', '\\r', '')/",
+ \ ['f', 'f']],
+ \ ['gGg', 's/G/\=substitute(submatch(0), ".", "\<C-V>\<C-J>", "")/',
+ \ ["g\<C-V>", 'g']],
+ \ ['hHh', 's/H/\=substitute(submatch(0), ".", "\\\<C-V>\<C-J>", "")/',
+ \ ["h\<C-V>", 'h']],
+ \ ['iIi', 's/I/\=substitute(submatch(0), ".", "\\\\\<C-V>\<C-J>", "")/',
+ \ ["i\\\<C-V>", 'i']],
+ \ ['jJj', "s/J/\\=substitute(submatch(0), '.', '\\n', '')/",
+ \ ['j', 'j']],
+ \ ['kKk', "s/K/\\=substitute(submatch(0), '.', '\\r', '')/",
+ \ ['k', 'k']],
+ \ ['lLl', "s/L/\\=substitute(submatch(0), '.', '\\n', '')/",
+ \ ['l', 'l']],
+ \ ]
+ call Run_SubCmd_Tests(tests)
+endfunc
+
+func Test_sub_cmd_5()
+ set magic&
+ set cpo&
+
+ " List entry format: [input, cmd, output]
+ let tests = [ ['A123456789', 's/A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)/\=submatch(0) . submatch(9) . submatch(8) . submatch(7) . submatch(6) . submatch(5) . submatch(4) . submatch(3) . submatch(2) . submatch(1)/', ['A123456789987654321']],
+ \ ['B123456789', 's/B\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)/\=string([submatch(0, 1), submatch(9, 1), submatch(8, 1), submatch(7, 1), submatch(6, 1), submatch(5, 1), submatch(4, 1), submatch(3, 1), submatch(2, 1), submatch(1, 1)])/', ["[['B123456789'], ['9'], ['8'], ['7'], ['6'], ['5'], ['4'], ['3'],