]> granicus.if.org Git - vim/commitdiff
patch 8.0.1302: still too many old style tests v8.0.1302
authorBram Moolenaar <Bram@vim.org>
Thu, 16 Nov 2017 20:52:51 +0000 (21:52 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 16 Nov 2017 20:52:51 +0000 (21:52 +0100)
Problem:    Still too many old style tests.
Solution:   Convert a few more tests to new style. (Yegappan Lakshmanan,
            closes #2326)

24 files changed:
src/Makefile
src/testdir/Make_all.mak
src/testdir/Make_ming.mak
src/testdir/Make_vms.mms
src/testdir/runtest.vim
src/testdir/test68.in [deleted file]
src/testdir/test68.ok [deleted file]
src/testdir/test73.in [deleted file]
src/testdir/test73.ok [deleted file]
src/testdir/test_close_count.in [deleted file]
src/testdir/test_close_count.ok [deleted file]
src/testdir/test_close_count.vim [new file with mode: 0644]
src/testdir/test_erasebackword.in [deleted file]
src/testdir/test_erasebackword.ok [deleted file]
src/testdir/test_erasebackword.vim [new file with mode: 0644]
src/testdir/test_find_complete.vim [new file with mode: 0644]
src/testdir/test_fixeol.in [deleted file]
src/testdir/test_fixeol.ok [deleted file]
src/testdir/test_fixeol.vim [new file with mode: 0644]
src/testdir/test_listchars.in [deleted file]
src/testdir/test_listchars.ok [deleted file]
src/testdir/test_listchars.vim [new file with mode: 0644]
src/testdir/test_textformat.vim [new file with mode: 0644]
src/version.c

index f5445288421bcc5d12d2abd69076c3fcea6a369c..78c0b3eb04960b3247373bb4e65575b8c9483f31 100644 (file)
@@ -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 \
index b407e6e22f112ec8762a43147b534c8cd4b782a5..f9998c8e38884f7be518338591a99b916c924acb 100644 (file)
@@ -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 \
index f2bd8b740505317e217672d8f6181d0531fc275a..a05ae322cb9df43cf0fafa95a5d50a77f8f8276b 100644 (file)
@@ -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
index 9b4d37e2d216b34df71fa3cab78b7e8eb216ae63..7491e8d658ef63cdaa0044152035e663655140a0 100644 (file)
@@ -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
index 08c0e684bfa7a116e62146ce779dac14e373eca3..8eef1669fd20d6771356b35efcbc6ef32d7d513b 100644 (file)
@@ -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 (file)
index ceaf9af..0000000
+++ /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\e
-ENDTEST
-
-{
-    
-
-}
-
-STARTTEST
-/^{/+1
-:set ai tw=2 fo=tw
-gqgqjjllab\e
-ENDTEST
-
-{
-a  b  
-
-a    
-}
-
-STARTTEST
-/^{/+1
-:set tw=3 fo=t
-gqgqo
-a \16\ 1\e
-ENDTEST
-
-{
-a \ 1
-}
-
-STARTTEST
-/^{/+1
-:set tw=2 fo=tcq1 comments=:#
-gqgqjgqgqo
-a b
-#a b\e
-ENDTEST
-
-{
-a b
-#a b
-}
-
-STARTTEST
-/^{/+1
-:set tw=5 fo=tcn comments=:#
-A b\ejA b\e
-ENDTEST
-
-{
-  1 a
-# 1 a
-}
-
-STARTTEST
-/^{/+3
-:set tw=5 fo=t2a si
-i  \eA_\e
-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^^\e
-ENDTEST
-
-{
-   1aa
-   2bb
-}
-
-STARTTEST
-/mno pqr/
-:setl tw=20 fo=an12wcq comments=s1:/*,mb:*,ex:*/
-A vwx yz\e
-ENDTEST
-
-/* abc def ghi jkl 
- *    mno pqr stu
- */
-
-STARTTEST
-/^#/
-:setl tw=12 fo=tqnc comments=:#
-A foobar\e
-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 (file)
index b3726a0..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-Results of test68:
-
-
-{
-a
-b
-}
-
-
-{
-a  
-b  
-
-a  
-b
-}
-
-
-{
-a
-\ 1
-
-a
-\ 1
-}
-
-
-{
-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 (file)
index 67fe455..0000000
+++ /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\e:w
-:e Xfind/in/file.txt
-SJimmy Hoffa\e:w
-:e Xfind/in/stuff.txt
-SAnother Holy Grail\e:w
-:e Xfind/in/path/file.txt
-SE.T.\e: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\e:w
-:e foo/y/bar/voyager.txt
-SVoyager 2\e: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 (file)
index 90efab7..0000000
+++ /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 (file)
index f40fd23..0000000
+++ /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\e
-: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\e
-:w
-:only!
-:b1
-ENDTEST
-
-STARTTEST
-:let tests = []
-:set hidden
-:for i in range(5)
-:new
-:endfor
-:4wincmd w
-\17c
-:let buffers = []
-:windo call add(buffers, bufnr('%'))
-:call add(tests, buffers)
-1\17c
-:let buffers = []
-:windo call add(buffers, bufnr('%'))
-:call add(tests, buffers)
-9\17c
-:let buffers = []
-:windo call add(buffers, bufnr('%'))
-:call add(tests, buffers)
-:1wincmd w
-2\17c
-: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 (file)
index 1cee870..0000000
+++ /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 (file)
index 0000000..1f9adba
--- /dev/null
@@ -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 (file)
index 36dd232..0000000
+++ /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 \17\e
-o wwwこんにちわ世界ワールドvim \17\17\e
-o wwwこんにちわ世界ワールドvim \17\17\17\e
-o wwwこんにちわ世界ワールドvim \17\17\17\17\e
-o wwwこんにちわ世界ワールドvim \17\17\17\17\17\e
-o wwwこんにちわ世界ワールドvim \17\17\17\17\17\17\e
-:/^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 (file)
index 835a424..0000000
+++ /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 (file)
index 0000000..098d6ed
--- /dev/null
@@ -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 (file)
index 0000000..4732109
--- /dev/null
@@ -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))
+
+  " 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.
+  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))
+  call feedkeys(":find file\t\t\n", "xt")
+
+  " Test find completion for directory of current buffer, which at this point
+  " is Xfind/in/file.txt.
+  set path=.
+  call feedkeys(":find st\t\n", "xt")
+  call assert_equal('Another Holy Grail', getline(1))
+
+  " Test find completion for empty path item ",," which is the current
+  " directory
+  cd Xfind
+  set path=,,
+  call feedkeys(":find f\t\n", "xt")
+  call assert_equal('Holy Grail', getline(1))
+
+  " 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/x/bar', 'p')
+  call mkdir('foo/y/bar', 'p')
+  call writefile(['Voyager 1'], 'foo/x/bar/voyager.txt')
+  call writefile(['Voyager 2'], 'foo/y/bar/voyager.txt')
+
+  exec "set path=" . cwd . "/Xfind/**"
+  call feedkeys(":find voyager\t\n", "xt")
+  call assert_equal('Voyager 1', getline(1))
+  call feedkeys(":find voyager\t\t\n", "xt")
+  call assert_equal('Voyager 2', getline(1))
+
+  "
+  " When current directory is .../foo/y/bar they should be shortened to (in
+  " order of appearance):
+  "
+  "    ./voyager.txt
+  "    x/bar/voyager.txt
+  cd foo/y/bar
+  call feedkeys(":find voyager\t\n", "xt")
+  call assert_equal('Voyager 2', getline(1))
+  call feedkeys(":find voyager\t\t\n", "xt")
+  call assert_equal('Voyager 1', getline(1))
+
+  " Check the opposite too:
+  cd ../../x/bar
+  call feedkeys(":find voyager\t\n", "xt")
+  call assert_equal('Voyager 1', getline(1))
+  call feedkeys(":find voyager\t\t\n", "xt")
+  call assert_equal('Voyager 2', getline(1))
+
+  " Check for correct handling of shorten_fname()'s behavior on windows
+  exec "cd " . cwd . "/Xfind/in"
+  call feedkeys(":find file\t\n", "xt")
+  call assert_equal('Jimmy Hoffa', getline(1))
+
+  " 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
+  call feedkeys(":find file\t\n", "xt")
+  call assert_equal('E.T.', getline(1))
+
+  " Test that completion works when path=.,,
+  set path=.,,
+  " Open Jimmy Hoffa file
+  e in/file.txt
+  call assert_equal('Jimmy Hoffa', getline(1))
+
+  " Search for the file containing Holy Grail in same directory as in/path.txt
+  call feedkeys(":find stu\t\n", "xt")
+  call assert_equal('Another Holy Grail', getline(1))
+
+  enew | only
+  exe 'cd ' . cwd
+  call delete('Xfind', 'rf')
+  set path&
+endfunc
diff --git a/src/testdir/test_fixeol.in b/src/testdir/test_fixeol.in
deleted file mode 100644 (file)
index a881fb1..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-Tests for 'fixeol'                         vim: set ft=vim :
-STARTTEST
-:" first write two test files – with and without trailing EOL
-:" use Unix fileformat for consistency
-:set ff=unix
-:enew!
-awith eol\e:w! XXEol
-:enew!
-:set noeol nofixeol
-awithout eol\e:w! XXNoEol
-:set eol fixeol
-:bwipe XXEol XXNoEol
-:"
-:" try editing files with 'fixeol' disabled
-:e! XXEol
-ostays eol\e:set nofixeol
-:w! XXTestEol
-:e! XXNoEol
-ostays without\e:set nofixeol
-:w! XXTestNoEol
-:bwipe XXEol XXNoEol XXTestEol XXTestNoEol
-:set fixeol
-:"
-:" Append "END" to each file so that we can see what the last written char was.
-ggdGaEND\e:w >>XXEol
-:w >>XXNoEol
-:w >>XXTestEol
-:w >>XXTestNoEol
-:"
-:" Concatenate the results
-:e! test.out
-a0\e:$r XXEol
-:$r XXNoEol
-Go1\e:$r XXTestEol
-:$r XXTestNoEol
-:w
-:qa!
-ENDTEST
-
diff --git a/src/testdir/test_fixeol.ok b/src/testdir/test_fixeol.ok
deleted file mode 100644 (file)
index 68ac9be..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-0
-with eol
-END
-without eolEND
-1
-with eol
-stays eol
-END
-without eol
-stays withoutEND
diff --git a/src/testdir/test_fixeol.vim b/src/testdir/test_fixeol.vim
new file mode 100644 (file)
index 0000000..32cb059
--- /dev/null
@@ -0,0 +1,48 @@
+" Tests for 'fixeol' and 'eol'
+func Test_fixeol()
+  " first write two test files – with and without trailing EOL
+  " use Unix fileformat for consistency
+  set ff=unix
+  enew!
+  call setline('.', 'with eol')
+  w! XXEol
+  enew!
+  set noeol nofixeol
+  call setline('.', 'without eol')
+  w! XXNoEol
+  set eol fixeol
+  bwipe XXEol XXNoEol
+
+  " try editing files with 'fixeol' disabled
+  e! XXEol
+  normal ostays eol
+  set nofixeol
+  w! XXTestEol
+  e! XXNoEol
+  normal ostays without
+  set nofixeol
+  w! XXTestNoEol
+  bwipe! XXEol XXNoEol XXTestEol XXTestNoEol
+  set fixeol
+
+  " Append "END" to each file so that we can see what the last written char
+  " was.
+  normal ggdGaEND
+  w >>XXEol
+  w >>XXNoEol
+  w >>XXTestEol
+  w >>XXTestNoEol
+
+  call assert_equal(['with eol', 'END'], readfile('XXEol'))
+  call assert_equal(['without eolEND'], readfile('XXNoEol'))
+  call assert_equal(['with eol', 'stays eol', 'END'], readfile('XXTestEol'))
+  call assert_equal(['without eol', 'stays withoutEND'],
+             \ readfile('XXTestNoEol'))
+
+  call delete('XXEol')
+  call delete('XXNoEol')
+  call delete('XXTestEol')
+  call delete('XXTestNoEol')
+  set ff& fixeol& eol&
+  enew!
+endfunc
diff --git a/src/testdir/test_listchars.in b/src/testdir/test_listchars.in
deleted file mode 100644 (file)
index 241b541..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-Tests for 'listchars' display with 'list' and :list
-
-STARTTEST
-:so small.vim
-:set ff=unix
-:let g:lines = []
-:function GetScreenCharsForLine(lnum)
-:  return join(map(range(1, virtcol('$')), 'nr2char(screenchar(a:lnum, v:val))'), '')
-:endfunction
-:nnoremap <expr> GG ":call add(g:lines, GetScreenCharsForLine(".screenrow()."))\<CR>"
-:set listchars+=tab:>-,space:.,trail:<
-:set list
-:
-/^start:/
-:normal! jzt
-GG
-GG
-GG
-GG
-GGH:
-:set listchars-=trail:<
-GG
-GG
-GG
-GG
-GG:
-:put =g:lines
-:'[,']w! test.out
-ENDTEST
-
-start:
-       aa      
-  bb     
-   cccc         
-dd        ee   
-
-
-STARTTEST
-:set listchars+=trail:<
-:set nolist
-:
-/^start:/
-:redir! >> test.out
-:+1,$list
-:redir END
-:q!
-ENDTEST
-
-start:
-  fff    
-       gg      
-     h 
-iii              
diff --git a/src/testdir/test_listchars.ok b/src/testdir/test_listchars.ok
deleted file mode 100644 (file)
index 1377a84..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
->-------aa>-----$
-..bb>---<<$
-...cccc><$
-dd........ee<<>-$
-<$
->-------aa>-----$
-..bb>---..$
-...cccc>.$
-dd........ee..>-$
-.$
-
-
-..fff>--<<$
->-------gg>-----$
-.....h>-$
-iii<<<<><<$
diff --git a/src/testdir/test_listchars.vim b/src/testdir/test_listchars.vim
new file mode 100644 (file)
index 0000000..57ea7ca
--- /dev/null
@@ -0,0 +1,63 @@
+" Tests for 'listchars' display with 'list' and :list
+
+source view_util.vim
+
+func Test_listchars()
+  enew!
+  set ff=unix
+  set list
+
+  set listchars+=tab:>-,space:.,trail:<
+  call append(0, [
+             \ '       aa      ',
+             \ '  bb     ',
+             \ '   cccc         ',
+             \ 'dd        ee   ',
+             \ ' '
+             \ ])
+  let expected = [
+             \ '>-------aa>-----$',
+             \ '..bb>---<<$',
+             \ '...cccc><$',
+             \ 'dd........ee<<>-$',
+             \ '<$'
+             \ ]
+  redraw!
+  for i in range(1, 5)
+    call cursor(i, 1)
+    call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
+  endfor
+
+  set listchars-=trail:<
+  let expected = [
+             \ '>-------aa>-----$',
+             \ '..bb>---..$',
+             \ '...cccc>.$',
+             \ 'dd........ee..>-$',
+             \ '.$'
+             \ ]
+  redraw!
+  for i in range(1, 5)
+    call cursor(i, 1)
+    call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
+  endfor
+
+  set listchars+=trail:<
+  set nolist
+  normal ggdG
+  call append(0, [
+             \ '  fff    ',
+             \ '       gg      ',
+             \ '     h ',
+             \ 'iii              ',
+             \ ])
+  let l = split(execute("%list"), "\n")
+  call assert_equal([
+             \ '..fff>--<<$',
+             \ '>-------gg>-----$',
+             \ '.....h>-$',
+             \ 'iii<<<<><<$', '$'], l)
+
+  enew!
+  set listchars& ff&
+endfunc
diff --git a/src/testdir/test_textformat.vim b/src/testdir/test_textformat.vim
new file mode 100644 (file)
index 0000000..999566c
--- /dev/null
@@ -0,0 +1,168 @@
+" Tests for the various 'formatoptions' settings
+func Test_text_format()
+  enew!
+
+  setl noai tw=2 fo=t
+  call append('$', [
+             \ '{',
+             \ '    ',
+             \ '',
+             \ '}'])
+  exe "normal /^{/+1\n0"
+  normal gRa b
+  let lnum = line('.')
+  call assert_equal([
+             \ 'a',
+             \ 'b'], getline(lnum - 1, lnum))
+
+  normal ggdG
+  setl ai tw=2 fo=tw
+  call append('$', [
+             \ '{',
+             \ 'a  b  ',
+             \ '',
+             \ 'a    ',
+             \ '}'])
+  exe "normal /^{/+1\n0"
+  normal gqgqjjllab
+  let lnum = line('.')
+  call assert_equal([
+             \ 'a  ',
+             \ 'b  ',
+             \ '',
+             \ 'a  ',
+             \ 'b'], getline(lnum - 4, lnum))
+
+  normal ggdG
+  setl tw=3 fo=t
+  call append('$', [
+             \ '{',
+             \ "a \<C-A>",
+             \ '}'])
+  exe "normal /^{/+1\n0"
+  exe "normal gqgqo\na \<C-V>\<C-A>"
+  let lnum = line('.')
+  call assert_equal([
+             \ 'a',
+             \ "\<C-A>",
+             \ '',
+             \ 'a',
+             \ "\<C-A>"], getline(lnum - 4, lnum))
+
+  normal ggdG
+  setl tw=2 fo=tcq1 comments=:#
+  call append('$', [
+             \ '{',
+             \ 'a b',
+             \ '#a b',
+             \ '}'])
+  exe "normal /^{/+1\n0"
+  exe "normal gqgqjgqgqo\na b\n#a b"
+  let lnum = line('.')
+  call assert_equal([
+             \ 'a b',
+             \ '#a b',
+             \ '',
+             \ 'a b',
+             \ '#a b'], getline(lnum - 4, lnum))
+
+  normal ggdG
+  setl tw=5 fo=tcn comments=:#
+  call append('$', [
+             \ '{',
+             \ '  1 a',
+             \ '# 1 a',
+             \ '}'])
+  exe "normal /^{/+1\n0"
+  exe "normal A b\<Esc>jA b"
+  let lnum = line('.')
+  call assert_equal([
+             \ '  1 a',
+             \ '    b',
+             \ '# 1 a',
+             \ '#   b'], getline(lnum - 3, lnum))
+
+  normal ggdG
+  setl tw=5 fo=t2a si
+  call append('$', [
+             \ '{',
+             \ '',
+             \ '  x a',
+             \ '  b',
+             \ ' c',
+             \ '',
+             \ '}'])
+  exe "normal /^{/+3\n0"
+  exe "normal i  \<Esc>A_"
+  let lnum = line('.')
+  call assert_equal([
+             \ '',
+             \ '  x a',
+             \ '    b_',
+             \ '    c',
+             \ ''], getline(lnum - 2, lnum + 2))
+
+  normal ggdG
+  setl tw=5 fo=qn comments=:#
+  call append('$', [
+             \ '{',
+             \ '# 1 a b',
+             \ '}'])
+  exe "normal /^{/+1\n5|"
+  normal gwap
+  call assert_equal(5, col('.'))
+  let lnum = line('.')
+  call assert_equal([
+             \ '# 1 a',
+             \ '#   b'], getline(lnum, lnum + 1))
+
+  normal ggdG
+  setl tw=5 fo=q2 comments=:#
+  call append('$', [
+             \ '{',
+             \ '# x',
+             \ '#   a b',
+             \ '}'])
+  exe "normal /^{/+1\n0"
+  normal gwap
+  let lnum = line('.')
+  call assert_equal([
+             \ '# x a',
+             \ '#   b'], getline(lnum, lnum + 1))
+
+  normal ggdG
+  setl tw& fo=a
+  call append('$', [
+             \ '{',
+             \ '   1aa',
+             \ '   2bb',
+             \ '}'])
+  exe "normal /^{/+2\n0"
+  normal I^^
+  call assert_equal('{ 1aa ^^2bb }', getline('.'))
+
+  normal ggdG
+  setl tw=20 fo=an12wcq comments=s1:/*,mb:*,ex:*/
+  call append('$', [
+             \ '/* abc def ghi jkl ',
+             \ ' *    mno pqr stu',
+             \ ' */'])
+  exe "normal /mno pqr/\n"
+  normal A vwx yz
+  let lnum = line('.')
+  call assert_equal([
+             \ ' *    mno pqr stu ',
+             \ ' *    vwx yz',
+             \ ' */'], getline(lnum - 1, lnum + 1))
+
+  normal ggdG
+  setl tw=12 fo=tqnc comments=:#
+  call setline('.', '# 1 xxxxx')
+  normal A foobar
+  call assert_equal([
+             \ '# 1 xxxxx',
+             \ '#   foobar'], getline(1, 2))
+
+  setl ai& tw& fo& si& comments&
+  enew!
+endfunc
index cf62d59374ecc0e5a0590f6961fcff09317b99ce..e38c188209494f5d18d9f40aa2210bed48d9a07c 100644 (file)
@@ -766,6 +766,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1302,
 /**/
     1301,
 /**/