0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.0.1447: still too many old style tests

Problem:    Still too many old style tests.
Solution:   Turn a few tests into new style. (Yegappan Lakshmanan,
            closes #2509)
This commit is contained in:
Bram Moolenaar
2018-01-31 19:30:24 +01:00
parent 6f361c9912
commit cada78975e
14 changed files with 608 additions and 581 deletions

View File

@@ -2101,10 +2101,10 @@ run_message_test: $(MESSAGE_TEST_TARGET)
# These do not depend on the executable, compile it when needed. # These do not depend on the executable, compile it when needed.
test1 \ test1 \
test_eval \ test_eval \
test3 test11 test14 test15 test17 \ test3 test11 test14 test17 \
test29 test30 test36 test37 test39 \ test29 test30 test37 test39 \
test42 test44 test48 test49 \ test42 test44 test48 test49 \
test50 test52 test59 \ test52 test59 \
test64 test69 \ test64 test69 \
test70 test72 \ test70 test72 \
test85 test86 test87 test88 \ test85 test86 test87 test88 \

View File

@@ -15,9 +15,7 @@ SCRIPTS_FIRST = \
SCRIPTS_ALL = \ SCRIPTS_ALL = \
test3.out \ test3.out \
test14.out \ test14.out \
test15.out \
test29.out \ test29.out \
test36.out \
test37.out \ test37.out \
test39.out \ test39.out \
test42.out \ test42.out \
@@ -57,7 +55,7 @@ SCRIPTS_MORE4 = \
# Tests specifically for MS-Windows. # Tests specifically for MS-Windows.
SCRIPTS_WIN32 = test50.out SCRIPTS_WIN32 =
# Tests for the GUI. # Tests for the GUI.
@@ -158,6 +156,7 @@ NEW_TESTS = test_arabic.res \
test_ruby.res \ test_ruby.res \
test_scrollbind.res \ test_scrollbind.res \
test_search.res \ test_search.res \
test_shortpathname.res \
test_signs.res \ test_signs.res \
test_smartindent.res \ test_smartindent.res \
test_spell.res \ test_spell.res \

View File

@@ -74,9 +74,9 @@ VIMPROG = <->vim.exe
.SUFFIXES : .out .in .SUFFIXES : .out .in
SCRIPT = test1.out test3.out \ SCRIPT = test1.out test3.out \
test14.out test15.out \ test14.out \
test29.out \ test29.out \
test30.out test36.out test37.out test39.out \ test30.out test37.out test39.out \
test42.out test44.out test48.out test49.out \ test42.out test44.out test48.out test49.out \
test64.out test69.out \ test64.out test69.out \
test72.out test77a.out test88.out \ test72.out test77a.out test88.out \
@@ -108,7 +108,7 @@ SCRIPT_UNIX = test10.out test17.out test27.out test49.out
.ENDIF .ENDIF
.IFDEF WANT_WIN .IFDEF WANT_WIN
SCRIPT_WIN = test50.out test52.out SCRIPT_WIN = test52.out
.ENDIF .ENDIF
.IFDEF WANT_SPELL .IFDEF WANT_SPELL

View File

@@ -6,10 +6,10 @@ VimProg ?= ../vim
Scripts = test1.out test2.out test3.out test6.out Scripts = test1.out test2.out test3.out test6.out
test11.out test11.out
test13.out test14.out test15.out test17.out test13.out test14.out test17.out
test18.out test21.out test18.out test21.out
test27.out test29.out test30.out test27.out test29.out test30.out
test36.out test37.out test37.out
test39.out test42.out test39.out test42.out
test44.out test46.out test47.out test44.out test46.out test47.out
test48.out test49.out test74.out test48.out test49.out test74.out

View File

@@ -1,136 +0,0 @@
Tests for :right on text with embedded TAB.
Also test formatting a paragraph.
Also test undo after ":%s" and formatting.
STARTTEST
:so small.vim
:set tw=65
:/^\s*test for :left/,/^\s*test for :center/ left
:/^\s*test for :center/,/^\s*test for :right/ center
:/^\s*test for :right/,/^xxx/-1 right
:set fo+=tcroql tw=72
/xxxxxxxx$
0gq6kk
:set nocp viminfo+=nviminfo
:" undo/redo here to make the next undo only work on the following changes
u
:map gg :.,.+2s/^/x/<CR>kk:set tw=3<CR>gqq
/^aa
ggu
:?test for :left?,$w! test.out
:qa!
ENDTEST
test for :left
a a
fa a
dfa a
sdfa a
asdfa a
xasdfa a
asxxdfa a
test for :center
a a
fa afd asdf
dfa a
sdfa afd asdf
asdfa a
xasdfa asdfasdfasdfasdfasdf
asxxdfa a
test for :right
a a
fa a
dfa a
sdfa a
asdfa a
xasdfa a
asxxdfa a
asxa;ofa a
asdfaqwer a
a ax
fa ax
dfa ax
sdfa ax
asdfa ax
xasdfa ax
asxxdfa ax
asxa;ofa ax
asdfaqwer ax
a axx
fa axx
dfa axx
sdfa axx
asdfa axx
xasdfa axx
asxxdfa axx
asxa;ofa axx
asdfaqwer axx
a axxx
fa axxx
dfa axxx
sdfa axxx
asdfa axxx
xasdfa axxx
asxxdfa axxx
asxa;ofa axxx
asdfaqwer axxx
a axxxo
fa axxxo
dfa axxxo
sdfa axxxo
asdfa axxxo
xasdfa axxxo
asxxdfa axxxo
asxa;ofa axxxo
asdfaqwer axxxo
a axxxoi
fa axxxoi
dfa axxxoi
sdfa axxxoi
asdfa axxxoi
xasdfa axxxoi
asxxdfa axxxoi
asxa;ofa axxxoi
asdfaqwer axxxoi
a axxxoik
fa axxxoik
dfa axxxoik
sdfa axxxoik
asdfa axxxoik
xasdfa axxxoik
asxxdfa axxxoik
asxa;ofa axxxoik
asdfaqwer axxxoik
a axxxoike
fa axxxoike
dfa axxxoike
sdfa axxxoike
asdfa axxxoike
xasdfa axxxoike
asxxdfa axxxoike
asxa;ofa axxxoike
asdfaqwer axxxoike
a axxxoikey
fa axxxoikey
dfa axxxoikey
sdfa axxxoikey
asdfa axxxoikey
xasdfa axxxoikey
asxxdfa axxxoikey
asxa;ofa axxxoikey
asdfaqwer axxxoikey
xxxxx xx xxxxxx
xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx
xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx
xx xxxxxxx. xxxx xxxx.
> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx
> xxxxxx xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx
aa aa aa aa
bb bb bb bb
cc cc cc cc

View File

@@ -1,111 +0,0 @@
test for :left
a a
fa a
dfa a
sdfa a
asdfa a
xasdfa a
asxxdfa a
test for :center
a a
fa afd asdf
dfa a
sdfa afd asdf
asdfa a
xasdfa asdfasdfasdfasdfasdf
asxxdfa a
test for :right
a a
fa a
dfa a
sdfa a
asdfa a
xasdfa a
asxxdfa a
asxa;ofa a
asdfaqwer a
a ax
fa ax
dfa ax
sdfa ax
asdfa ax
xasdfa ax
asxxdfa ax
asxa;ofa ax
asdfaqwer ax
a axx
fa axx
dfa axx
sdfa axx
asdfa axx
xasdfa axx
asxxdfa axx
asxa;ofa axx
asdfaqwer axx
a axxx
fa axxx
dfa axxx
sdfa axxx
asdfa axxx
xasdfa axxx
asxxdfa axxx
asxa;ofa axxx
asdfaqwer axxx
a axxxo
fa axxxo
dfa axxxo
sdfa axxxo
asdfa axxxo
xasdfa axxxo
asxxdfa axxxo
asxa;ofa axxxo
asdfaqwer axxxo
a axxxoi
fa axxxoi
dfa axxxoi
sdfa axxxoi
asdfa axxxoi
xasdfa axxxoi
asxxdfa axxxoi
asxa;ofa axxxoi
asdfaqwer axxxoi
a axxxoik
fa axxxoik
dfa axxxoik
sdfa axxxoik
asdfa axxxoik
xasdfa axxxoik
asxxdfa axxxoik
asxa;ofa axxxoik
asdfaqwer axxxoik
a axxxoike
fa axxxoike
dfa axxxoike
sdfa axxxoike
asdfa axxxoike
xasdfa axxxoike
asxxdfa axxxoike
asxa;ofa axxxoike
asdfaqwer axxxoike
a axxxoikey
fa axxxoikey
dfa axxxoikey
sdfa axxxoikey
asdfa axxxoikey
xasdfa axxxoikey
asxxdfa axxxoikey
asxa;ofa axxxoikey
asdfaqwer axxxoikey
xxxxx xx xxxxxx xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx
xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx xx xxxxxxx.
xxxx xxxx.
> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx xxxxxx
> xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx
aa aa aa aa
bb bb bb bb
cc cc cc cc

View File

@@ -1,114 +0,0 @@
Test character classes in regexp using regexpengine 0, 1, 2.
STARTTEST
/^start-here/+1
Y:s/\%#=0\d//g
p:s/\%#=1\d//g
p:s/\%#=2\d//g
p:s/\%#=0[0-9]//g
p:s/\%#=1[0-9]//g
p:s/\%#=2[0-9]//g
p:s/\%#=0\D//g
p:s/\%#=1\D//g
p:s/\%#=2\D//g
p:s/\%#=0[^0-9]//g
p:s/\%#=1[^0-9]//g
p:s/\%#=2[^0-9]//g
p:s/\%#=0\o//g
p:s/\%#=1\o//g
p:s/\%#=2\o//g
p:s/\%#=0[0-7]//g
p:s/\%#=1[0-7]//g
p:s/\%#=2[0-7]//g
p:s/\%#=0\O//g
p:s/\%#=1\O//g
p:s/\%#=2\O//g
p:s/\%#=0[^0-7]//g
p:s/\%#=1[^0-7]//g
p:s/\%#=2[^0-7]//g
p:s/\%#=0\x//g
p:s/\%#=1\x//g
p:s/\%#=2\x//g
p:s/\%#=0[0-9A-Fa-f]//g
p:s/\%#=1[0-9A-Fa-f]//g
p:s/\%#=2[0-9A-Fa-f]//g
p:s/\%#=0\X//g
p:s/\%#=1\X//g
p:s/\%#=2\X//g
p:s/\%#=0[^0-9A-Fa-f]//g
p:s/\%#=1[^0-9A-Fa-f]//g
p:s/\%#=2[^0-9A-Fa-f]//g
p:s/\%#=0\w//g
p:s/\%#=1\w//g
p:s/\%#=2\w//g
p:s/\%#=0[0-9A-Za-z_]//g
p:s/\%#=1[0-9A-Za-z_]//g
p:s/\%#=2[0-9A-Za-z_]//g
p:s/\%#=0\W//g
p:s/\%#=1\W//g
p:s/\%#=2\W//g
p:s/\%#=0[^0-9A-Za-z_]//g
p:s/\%#=1[^0-9A-Za-z_]//g
p:s/\%#=2[^0-9A-Za-z_]//g
p:s/\%#=0\h//g
p:s/\%#=1\h//g
p:s/\%#=2\h//g
p:s/\%#=0[A-Za-z_]//g
p:s/\%#=1[A-Za-z_]//g
p:s/\%#=2[A-Za-z_]//g
p:s/\%#=0\H//g
p:s/\%#=1\H//g
p:s/\%#=2\H//g
p:s/\%#=0[^A-Za-z_]//g
p:s/\%#=1[^A-Za-z_]//g
p:s/\%#=2[^A-Za-z_]//g
p:s/\%#=0\a//g
p:s/\%#=1\a//g
p:s/\%#=2\a//g
p:s/\%#=0[A-Za-z]//g
p:s/\%#=1[A-Za-z]//g
p:s/\%#=2[A-Za-z]//g
p:s/\%#=0\A//g
p:s/\%#=1\A//g
p:s/\%#=2\A//g
p:s/\%#=0[^A-Za-z]//g
p:s/\%#=1[^A-Za-z]//g
p:s/\%#=2[^A-Za-z]//g
p:s/\%#=0\l//g
p:s/\%#=1\l//g
p:s/\%#=2\l//g
p:s/\%#=0[a-z]//g
p:s/\%#=1[a-z]//g
p:s/\%#=2[a-z]//g
p:s/\%#=0\L//g
p:s/\%#=1\L//g
p:s/\%#=2\L//g
p:s/\%#=0[^a-z]//g
p:s/\%#=1[^a-z]//g
p:s/\%#=2[^a-z]//g
p:s/\%#=0\u//g
p:s/\%#=1\u//g
p:s/\%#=2\u//g
p:s/\%#=0[A-Z]//g
p:s/\%#=1[A-Z]//g
p:s/\%#=2[A-Z]//g
p:s/\%#=0\U//g
p:s/\%#=1\U//g
p:s/\%#=2\U//g
p:s/\%#=0[^A-Z]//g
p:s/\%#=1[^A-Z]//g
p:s/\%#=2[^A-Z]//g
p:s/\%#=0\%210l^\t...//g
p:s/\%#=1\%211l^\t...//g
p:s/\%#=2\%212l^\t...//g
p:s/\%#=0[0-z]//g
p:s/\%#=1[0-z]//g
p:s/\%#=2[0-z]//g
p:s/\%#=0[^0-z]//g
p:s/\%#=1[^0-z]//g
p:s/\%#=2[^0-z]//g
:/^start-here/+1,$wq! test.out
ENDTEST
start-here

View File

@@ -1,105 +0,0 @@
!"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
!"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
01234567
01234567
01234567
01234567
01234567
01234567
!"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
0123456789ABCDEFabcdef
0123456789ABCDEFabcdef
0123456789ABCDEFabcdef
0123456789ABCDEFabcdef
0123456789ABCDEFabcdef
0123456789ABCDEFabcdef
!"#$%&'()#+'-./:;<=>?@[\]^`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./:;<=>?@[\]^`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./:;<=>?@[\]^`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./:;<=>?@[\]^`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./:;<=>?@[\]^`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./:;<=>?@[\]^`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
0123456789ABCDEFGHIXYZ_abcdefghiwxyz
0123456789ABCDEFGHIXYZ_abcdefghiwxyz
0123456789ABCDEFGHIXYZ_abcdefghiwxyz
0123456789ABCDEFGHIXYZ_abcdefghiwxyz
0123456789ABCDEFGHIXYZ_abcdefghiwxyz
0123456789ABCDEFGHIXYZ_abcdefghiwxyz
!"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ABCDEFGHIXYZ_abcdefghiwxyz
ABCDEFGHIXYZ_abcdefghiwxyz
ABCDEFGHIXYZ_abcdefghiwxyz
ABCDEFGHIXYZ_abcdefghiwxyz
ABCDEFGHIXYZ_abcdefghiwxyz
ABCDEFGHIXYZ_abcdefghiwxyz
!"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
!"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ABCDEFGHIXYZabcdefghiwxyz
ABCDEFGHIXYZabcdefghiwxyz
ABCDEFGHIXYZabcdefghiwxyz

View File

@@ -1,90 +0,0 @@
Test for shortpathname ':8' extension.
Only for use on Win32 systems!
STARTTEST
:so small.vim
:fun! TestIt(file, bits, expected)
let res=fnamemodify(a:file,a:bits)
if a:expected == ''
echo "'".a:file."'->(".a:bits.")->'".res."'"
else
if substitute(res,'/','\\', 'g') != substitute( a:expected, '/','\\', 'g')
echo "FAILED: '".a:file."'->(".a:bits.")->'".res."'"
echo "Expected: '".a:expected."'"
else
echo "OK"
endif
endif
endfun
:fun! MakeDir( dirname )
"exe '!mkdir '.substitute(a:dirname,'/','\\','g')
call system('mkdir '.substitute(a:dirname,'/','\\','g'))
endfun
:fun! RMDir( dirname)
"exe '!rmdir '.substitute(a:dirname,'/','\\','g')
call system('rmdir '.substitute(a:dirname,'/','\\','g'))
endfun
:fun! MakeFile( filename)
"exe '!copy nul '.substitute(a:filename,'/','\\','g')
call system('copy nul '.substitute(a:filename,'/','\\','g'))
endfun
:fun! TestColonEight()
redir! >test.out
" This could change for CygWin to //cygdrive/c
let dir1='c:/x.x.y'
if filereadable(dir1) || isdirectory(dir1)
echo "FATAL: '".dir1."' exists, cannot run test"
return
endif
let file1=dir1.'/zz.y.txt'
let nofile1=dir1.'/z.y.txt'
let dir2=dir1.'/VimIsTheGreatestSinceSlicedBread'
let file2=dir2.'/z.txt'
let nofile2=dir2.'/zz.txt'
call MakeDir( dir1 )
let resdir1 = substitute(fnamemodify(dir1, ':p:8'), '\\$', '', '')
if resdir1 !~ '\V\^c:/XX\x\x\x\x~1.Y\$'
echo "FATAL: unexpected short name: " . resdir1
echo "INFO: please report your OS to vim-dev"
return
endif
let resfile1=resdir1.'/ZZY~1.TXT'
let resnofile1=resdir1.'/z.y.txt'
let resdir2=resdir1.'/VIMIST~1'
let resfile2=resdir2.'/z.txt'
let resnofile2=resdir2.'/zz.txt'
call MakeDir( dir2 )
call MakeFile( file1 )
call MakeFile( file2 )
call TestIt(file1, ':p:8', resfile1)
call TestIt(nofile1, ':p:8', resnofile1)
call TestIt(file2, ':p:8', resfile2)
call TestIt(nofile2, ':p:8', resnofile2)
call TestIt(nofile2, ':p:8:h', fnamemodify(resnofile2,':h'))
exe 'cd '.dir1
call TestIt(file1, ':.:8', strpart(resfile1,strlen(resdir1)+1))
call TestIt(nofile1, ':.:8', strpart(resnofile1,strlen(resdir1)+1))
call TestIt(file2, ':.:8', strpart(resfile2,strlen(resdir1)+1))
call TestIt(nofile2, ':.:8', strpart(resnofile2,strlen(resdir1)+1))
let $HOME=dir1
call TestIt(file1, ':~:8', '~'.strpart(resfile1,strlen(resdir1)))
call TestIt(nofile1, ':~:8', '~'.strpart(resnofile1,strlen(resdir1)))
call TestIt(file2, ':~:8', '~'.strpart(resfile2,strlen(resdir1)))
call TestIt(nofile2, ':~:8', '~'.strpart(resnofile2,strlen(resdir1)))
cd c:/
call delete( file2 )
call delete( file1 )
call RMDir( dir2 )
call RMDir( dir1 )
echo
redir END
endfun
:let dir = getcwd()
:call TestColonEight()
:exe "cd " . dir
:edit! test.out
:set ff=dos
:w
:qa!
ENDTEST

View File

@@ -1,14 +0,0 @@
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK
OK

View File

@@ -1,5 +1,11 @@
" Tests for regexp with backslash and other special characters inside [] " Tests for regexp with backslash and other special characters inside []
" Also test backslash for hex/octal numbered character. " Also test backslash for hex/octal numbered character.
"
if !has('multi_byte')
finish
endif
scriptencoding utf-8
function RunSTest(value, calls, expected) function RunSTest(value, calls, expected)
new new
@@ -56,3 +62,237 @@ function Test_s_search()
call RunSTest(" xyz", "s/~/bcd/", " bcd") call RunSTest(" xyz", "s/~/bcd/", " bcd")
call RunSTest(" bcdbcdbcd", "s/~\\+/BB/", " BB") call RunSTest(" bcdbcdbcd", "s/~\\+/BB/", " BB")
endfunction endfunction
" Test character classes in regexp using regexpengine 0, 1, 2.
func Test_regex_char_classes()
new
let save_enc = &encoding
set encoding=utf-8
let input = "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
" Format is [cmd_to_run, expected_output]
let tests = [
\ [':s/\%#=0\d//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1\d//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2\d//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0[0-9]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1[0-9]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2[0-9]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0\D//g',
\ "0123456789"],
\ [':s/\%#=1\D//g',
\ "0123456789"],
\ [':s/\%#=2\D//g',
\ "0123456789"],
\ [':s/\%#=0[^0-9]//g',
\ "0123456789"],
\ [':s/\%#=1[^0-9]//g',
\ "0123456789"],
\ [':s/\%#=2[^0-9]//g',
\ "0123456789"],
\ [':s/\%#=0\o//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1\o//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2\o//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0[0-7]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1[0-7]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2[0-7]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./89:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0\O//g',
\ "01234567"],
\ [':s/\%#=1\O//g',
\ "01234567"],
\ [':s/\%#=2\O//g',
\ "01234567"],
\ [':s/\%#=0[^0-7]//g',
\ "01234567"],
\ [':s/\%#=1[^0-7]//g',
\ "01234567"],
\ [':s/\%#=2[^0-7]//g',
\ "01234567"],
\ [':s/\%#=0\x//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1\x//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2\x//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0[0-9A-Fa-f]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1[0-9A-Fa-f]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2[0-9A-Fa-f]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@GHIXYZ[\]^_`ghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0\X//g',
\ "0123456789ABCDEFabcdef"],
\ [':s/\%#=1\X//g',
\ "0123456789ABCDEFabcdef"],
\ [':s/\%#=2\X//g',
\ "0123456789ABCDEFabcdef"],
\ [':s/\%#=0[^0-9A-Fa-f]//g',
\ "0123456789ABCDEFabcdef"],
\ [':s/\%#=1[^0-9A-Fa-f]//g',
\ "0123456789ABCDEFabcdef"],
\ [':s/\%#=2[^0-9A-Fa-f]//g',
\ "0123456789ABCDEFabcdef"],
\ [':s/\%#=0\w//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1\w//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2\w//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0[0-9A-Za-z_]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1[0-9A-Za-z_]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2[0-9A-Za-z_]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0\W//g',
\ "0123456789ABCDEFGHIXYZ_abcdefghiwxyz"],
\ [':s/\%#=1\W//g',
\ "0123456789ABCDEFGHIXYZ_abcdefghiwxyz"],
\ [':s/\%#=2\W//g',
\ "0123456789ABCDEFGHIXYZ_abcdefghiwxyz"],
\ [':s/\%#=0[^0-9A-Za-z_]//g',
\ "0123456789ABCDEFGHIXYZ_abcdefghiwxyz"],
\ [':s/\%#=1[^0-9A-Za-z_]//g',
\ "0123456789ABCDEFGHIXYZ_abcdefghiwxyz"],
\ [':s/\%#=2[^0-9A-Za-z_]//g',
\ "0123456789ABCDEFGHIXYZ_abcdefghiwxyz"],
\ [':s/\%#=0\h//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1\h//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2\h//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0[A-Za-z_]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1[A-Za-z_]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2[A-Za-z_]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0\H//g',
\ "ABCDEFGHIXYZ_abcdefghiwxyz"],
\ [':s/\%#=1\H//g',
\ "ABCDEFGHIXYZ_abcdefghiwxyz"],
\ [':s/\%#=2\H//g',
\ "ABCDEFGHIXYZ_abcdefghiwxyz"],
\ [':s/\%#=0[^A-Za-z_]//g',
\ "ABCDEFGHIXYZ_abcdefghiwxyz"],
\ [':s/\%#=1[^A-Za-z_]//g',
\ "ABCDEFGHIXYZ_abcdefghiwxyz"],
\ [':s/\%#=2[^A-Za-z_]//g',
\ "ABCDEFGHIXYZ_abcdefghiwxyz"],
\ [':s/\%#=0\a//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1\a//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2\a//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0[A-Za-z]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1[A-Za-z]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2[A-Za-z]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0\A//g',
\ "ABCDEFGHIXYZabcdefghiwxyz"],
\ [':s/\%#=1\A//g',
\ "ABCDEFGHIXYZabcdefghiwxyz"],
\ [':s/\%#=2\A//g',
\ "ABCDEFGHIXYZabcdefghiwxyz"],
\ [':s/\%#=0[^A-Za-z]//g',
\ "ABCDEFGHIXYZabcdefghiwxyz"],
\ [':s/\%#=1[^A-Za-z]//g',
\ "ABCDEFGHIXYZabcdefghiwxyz"],
\ [':s/\%#=2[^A-Za-z]//g',
\ "ABCDEFGHIXYZabcdefghiwxyz"],
\ [':s/\%#=0\l//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1\l//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2\l//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0[a-z]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1[a-z]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2[a-z]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0\L//g',
\ "abcdefghiwxyz"],
\ [':s/\%#=1\L//g',
\ "abcdefghiwxyz"],
\ [':s/\%#=2\L//g',
\ "abcdefghiwxyz"],
\ [':s/\%#=0[^a-z]//g',
\ "abcdefghiwxyz"],
\ [':s/\%#=1[^a-z]//g',
\ "abcdefghiwxyz"],
\ [':s/\%#=2[^a-z]//g',
\ "abcdefghiwxyz"],
\ [':s/\%#=0\u//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1\u//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2\u//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0[A-Z]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1[A-Z]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2[A-Z]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./0123456789:;<=>?@[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0\U//g',
\ "ABCDEFGHIXYZ"],
\ [':s/\%#=1\U//g',
\ "ABCDEFGHIXYZ"],
\ [':s/\%#=2\U//g',
\ "ABCDEFGHIXYZ"],
\ [':s/\%#=0[^A-Z]//g',
\ "ABCDEFGHIXYZ"],
\ [':s/\%#=1[^A-Z]//g',
\ "ABCDEFGHIXYZ"],
\ [':s/\%#=2[^A-Z]//g',
\ "ABCDEFGHIXYZ"],
\ [':s/\%#=0\%' . line('.') . 'l^\t...//g',
\ "!\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1\%' . line('.') . 'l^\t...//g',
\ "!\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2\%' . line('.') . 'l^\t...//g',
\ "!\"#$%&'()#+'-./0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0[0-z]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=1[0-z]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=2[0-z]//g',
\ "\t\<C-L>\<C-M> !\"#$%&'()#+'-./{|}~\<C-?>\u0080\u0082\u0090\u009b<39><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"],
\ [':s/\%#=0[^0-z]//g',
\ "0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz"],
\ [':s/\%#=1[^0-z]//g',
\ "0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz"],
\ [':s/\%#=2[^0-z]//g',
\ "0123456789:;<=>?@ABCDEFGHIXYZ[\]^_`abcdefghiwxyz"]
\]
for [cmd, expected] in tests
call append(0, input)
call cursor(1, 1)
exe cmd
call assert_equal(expected, getline(1), cmd)
endfor
let &encoding = save_enc
enew!
close
endfunc

View File

@@ -0,0 +1,70 @@
" Test for shortpathname ':8' extension.
" Only for use on Win32 systems!
if !has('win32')
finish
endif
func TestIt(file, bits, expected)
let res = fnamemodify(a:file, a:bits)
if a:expected != ''
call assert_equal(substitute(a:expected, '/', '\\', 'g'),
\ substitute(res, '/', '\\', 'g'),
\ "'" . a:file . "'->(" . a:bits . ")->'" . res . "'")
endif
endfunc
func Test_ColonEight()
let save_dir = getcwd()
" This could change for CygWin to //cygdrive/c
let dir1 = 'c:/x.x.y'
if filereadable(dir1) || isdirectory(dir1)
call assert_report("Fatal: '" . dir1 . "' exists, cannot run test")
return
endif
let file1 = dir1 . '/zz.y.txt'
let nofile1 = dir1 . '/z.y.txt'
let dir2 = dir1 . '/VimIsTheGreatestSinceSlicedBread'
let file2 = dir2 . '/z.txt'
let nofile2 = dir2 . '/zz.txt'
call mkdir(dir1)
let resdir1 = substitute(fnamemodify(dir1, ':p:8'), '/$', '', '')
call assert_match('\V\^c:/XX\x\x\x\x~1.Y\$', resdir1)
let resfile1 = resdir1 . '/ZZY~1.TXT'
let resnofile1 = resdir1 . '/z.y.txt'
let resdir2 = resdir1 . '/VIMIST~1'
let resfile2 = resdir2 . '/z.txt'
let resnofile2 = resdir2 . '/zz.txt'
call mkdir(dir2)
call writefile([], file1)
call writefile([], file2)
call TestIt(file1, ':p:8', resfile1)
call TestIt(nofile1, ':p:8', resnofile1)
call TestIt(file2, ':p:8', resfile2)
call TestIt(nofile2, ':p:8', resnofile2)
call TestIt(nofile2, ':p:8:h', fnamemodify(resnofile2, ':h'))
exe 'cd ' . dir1
call TestIt(file1, ':.:8', strpart(resfile1, strlen(resdir1)+1))
call TestIt(nofile1, ':.:8', strpart(resnofile1, strlen(resdir1)+1))
call TestIt(file2, ':.:8', strpart(resfile2, strlen(resdir1)+1))
call TestIt(nofile2, ':.:8', strpart(resnofile2, strlen(resdir1)+1))
let $HOME=dir1
call TestIt(file1, ':~:8', '~' . strpart(resfile1, strlen(resdir1)))
call TestIt(nofile1, ':~:8', '~' . strpart(resnofile1, strlen(resdir1)))
call TestIt(file2, ':~:8', '~' . strpart(resfile2, strlen(resdir1)))
call TestIt(nofile2, ':~:8', '~' . strpart(resnofile2, strlen(resdir1)))
cd c:/
call delete(file2)
call delete(file1)
call delete(dir2, 'd')
call delete(dir1, 'd')
exe "cd " . save_dir
endfunc

View File

@@ -166,3 +166,289 @@ func Test_text_format()
setl ai& tw& fo& si& comments& setl ai& tw& fo& si& comments&
enew! enew!
endfunc endfunc
" Tests for :right, :center and :left on text with embedded TAB.
func Test_format_align()
enew!
set tw=65
" :left alignment
call append(0, [
\ " test for :left",
\ " a a",
\ " fa a",
\ " dfa a",
\ " sdfa a",
\ " asdfa a",
\ " xasdfa a",
\ "asxxdfa a",
\ ])
%left
call assert_equal([
\ "test for :left",
\ "a a",
\ "fa a",
\ "dfa a",
\ "sdfa a",
\ "asdfa a",
\ "xasdfa a",
\ "asxxdfa a",
\ ""
\ ], getline(1, '$'))
enew!
" :center alignment
call append(0, [
\ " test for :center",
\ " a a",
\ " fa afd asdf",
\ " dfa a",
\ " sdfa afd asdf",
\ " asdfa a",
\ " xasdfa asdfasdfasdfasdfasdf",
\ "asxxdfa a"
\ ])
%center
call assert_equal([
\ " test for :center",
\ " a a",
\ " fa afd asdf",
\ " dfa a",
\ " sdfa afd asdf",
\ " asdfa a",
\ " xasdfa asdfasdfasdfasdfasdf",
\ " asxxdfa a",
\ ""
\ ], getline(1, '$'))
enew!
" :right alignment
call append(0, [
\ " test for :right",
\ " a a",
\ " fa a",
\ " dfa a",
\ " sdfa a",
\ " asdfa a",
\ " xasdfa a",
\ " asxxdfa a",
\ " asxa;ofa a",
\ " asdfaqwer a",
\ " a ax",
\ " fa ax",
\ " dfa ax",
\ " sdfa ax",
\ " asdfa ax",
\ " xasdfa ax",
\ " asxxdfa ax",
\ " asxa;ofa ax",
\ " asdfaqwer ax",
\ " a axx",
\ " fa axx",
\ " dfa axx",
\ " sdfa axx",
\ " asdfa axx",
\ " xasdfa axx",
\ " asxxdfa axx",
\ " asxa;ofa axx",
\ " asdfaqwer axx",
\ " a axxx",
\ " fa axxx",
\ " dfa axxx",
\ " sdfa axxx",
\ " asdfa axxx",
\ " xasdfa axxx",
\ " asxxdfa axxx",
\ " asxa;ofa axxx",
\ " asdfaqwer axxx",
\ " a axxxo",
\ " fa axxxo",
\ " dfa axxxo",
\ " sdfa axxxo",
\ " asdfa axxxo",
\ " xasdfa axxxo",
\ " asxxdfa axxxo",
\ " asxa;ofa axxxo",
\ " asdfaqwer axxxo",
\ " a axxxoi",
\ " fa axxxoi",
\ " dfa axxxoi",
\ " sdfa axxxoi",
\ " asdfa axxxoi",
\ " xasdfa axxxoi",
\ " asxxdfa axxxoi",
\ " asxa;ofa axxxoi",
\ " asdfaqwer axxxoi",
\ " a axxxoik",
\ " fa axxxoik",
\ " dfa axxxoik",
\ " sdfa axxxoik",
\ " asdfa axxxoik",
\ " xasdfa axxxoik",
\ " asxxdfa axxxoik",
\ " asxa;ofa axxxoik",
\ " asdfaqwer axxxoik",
\ " a axxxoike",
\ " fa axxxoike",
\ " dfa axxxoike",
\ " sdfa axxxoike",
\ " asdfa axxxoike",
\ " xasdfa axxxoike",
\ " asxxdfa axxxoike",
\ " asxa;ofa axxxoike",
\ " asdfaqwer axxxoike",
\ " a axxxoikey",
\ " fa axxxoikey",
\ " dfa axxxoikey",
\ " sdfa axxxoikey",
\ " asdfa axxxoikey",
\ " xasdfa axxxoikey",
\ " asxxdfa axxxoikey",
\ " asxa;ofa axxxoikey",
\ " asdfaqwer axxxoikey",
\ ])
%right
call assert_equal([
\ "\t\t\t\t test for :right",
\ "\t\t\t\t a a",
\ "\t\t\t\t fa a",
\ "\t\t\t\t dfa a",
\ "\t\t\t\t sdfa a",
\ "\t\t\t\t asdfa a",
\ "\t\t\t\t xasdfa a",
\ "\t\t\t\t asxxdfa a",
\ "\t\t\t\t asxa;ofa a",
\ "\t\t\t\t asdfaqwer a",
\ "\t\t\t\t a ax",
\ "\t\t\t\t fa ax",
\ "\t\t\t\t dfa ax",
\ "\t\t\t\t sdfa ax",
\ "\t\t\t\t asdfa ax",
\ "\t\t\t\t xasdfa ax",
\ "\t\t\t\t asxxdfa ax",
\ "\t\t\t\t asxa;ofa ax",
\ "\t\t\t\t asdfaqwer ax",
\ "\t\t\t\t a axx",
\ "\t\t\t\t fa axx",
\ "\t\t\t\t dfa axx",
\ "\t\t\t\t sdfa axx",
\ "\t\t\t\t asdfa axx",
\ "\t\t\t\t xasdfa axx",
\ "\t\t\t\t asxxdfa axx",
\ "\t\t\t\t asxa;ofa axx",
\ "\t\t\t\t asdfaqwer axx",
\ "\t\t\t\t a axxx",
\ "\t\t\t\t fa axxx",
\ "\t\t\t\t dfa axxx",
\ "\t\t\t\t sdfa axxx",
\ "\t\t\t\t asdfa axxx",
\ "\t\t\t\t xasdfa axxx",
\ "\t\t\t\t asxxdfa axxx",
\ "\t\t\t\t asxa;ofa axxx",
\ "\t\t\t\t asdfaqwer axxx",
\ "\t\t\t\t a axxxo",
\ "\t\t\t\t fa axxxo",
\ "\t\t\t\t dfa axxxo",
\ "\t\t\t\t sdfa axxxo",
\ "\t\t\t\t asdfa axxxo",
\ "\t\t\t\t xasdfa axxxo",
\ "\t\t\t\t asxxdfa axxxo",
\ "\t\t\t\t asxa;ofa axxxo",
\ "\t\t\t\t asdfaqwer axxxo",
\ "\t\t\t\t a axxxoi",
\ "\t\t\t\t fa axxxoi",
\ "\t\t\t\t dfa axxxoi",
\ "\t\t\t\t sdfa axxxoi",
\ "\t\t\t\t asdfa axxxoi",
\ "\t\t\t\t xasdfa axxxoi",
\ "\t\t\t\t asxxdfa axxxoi",
\ "\t\t\t\t asxa;ofa axxxoi",
\ "\t\t\t\t asdfaqwer axxxoi",
\ "\t\t\t\t a axxxoik",
\ "\t\t\t\t fa axxxoik",
\ "\t\t\t\t dfa axxxoik",
\ "\t\t\t\t sdfa axxxoik",
\ "\t\t\t\t asdfa axxxoik",
\ "\t\t\t\t xasdfa axxxoik",
\ "\t\t\t\t asxxdfa axxxoik",
\ "\t\t\t\t asxa;ofa axxxoik",
\ "\t\t\t\t asdfaqwer axxxoik",
\ "\t\t\t\t a axxxoike",
\ "\t\t\t\t fa axxxoike",
\ "\t\t\t\t dfa axxxoike",
\ "\t\t\t\t sdfa axxxoike",
\ "\t\t\t\t asdfa axxxoike",
\ "\t\t\t\t xasdfa axxxoike",
\ "\t\t\t\t asxxdfa axxxoike",
\ "\t\t\t\t asxa;ofa axxxoike",
\ "\t\t\t\t asdfaqwer axxxoike",
\ "\t\t\t\t a axxxoikey",
\ "\t\t\t\t fa axxxoikey",
\ "\t\t\t\t dfa axxxoikey",
\ "\t\t\t\t sdfa axxxoikey",
\ "\t\t\t\t asdfa axxxoikey",
\ "\t\t\t\t xasdfa axxxoikey",
\ "\t\t\t\t asxxdfa axxxoikey",
\ "\t\t\t\t asxa;ofa axxxoikey",
\ "\t\t\t\t asdfaqwer axxxoikey",
\ ""
\ ], getline(1, '$'))
enew!
set tw&
endfunc
" Test formatting a paragraph.
func Test_format_para()
enew!
set fo+=tcroql tw=72
call append(0, [
\ "xxxxx xx xxxxxx ",
\ "xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx",
\ "xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx",
\ "xx xxxxxxx. xxxx xxxx.",
\ "",
\ "> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx",
\ "> xxxxxx xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx"
\ ])
exe "normal /xxxxxxxx$\<CR>"
normal 0gq6kk
call assert_equal([
\ "xxxxx xx xxxxxx xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx",
\ "xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx xx xxxxxxx.",
\ "xxxx xxxx.",
\ "",
\ "> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx xxxxxx",
\ "> xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx",
\ ""
\ ], getline(1, '$'))
set fo& tw&
enew!
endfunc
" Test undo after ":%s" and formatting.
func Test_format_undo()
enew!
map gg :.,.+2s/^/x/<CR>kk:set tw=3<CR>gqq
call append(0, [
\ "aa aa aa aa",
\ "bb bb bb bb",
\ "cc cc cc cc"
\ ])
" undo/redo here to make the next undo only work on the following changes
exe "normal i\<C-G>u"
call cursor(1,1)
normal ggu
call assert_equal([
\ "aa aa aa aa",
\ "bb bb bb bb",
\ "cc cc cc cc",
\ ""
\ ], getline(1, '$'))
unmap gg
enew!
endfunc

View File

@@ -771,6 +771,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1447,
/**/ /**/
1446, 1446,
/**/ /**/