diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-11-16 21:52:51 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-11-16 21:52:51 +0100 |
commit | 209d3874c19d73b209e7d223cf05ea22e183f408 (patch) | |
tree | e26d8336afd8f7dd305f0c750ee7895ab062e500 /src | |
parent | 7cb769a69f5b9d6951f4427c85e75f5b2909cf10 (diff) |
patch 8.0.1302: still too many old style testsv8.0.1302
Problem: Still too many old style tests.
Solution: Convert a few more tests to new style. (Yegappan Lakshmanan,
closes #2326)
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 14 | ||||
-rw-r--r-- | src/testdir/Make_all.mak | 11 | ||||
-rw-r--r-- | src/testdir/Make_ming.mak | 3 | ||||
-rw-r--r-- | src/testdir/Make_vms.mms | 8 | ||||
-rw-r--r-- | src/testdir/runtest.vim | 6 | ||||
-rw-r--r-- | src/testdir/test68.in | 131 | ||||
-rw-r--r-- | src/testdir/test68.ok | 77 | ||||
-rw-r--r-- | src/testdir/test73.in | 170 | ||||
-rw-r--r-- | src/testdir/test73.ok | 21 | ||||
-rw-r--r-- | src/testdir/test_close_count.in | 154 | ||||
-rw-r--r-- | src/testdir/test_close_count.ok | 23 | ||||
-rw-r--r-- | src/testdir/test_close_count.vim | 174 | ||||
-rw-r--r-- | src/testdir/test_erasebackword.in | 20 | ||||
-rw-r--r-- | src/testdir/test_erasebackword.ok | 8 | ||||
-rw-r--r-- | src/testdir/test_erasebackword.vim | 25 | ||||
-rw-r--r-- | src/testdir/test_find_complete.vim | 157 | ||||
-rw-r--r-- | src/testdir/test_fixeol.in | 40 | ||||
-rw-r--r-- | src/testdir/test_fixeol.ok | 10 | ||||
-rw-r--r-- | src/testdir/test_fixeol.vim | 48 | ||||
-rw-r--r-- | src/testdir/test_listchars.in | 54 | ||||
-rw-r--r-- | src/testdir/test_listchars.ok | 16 | ||||
-rw-r--r-- | src/testdir/test_listchars.vim | 63 | ||||
-rw-r--r-- | src/testdir/test_textformat.vim | 168 | ||||
-rw-r--r-- | src/version.c | 2 |
24 files changed, 659 insertions, 744 deletions
diff --git a/src/Makefile b/src/Makefile index f544528842..78c0b3eb04 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2097,18 +2097,14 @@ run_message_test: $(MESSAGE_TEST_TARGET) # Run individual OLD style test. # These do not depend on the executable, compile it when needed. test1 \ - test_close_count \ - test_erasebackword \ test_eval \ - test_fixeol \ - test_listchars \ test_wordcount \ test3 test11 test14 test15 test17 \ test29 test30 test36 test37 test39 \ test42 test44 test48 test49 \ test50 test52 test59 \ - test64 test68 test69 \ - test70 test72 test73 \ + test64 test69 \ + test70 test72 \ test85 test86 test87 test88 \ test94 test95 test99 test108: cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) @@ -2133,6 +2129,7 @@ test_arglist \ test_charsearch_utf8 \ test_cindent \ test_clientserver \ + test_close_count \ test_cmdline \ test_command_count \ test_comparators \ @@ -2145,6 +2142,7 @@ test_arglist \ test_digraph \ test_display \ test_edit \ + test_erasebackword \ test_escaped_glob \ test_ex_undo \ test_ex_z \ @@ -2164,7 +2162,9 @@ test_arglist \ test_filetype \ test_filter_cmd \ test_filter_map \ + test_find_complete \ test_findfile \ + test_fixeol \ test_float_func \ test_fnameescape \ test_fnamemodify \ @@ -2200,6 +2200,7 @@ test_arglist \ test_let \ test_lineending \ test_lispwords \ + test_listchars \ test_listdict \ test_listlbr \ test_listlbr_utf8 \ @@ -2272,6 +2273,7 @@ test_arglist \ test_tcl \ test_terminal \ test_terminal_fail \ + test_textformat \ test_textobjects \ test_timers \ test_true_false \ diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index b407e6e22f..f9998c8e38 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -24,20 +24,14 @@ SCRIPTS_ALL = \ test44.out \ test48.out \ test64.out \ - test68.out \ test69.out \ test70.out \ - test73.out \ test88.out \ test94.out \ test95.out \ test99.out \ test108.out \ - test_close_count.out \ - test_erasebackword.out \ test_eval.out \ - test_fixeol.out \ - test_listchars.out \ test_wordcount.out @@ -86,6 +80,7 @@ NEW_TESTS = test_arabic.res \ test_charsearch.res \ test_cindent.res \ test_clientserver.res \ + test_close_count.res \ test_cmdline.res \ test_command_count.res \ test_crypt.res \ @@ -95,9 +90,12 @@ NEW_TESTS = test_arabic.res \ test_digraph.res \ test_display.res \ test_edit.res \ + test_erasebackword.res \ test_exists.res \ test_farsi.res \ test_file_size.res \ + test_find_complete.res \ + test_fixeol.res \ test_fnameescape.res \ test_fold.res \ test_getvar.res \ @@ -119,6 +117,7 @@ NEW_TESTS = test_arabic.res \ test_langmap.res \ test_let.res \ test_lineending.res \ + test_listchars.res \ test_listdict.res \ test_listlbr.res \ test_listlbr_utf8.res \ diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index f2bd8b7405..a05ae322cb 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -63,8 +63,7 @@ win32: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests fixff: -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=dos|upd" +q *.in *.ok -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=unix|upd" +q \ - dotest.in test_listchars.ok \ - test_wordcount.ok + dotest.in test_wordcount.ok clean: -@if exist *.out $(DEL) *.out diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 9b4d37e2d2..7491e8d658 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -78,16 +78,12 @@ SCRIPT = test1.out test3.out \ test29.out \ test30.out test36.out test37.out test39.out \ test42.out test44.out test48.out test49.out \ - test64.out test68.out test69.out \ + test64.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_close_count.out \ - test_erasebackword.out \ test_eval.out \ - test_fixeol.out \ - test_listchars.out \ test_listlbr.out \ test_listlbr_utf8.out \ test_utf8.out \ @@ -114,7 +110,7 @@ GUI_OPTION = -g .ENDIF .IFDEF WANT_UNIX -SCRIPT_UNIX = test10.out test17.out test27.out test49.out test73.out +SCRIPT_UNIX = test10.out test17.out test27.out test49.out .ENDIF .IFDEF WANT_WIN diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim index 08c0e684bf..8eef1669fd 100644 --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -103,6 +103,10 @@ func RunTheTest(test) " buffers. %bwipe! + " The test may change the current directory. Save and restore the + " directory after executing the test. + let save_cwd = getcwd() + if exists("*SetUp") try call SetUp() @@ -157,6 +161,8 @@ func RunTheTest(test) break endif endwhile + + exe 'cd ' . save_cwd endfunc func AfterTheTest() diff --git a/src/testdir/test68.in b/src/testdir/test68.in deleted file mode 100644 index ceaf9af1ab..0000000000 --- a/src/testdir/test68.in +++ /dev/null @@ -1,131 +0,0 @@ -Test for text formatting. - -Results of test68: - -STARTTEST -:so small.vim -/^{/+1 -:set noai tw=2 fo=t -gRa b -ENDTEST - -{ - - -} - -STARTTEST -/^{/+1 -:set ai tw=2 fo=tw -gqgqjjllab -ENDTEST - -{ -a b - -a -} - -STARTTEST -/^{/+1 -:set tw=3 fo=t -gqgqo -a -ENDTEST - -{ -a -} - -STARTTEST -/^{/+1 -:set tw=2 fo=tcq1 comments=:# -gqgqjgqgqo -a b -#a b -ENDTEST - -{ -a b -#a b -} - -STARTTEST -/^{/+1 -:set tw=5 fo=tcn comments=:# -A bjA b -ENDTEST - -{ - 1 a -# 1 a -} - -STARTTEST -/^{/+3 -:set tw=5 fo=t2a si -i A_ -ENDTEST - -{ - - x a - b - c - -} - -STARTTEST -/^{/+1 -:set tw=5 fo=qn comments=:# -gwap -ENDTEST - -{ -# 1 a b -} - -STARTTEST -/^{/+1 -:set tw=5 fo=q2 comments=:# -gwap -ENDTEST - -{ -# x -# a b -} - -STARTTEST -/^{/+2 -:set tw& fo=a -I^^ -ENDTEST - -{ - 1aa - 2bb -} - -STARTTEST -/mno pqr/ -:setl tw=20 fo=an12wcq comments=s1:/*,mb:*,ex:*/ -A vwx yz -ENDTEST - -/* abc def ghi jkl - * mno pqr stu - */ - -STARTTEST -/^#/ -:setl tw=12 fo=tqnc comments=:# -A foobar -ENDTEST - -# 1 xxxxx - -STARTTEST -:g/^STARTTEST/.,/^ENDTEST/d -:1;/^Results/,$wq! test.out -ENDTEST diff --git a/src/testdir/test68.ok b/src/testdir/test68.ok deleted file mode 100644 index b3726a0a27..0000000000 --- a/src/testdir/test68.ok +++ /dev/null @@ -1,77 +0,0 @@ -Results of test68: - - -{ -a -b -} - - -{ -a -b - -a -b -} - - -{ -a - - -a - -} - - -{ -a b -#a b - -a b -#a b -} - - -{ - 1 a - b -# 1 a -# b -} - - -{ - - x a - b_ - c - -} - - -{ -# 1 a -# b -} - - -{ -# x a -# b -} - - -{ 1aa ^^2bb } - - -/* abc def ghi jkl - * mno pqr stu - * vwx yz - */ - - -# 1 xxxxx -# foobar - diff --git a/src/testdir/test73.in b/src/testdir/test73.in deleted file mode 100644 index 67fe4551de..0000000000 --- a/src/testdir/test73.in +++ /dev/null @@ -1,170 +0,0 @@ -Tests for find completion. - -STARTTEST -:so small.vim -:set belloff=all -:" Do all test in a separate window to avoid E211 when we recursively -:" delete the Xfind directory during cleanup -:" -:" This will cause a few errors, do it silently. -:set visualbell -:set nocp viminfo+=nviminfo -:" -:" On windows a stale "Xfind" directory may exist, remove it so that -:" we start from a clean state. -:call delete("Xfind", "rf") -:new -:let cwd=getcwd() -:let test_out = cwd . '/test.out' -:call mkdir('Xfind') -:cd Xfind -:set path= -:find -:exec "w! " . test_out -:close -:new -:set path=. -:find -:exec "w >>" . test_out -:close -:new -:set path=.,, -:find -:exec "w >>" . test_out -:close -:new -:set path=./** -:find -:exec "w >>" . test_out -:close -:new -:" We shouldn't find any file at this point, test.out must be empty. -:call mkdir('in') -:cd in -:call mkdir('path') -:exec "cd " . cwd -:e Xfind/file.txt -SHoly Grail:w -:e Xfind/in/file.txt -SJimmy Hoffa:w -:e Xfind/in/stuff.txt -SAnother Holy Grail:w -:e Xfind/in/path/file.txt -SE.T.:w -:set path=Xfind/** -:find file -:exec "w >>" . test_out -:find file -:exec "w >>" . test_out -:find file -:exec "w >>" . test_out -:" Rerun the previous three find completions, using fullpath in 'path' -:exec "set path=" . cwd . "/Xfind/**" -:find file -:exec "w >>" . test_out -:find file -:exec "w >>" . test_out -:find file -:exec "w >>" . test_out -:" Same steps again, using relative and fullpath items that point to the same -:" recursive location. -:" This is to test that there are no duplicates in the completion list. -:exec "set path+=Xfind/**" -:find file -:exec "w >>" . test_out -:find file -:exec "w >>" . test_out -:find file -:exec "w >>" . test_out -:find file -:" Test find completion for directory of current buffer, which at this point -:" is Xfind/in/file.txt. -:set path=. -:find st -:exec "w >>" . test_out -:" Test find completion for empty path item ",," which is the current directory -:cd Xfind -:set path=,, -:find f -:exec "w >>" . test_out -:" Test shortening of -:" -:" foo/x/bar/voyager.txt -:" foo/y/bar/voyager.txt -:" -:" When current directory is above foo/ they should be shortened to (in order -:" of appearance): -:" -:" x/bar/voyager.txt -:" y/bar/voyager.txt -:call mkdir('foo') -:cd foo -:call mkdir('x') -:call mkdir('y') -:cd x -:call mkdir('bar') -:cd .. -:cd y -:call mkdir('bar') -:cd .. -:cd .. -:" We should now be in the Xfind directory -:e foo/x/bar/voyager.txt -SVoyager 1:w -:e foo/y/bar/voyager.txt -SVoyager 2:w -:exec "set path=" . cwd . "/Xfind/**" -:find voyager -:exec "w >>" . test_out -:find voyager -:exec "w >>" . test_out -:" -:" When current directory is .../foo/y/bar they should be shortened to (in -:" order of appearance): -:" -:" ./voyager.txt -:" x/bar/voyager.txt -:cd foo -:cd y -:cd bar -:find voyager -:exec "w >> " . test_out -:find voyager -:exec "w >> " . test_out -:" Check the opposite too: -:cd .. -:cd .. -:cd x -:cd bar -:find voyager -:exec "w >> " . test_out -:find voyager -:exec "w >> " . test_out -:" Check for correct handling of shorten_fname()'s behavior on windows -:exec "cd " . cwd . "/Xfind/in" -:find file -:exec "w >>" . test_out -:" Test for relative to current buffer 'path' item -:exec "cd " . cwd . "/Xfind/" -:set path=./path -:" Open the file where Jimmy Hoffa is found -:e in/file.txt -:" Find the file containing 'E.T.' in the Xfind/in/path directory -:find file -:exec "w >>" . test_out -:" -:" Test that completion works when path=.,, -:" -:set path=.,, -:" Open Jimmy Hoffa file -:e in/file.txt -:exec "w >>" . test_out -:" Search for the file containing Holy Grail in same directory as in/path.txt -:find stu -:exec "w >>" . test_out -:q -:exec "cd " . cwd -:call delete("Xfind", "rf") -:qa! -ENDTEST - diff --git a/src/testdir/test73.ok b/src/testdir/test73.ok deleted file mode 100644 index 90efab756f..0000000000 --- a/src/testdir/test73.ok +++ /dev/null @@ -1,21 +0,0 @@ -Holy Grail -Jimmy Hoffa -E.T. -Holy Grail -Jimmy Hoffa -E.T. -Holy Grail -Jimmy Hoffa -E.T. -Another Holy Grail -Holy Grail -Voyager 1 -Voyager 2 -Voyager 2 -Voyager 1 -Voyager 1 -Voyager 2 -Jimmy Hoffa -E.T. -Jimmy Hoffa -Another Holy Grail diff --git a/src/testdir/test_close_count.in b/src/testdir/test_close_count.in deleted file mode 100644 index f40fd2361c..0000000000 --- a/src/testdir/test_close_count.in +++ /dev/null @@ -1,154 +0,0 @@ -Tests for :[count]close! and :[count]hide vim: set ft=vim : - -STARTTEST -:so small.vim -:set belloff=all -:let tests = [] -:for i in range(5) -:new -:endfor -:4wincmd w -:close! -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:1close! -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:$close! -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:1wincmd w -:2close! -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:1wincmd w -:new -:new -:2wincmd w -:-1close! -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:2wincmd w -:+1close! -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:e! test.out -:call append(0, map(copy(tests), 'join(v:val, " ")')) -:w -:only! -:b1 -ENDTEST - -STARTTEST -:let tests = [] -:for i in range(5) -:new -:endfor -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:4wincmd w -:.hide -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:1hide -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:$hide -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:1wincmd w -:2hide -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:1wincmd w -:new -:new -:3wincmd w -:-hide -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:2wincmd w -:+hide -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:e! test.out -:call append(line('$'), map(copy(tests), 'join(v:val, " ")')) -Go -:w -:only! -:b1 -ENDTEST - -STARTTEST -:let tests = [] -:set hidden -:for i in range(5) -:new -:endfor -:1wincmd w -:$ hide -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:$-1 close! -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:1wincmd w -:.+close! -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:e! test.out -:call append(line('$'), map(copy(tests), 'join(v:val, " ")')) -Go -:w -:only! -:b1 -ENDTEST - -STARTTEST -:let tests = [] -:set hidden -:for i in range(5) -:new -:endfor -:4wincmd w -c -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -1c -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -9c -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:1wincmd w -2c -:let buffers = [] -:windo call add(buffers, bufnr('%')) -:call add(tests, buffers) -:only! -:e! test.out -:call append(line('$'), map(copy(tests), 'join(v:val, " ")')) -:w -:qa! -ENDTEST - - diff --git a/src/testdir/test_close_count.ok b/src/testdir/test_close_count.ok deleted file mode 100644 index 1cee870487..0000000000 --- a/src/testdir/test_close_count.ok +++ /dev/null @@ -1,23 +0,0 @@ -6 5 4 2 1 -5 4 2 1 -5 4 2 -5 2 -7 5 2 -7 5 - -13 12 11 10 9 1 -13 12 11 9 1 -12 11 9 1 -12 11 9 -12 9 -15 12 9 -15 12 - -20 19 18 17 16 -20 19 18 16 -20 18 16 - -25 24 23 21 1 -24 23 21 1 -24 23 21 -24 21 diff --git a/src/testdir/test_close_count.vim b/src/testdir/test_close_count.vim new file mode 100644 index 0000000000..1f9adba32d --- /dev/null +++ b/src/testdir/test_close_count.vim @@ -0,0 +1,174 @@ + +" Tests for :[count]close! command +func Test_close_count() + enew! | only + + let wids = [win_getid()] + for i in range(5) + new + call add(wids, win_getid()) + endfor + + 4wincmd w + close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[5], wids[4], wids[3], wids[1], wids[0]], ids) + + 1close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[3], wids[1], wids[0]], ids) + + $close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[3], wids[1]], ids) + + 1wincmd w + 2close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[1]], ids) + + 1wincmd w + new + call add(wids, win_getid()) + new + call add(wids, win_getid()) + 2wincmd w + -1close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[6], wids[4], wids[1]], ids) + + 2wincmd w + +1close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[6], wids[4]], ids) + + only! +endfunc + +" Tests for :[count]hide command +func Test_hide_count() + enew! | only + + let wids = [win_getid()] + for i in range(5) + new + call add(wids, win_getid()) + endfor + + 4wincmd w + .hide + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[5], wids[4], wids[3], wids[1], wids[0]], ids) + + 1hide + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[3], wids[1], wids[0]], ids) + + $hide + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[3], wids[1]], ids) + + 1wincmd w + 2hide + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[1]], ids) + + 1wincmd w + new + call add(wids, win_getid()) + new + call add(wids, win_getid()) + 3wincmd w + -hide + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[7], wids[4], wids[1]], ids) + + 2wincmd w + +hide + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[7], wids[4]], ids) + + only! +endfunc + +" Tests for :[count]close! command with 'hidden' +func Test_hidden_close_count() + enew! | only + + let wids = [win_getid()] + for i in range(5) + new + call add(wids, win_getid()) + endfor + + set hidden + + $ hide + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[5], wids[4], wids[3], wids[2], wids[1]], ids) + + $-1 close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[5], wids[4], wids[3], wids[1]], ids) + + 1wincmd w + .+close! + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[5], wids[3], wids[1]], ids) + + set nohidden + only! +endfunc + +" Tests for 'CTRL-W c' command to close windows. +func Test_winclose_command() + enew! | only + + let wids = [win_getid()] + for i in range(5) + new + call add(wids, win_getid()) + endfor + + set hidden + + 4wincmd w + exe "normal \<C-W>c" + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[5], wids[4], wids[3], wids[1], wids[0]], ids) + + exe "normal 1\<C-W>c" + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[3], wids[1], wids[0]], ids) + + exe "normal 9\<C-W>c" + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[3], wids[1]], ids) + + 1wincmd w + exe "normal 2\<C-W>c" + let ids = [] + windo call add(ids, win_getid()) + call assert_equal([wids[4], wids[1]], ids) + + set nohidden + only! +endfunc diff --git a/src/testdir/test_erasebackword.in b/src/testdir/test_erasebackword.in deleted file mode 100644 index 36dd232546..0000000000 --- a/src/testdir/test_erasebackword.in +++ /dev/null @@ -1,20 +0,0 @@ -Test for erasing backword - -STARTTEST -:so small.vim -:set belloff=all -:so mbyte.vim -:set encoding=utf-8 -G -o wwwこんにちわ世界ワールドvim -o wwwこんにちわ世界ワールドvim -o wwwこんにちわ世界ワールドvim -o wwwこんにちわ世界ワールドvim -o wwwこんにちわ世界ワールドvim -o wwwこんにちわ世界ワールドvim -:/^test/,$w! test.out -:qa! -ENDTEST - -test starts here: - diff --git a/src/testdir/test_erasebackword.ok b/src/testdir/test_erasebackword.ok deleted file mode 100644 index 835a424034..0000000000 --- a/src/testdir/test_erasebackword.ok +++ /dev/null @@ -1,8 +0,0 @@ -test starts here: - - wwwこんにちわ世界ワールド - wwwこんにちわ世界 - wwwこんにちわ - www - - diff --git a/src/testdir/test_erasebackword.vim b/src/testdir/test_erasebackword.vim new file mode 100644 index 0000000000..098d6edfcb --- /dev/null +++ b/src/testdir/test_erasebackword.vim @@ -0,0 +1,25 @@ + +func Test_erasebackword() + if !has('multi_byte') + return + endif + + set encoding=utf-8 + enew + + exe "normal o wwwこんにちわ世界ワールドvim \<C-W>" + call assert_equal(' wwwこんにちわ世界ワールド', getline('.')) + exe "normal o wwwこんにちわ世界ワールドvim \<C-W>\<C-W>" + call assert_equal(' wwwこんにちわ世界', getline('.')) + exe "normal o wwwこんにちわ世界ワールドvim \<C-W>\<C-W>\<C-W>" + call assert_equal(' wwwこんにちわ', getline('.')) + exe "normal o wwwこんにちわ世界ワールドvim \<C-W>\<C-W>\<C-W>\<C-W>" + call assert_equal(' www', getline('.')) + exe "normal o wwwこんにちわ世界ワールドvim \<C-W>\<C-W>\<C-W>\<C-W>\<C-W>" + call assert_equal(' ', getline('.')) + exe "normal o wwwこんにちわ世界ワールドvim \<C-W>\<C-W>\<C-W>\<C-W>\<C-W>\<C-W>" + call assert_equal('', getline('.')) + + enew! + set encoding& +endfunc diff --git a/src/testdir/test_find_complete.vim b/src/testdir/test_find_complete.vim new file mode 100644 index 0000000000..4732109ed0 --- /dev/null +++ b/src/testdir/test_find_complete.vim @@ -0,0 +1,157 @@ +" Tests for the 'find' command completion. + +" Do all the tests in a separate window to avoid E211 when we recursively +" delete the Xfind directory during cleanup +func Test_find_complete() + set belloff=all + + " On windows a stale "Xfind" directory may exist, remove it so that + " we start from a clean state. + call delete("Xfind", "rf") + let cwd = getcwd() + let test_out = cwd . '/test.out' + call mkdir('Xfind') + cd Xfind + + new + set path= + call assert_fails('call feedkeys(":find\t\n", "xt")', 'E345:') + close + + new + set path=. + call assert_fails('call feedkeys(":find\t\n", "xt")', 'E32:') + close + + new + set path=.,, + call assert_fails('call feedkeys(":find\t\n", "xt")', 'E32:') + close + + new + set path=./** + call assert_fails('call feedkeys(":find\t\n", "xt")', 'E32:') + close + + " We shouldn't find any file till this point + + call mkdir('in/path', 'p') + exe 'cd ' . cwd + call writefile(['Holy Grail'], 'Xfind/file.txt') + call writefile(['Jimmy Hoffa'], 'Xfind/in/file.txt') + call writefile(['Another Holy Grail'], 'Xfind/in/stuff.txt') + call writefile(['E.T.'], 'Xfind/in/path/file.txt') + + new + set path=Xfind/** + call feedkeys(":find file\t\n", "xt") + call assert_equal('Holy Grail', getline(1)) + call feedkeys(":find file\t\t\n", "xt") + call assert_equal('Jimmy Hoffa', getline(1)) + call feedkeys(":find file\t\t\t\n", "xt") + call assert_equal('E.T.', getline(1)) + + " Rerun the previous three find completions, using fullpath in 'path' + exec "set path=" . cwd . "/Xfind/**" + + call feedkeys(":find file\t\n", "xt") + call assert_equal('Holy Grail', getline(1)) + call feedkeys(":find file\t\t\n", "xt") + call assert_equal('Jimmy Hoffa', getline(1)) + call feedkeys(":find file\t\t\t\n", "xt") + call assert_equal('E.T.', getline(1)) + + " Sam |