changeset 10145:eb9a7296ae9f v7.4.2343

commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 7 20:46:39 2016 +0200 patch 7.4.2343 Problem: Too many old file tests. Solution: Turn several into new style tests. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Wed, 07 Sep 2016 21:00:08 +0200
parents edc80d8a7d2f
children f812ea9d4c28
files src/Makefile src/testdir/Make_all.mak src/testdir/test101.in src/testdir/test101.ok src/testdir/test18.in src/testdir/test18.ok src/testdir/test2.in src/testdir/test2.ok src/testdir/test21.in src/testdir/test21.ok src/testdir/test6.in src/testdir/test6.ok src/testdir/test_arglist.vim src/testdir/test_charsearch.vim src/testdir/test_fnameescape.vim src/testdir/test_gf.vim src/testdir/test_hlsearch.vim src/testdir/test_smartindent.vim src/testdir/test_tagjump.vim src/version.c
diffstat 20 files changed, 153 insertions(+), 186 deletions(-) [+]
line wrap: on
line diff
--- a/src/Makefile
+++ b/src/Makefile
@@ -2041,7 +2041,7 @@ test1 \
 	test_search_mbyte \
 	test_utf8 \
 	test_wordcount \
-	test2 test3 test4 test5 test6 test7 test8 test9 \
+	test3 test4 test5 test6 test7 test8 test9 \
 	test11 test12 test14 test15 test17 test18 test19 \
 	test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \
 	test30 test31 test32 test33 test34 test36 test37 test38 test39 \
@@ -2085,12 +2085,14 @@ test_arglist \
 	test_fnameescape \
 	test_fnamemodify \
 	test_glob2regpat \
+	test_gf \
 	test_gn \
 	test_goto \
 	test_gui \
 	test_hardcopy \
 	test_help_tagjump \
 	test_history \
+	test_hlsearch \
 	test_increment \
 	test_increment_dbcs \
 	test_job_fails \
@@ -2128,6 +2130,7 @@ test_arglist \
 	test_signs \
 	test_sort \
 	test_source_utf8 \
+	test_smartindent \
 	test_startup \
 	test_startup_utf8 \
 	test_stat \
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -13,16 +13,13 @@ SCRIPTS_ALL = \
 	test3.out \
 	test4.out \
 	test5.out \
-	test6.out \
 	test7.out \
 	test8.out \
 	test9.out \
 	test14.out \
 	test15.out \
-	test18.out \
 	test19.out \
 	test20.out \
-	test21.out \
 	test22.out \
 	test23.out \
 	test24.out \
@@ -74,7 +71,6 @@ SCRIPTS_ALL = \
 	test95.out \
 	test98.out \
 	test99.out \
-	test101.out \
 	test103.out \
 	test104.out \
 	test107.out \
@@ -109,7 +105,6 @@ SCRIPTS_MORE1 = \
 
 # Tests that run on most systems, but not on Amiga and DOS/Windows.
 SCRIPTS_MORE2 = \
-	test2.out \
 	test12.out \
 	test25.out \
 	test49.out \
@@ -147,7 +142,7 @@ SCRIPTS_GUI =
 # Keep test_alot*.res as the last one, sort the others.
 NEW_TESTS = test_arglist.res \
 	    test_assert.res \
-	    test_autochdir \
+	    test_autochdir.res \
 	    test_backspace_opt.res \
 	    test_bufwintabinfo.res \
 	    test_cdo.res \
@@ -159,10 +154,12 @@ NEW_TESTS = test_arglist.res \
 	    test_digraph.res \
 	    test_farsi.res \
 	    test_fnameescape.res \
+	    test_gf.res \
 	    test_gn.res \
 	    test_gui.res \
 	    test_hardcopy.res \
 	    test_history.res \
+	    test_hlsearch.res \
 	    test_increment.res \
 	    test_increment_dbcs.res \
 	    test_job_fails.res \
@@ -180,6 +177,7 @@ NEW_TESTS = test_arglist.res \
 	    test_ruby.res \
 	    test_search.res \
 	    test_signs.res \
+	    test_smartindent.res \
 	    test_startup.res \
 	    test_startup_utf8.res \
 	    test_stat.res \
deleted file mode 100644
--- a/src/testdir/test101.in
+++ /dev/null
@@ -1,48 +0,0 @@
-Test for v:hlsearch     vim: set ft=vim :
-
-STARTTEST
-:" Last abc: Q
-:so small.vim
-:new
-:call setline(1, repeat(['aaa'], 10))
-:set hlsearch nolazyredraw
-:let r=[]
-:command -nargs=0 -bar AddR :call add(r, [screenattr(1, 1), v:hlsearch])
-/aaa
-:AddR
-:nohlsearch
-:AddR
-:let v:hlsearch=1
-:AddR
-:let v:hlsearch=0
-:AddR
-:set hlsearch
-:AddR
-:let v:hlsearch=0
-:AddR
-n:AddR
-:let v:hlsearch=0
-:AddR
-/
-:AddR
-:set nohls
-/
-:AddR
-:let r1=r[0][0]
-:" I guess it is not guaranteed that screenattr outputs always the same character
-:call map(r, 'v:val[1].":".(v:val[0]==r1?"highlighted":"not highlighted")')
-:try
-:   let v:hlsearch=[]
-:catch
-:   call add(r, matchstr(v:exception,'^Vim(let):E\d\+:'))
-:endtry
-:bwipeout!
-:$put=r
-:call garbagecollect(1)
-:"
-:/^start:/,$wq! test.out
-:" vim: et ts=4 isk-=\:
-:call getchar()
-ENDTEST
-
-start:
deleted file mode 100644
--- a/src/testdir/test101.ok
+++ /dev/null
@@ -1,12 +0,0 @@
-start:
-1:highlighted
-0:not highlighted
-1:highlighted
-0:not highlighted
-1:highlighted
-0:not highlighted
-1:highlighted
-0:not highlighted
-1:highlighted
-0:not highlighted
-Vim(let):E745:
deleted file mode 100644
--- a/src/testdir/test18.in
+++ /dev/null
@@ -1,16 +0,0 @@
-Tests for not doing smart indenting when it isn't set.
-
-STARTTEST
-:so small.vim
-:set nocin nosi ai
-/some
-2cc#test
-:?start?,$w! test.out
-:qa!
-ENDTEST
-
-start text
-		some test text
-		test text
-test text
-		test text
deleted file mode 100644
--- a/src/testdir/test18.ok
+++ /dev/null
@@ -1,4 +0,0 @@
-start text
-		#test
-test text
-		test text
deleted file mode 100644
--- a/src/testdir/test2.in
+++ /dev/null
@@ -1,29 +0,0 @@
-
-This is a test if a URL is recognized by "gf", with the cursor before and
-after the "://".  Also test ":\\".
-
-STARTTEST
-:so small.vim
-/^first
-/tmp
-:call append(0, expand("<cfile>"))
-/^second
-/URL
-:call append(1, expand("<cfile>"))
-:if has("ebcdic")
-: set isf=@,240-249,/,.,-,_,+,,,$,:,~,\
-:else
-: set isf=@,48-57,/,.,-,_,+,,,$,:,~,\
-:endif
-/^third
-/name
-:call append(2, expand("<cfile>"))
-/^fourth
-/URL
-:call append(3, expand("<cfile>"))
-5GdG:wq! test.out
-ENDTEST
-first test for URL://machine.name/tmp/vimtest2a and other text
-second test for URL://machine.name/tmp/vimtest2b. And other text
-third test for URL:\\machine.name\vimtest2c and other text
-fourth test for URL:\\machine.name\tmp\vimtest2d, and other text
deleted file mode 100644
--- a/src/testdir/test2.ok
+++ /dev/null
@@ -1,4 +0,0 @@
-URL://machine.name/tmp/vimtest2a
-URL://machine.name/tmp/vimtest2b
-URL:\\machine.name\vimtest2c
-URL:\\machine.name\tmp\vimtest2d
deleted file mode 100644
--- a/src/testdir/test21.in
+++ /dev/null
@@ -1,19 +0,0 @@
-Tests for [ CTRL-I with a count and CTRL-W CTRL-I with a count
-
-STARTTEST
-:so small.vim
-/start
-6[	:.w! test.out
-?start here
-6	:.w >>test.out
-:qa!
-ENDTEST
-
-#include test21.in
-
-/* test text test tex start here
-		some text
-		test text
-		start OK if found this line
-	start found wrong line
-test text
deleted file mode 100644
--- a/src/testdir/test21.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-		start OK if found this line
-		start OK if found this line
deleted file mode 100644
--- a/src/testdir/test6.in
+++ /dev/null
@@ -1,24 +0,0 @@
-Test for autocommand that redefines the argument list, when doing ":all".
-
-STARTTEST
-:so small.vim
-:au BufReadPost Xxx2 next Xxx2 Xxx1
-/^start of
-A1:.,/end of/w! Xxx1    " write test file Xxx1
-$r2:.,/end of/w! Xxx2     " write test file Xxx2
-$r3:.,/end of/w! Xxx3     " write test file Xxx3
-:next! Xxx1 Xxx2 Xxx3     " redefine arglist; go to Xxx1
-:all                      " open window for all args
-:w! test.out              " Write contents of Xxx1
-:w >>test.out     " Append contents of last window (Xxx1)
-:rew                      " should now be in Xxx2
-:w >>test.out             " Append contents of Xxx2
-:qa!
-ENDTEST
-
-start of test file Xxx
-	this is a test
-	this is a test
-	this is a test
-	this is a test
-end of test file Xxx
deleted file mode 100644
--- a/src/testdir/test6.ok
+++ /dev/null
@@ -1,18 +0,0 @@
-start of test file Xxx1
-	this is a test
-	this is a test
-	this is a test
-	this is a test
-end of test file Xxx
-start of test file Xxx1
-	this is a test
-	this is a test
-	this is a test
-	this is a test
-end of test file Xxx
-start of test file Xxx2
-	this is a test
-	this is a test
-	this is a test
-	this is a test
-end of test file Xxx
--- a/src/testdir/test_arglist.vim
+++ b/src/testdir/test_arglist.vim
@@ -287,3 +287,32 @@ function Test_argpos()
   call assert_equal(0, argidx())
   %argd
 endfunction
+
+" Test for autocommand that redefines the argument list, when doing ":all".
+function Test_arglist_autocmd()
+  autocmd BufReadPost Xxx2 next Xxx2 Xxx1
+  call writefile(['test file Xxx1'], 'Xxx1')
+  call writefile(['test file Xxx2'], 'Xxx2')
+  call writefile(['test file Xxx3'], 'Xxx3')
+
+  new
+  " redefine arglist; go to Xxx1
+  next! Xxx1 Xxx2 Xxx3
+  " open window for all args
+  all
+  call assert_equal('test file Xxx1', getline(1))
+  wincmd w
+  wincmd w
+  call assert_equal('test file Xxx1', getline(1))
+  " should now be in Xxx2
+  rewind
+  call assert_equal('test file Xxx2', getline(1))
+
+  autocmd! BufReadPost Xxx2
+  enew! | only
+  call delete('Xxx1')
+  call delete('Xxx2')
+  call delete('Xxx3')
+  argdelete Xxx*
+  bwipe! Xxx1 Xxx2 Xxx3
+endfunction
--- a/src/testdir/test_charsearch.vim
+++ b/src/testdir/test_charsearch.vim
@@ -2,8 +2,8 @@
 function! Test_charsearch()
   enew!
   call append(0, ['Xabcdefghijkemnopqretuvwxyz',
-      	\ 'Yabcdefghijkemnopqretuvwxyz',
-      	\ 'Zabcdefghijkemnokqretkvwxyz'])
+	      \ 'Yabcdefghijkemnopqretuvwxyz',
+	      \ 'Zabcdefghijkemnokqretkvwxyz'])
   " check that "fe" and ";" work
   1
   normal! ylfep;;p,,p
--- a/src/testdir/test_fnameescape.vim
+++ b/src/testdir/test_fnameescape.vim
@@ -6,7 +6,7 @@ function! Test_fnameescape()
   try
     exe "w! " . fnameescape(fname)
     let status = v:true
-  endtry 
+  endtry
   call assert_true(status, "Space")
   call delete(fname)
 
new file mode 100644
--- /dev/null
+++ b/src/testdir/test_gf.vim
@@ -0,0 +1,33 @@
+
+" This is a test if a URL is recognized by "gf", with the cursor before and
+" after the "://".  Also test ":\\".
+function! Test_gf_url()
+  enew!
+  call append(0, [
+      \ "first test for URL://machine.name/tmp/vimtest2a and other text",
+      \ "second test for URL://machine.name/tmp/vimtest2b. And other text",
+      \ "third test for URL:\\\\machine.name\\vimtest2c and other text",
+      \ "fourth test for URL:\\\\machine.name\\tmp\\vimtest2d, and other text"
+      \ ])
+  call cursor(1,1)
+  call search("^first")
+  call search("tmp")
+  call assert_equal("URL://machine.name/tmp/vimtest2a", expand("<cfile>"))
+  call search("^second")
+  call search("URL")
+  call assert_equal("URL://machine.name/tmp/vimtest2b", expand("<cfile>"))
+  if has("ebcdic")
+      set isf=@,240-249,/,.,-,_,+,,,$,:,~,\
+  else
+      set isf=@,48-57,/,.,-,_,+,,,$,:,~,\
+  endif
+  call search("^third")
+  call search("name")
+  call assert_equal("URL:\\\\machine.name\\vimtest2c", expand("<cfile>"))
+  call search("^fourth")
+  call search("URL")
+  call assert_equal("URL:\\\\machine.name\\tmp\\vimtest2d", expand("<cfile>"))
+
+  set isf&vim
+  enew!
+endfunction
new file mode 100644
--- /dev/null
+++ b/src/testdir/test_hlsearch.vim
@@ -0,0 +1,34 @@
+" Test for v:hlsearch
+
+function! Test_hlsearch()
+  new
+  call setline(1, repeat(['aaa'], 10))
+  set hlsearch nolazyredraw
+  let r=[]
+  " redraw is needed to make hlsearch highlight the matches
+  exe "normal! /aaa\<CR>" | redraw
+  let r1 = screenattr(1, 1)
+  nohlsearch | redraw
+  call assert_notequal(r1, screenattr(1,1))
+  let v:hlsearch=1 | redraw
+  call assert_equal(r1, screenattr(1,1))
+  let v:hlsearch=0 | redraw
+  call assert_notequal(r1, screenattr(1,1))
+  set hlsearch | redraw
+  call assert_equal(r1, screenattr(1,1))
+  let v:hlsearch=0 | redraw
+  call assert_notequal(r1, screenattr(1,1))
+  exe "normal! n" | redraw
+  call assert_equal(r1, screenattr(1,1))
+  let v:hlsearch=0 | redraw
+  call assert_notequal(r1, screenattr(1,1))
+  exe "normal! /\<CR>" | redraw
+  call assert_equal(r1, screenattr(1,1))
+  set nohls
+  exe "normal! /\<CR>" | redraw
+  call assert_notequal(r1, screenattr(1,1))
+  call assert_fails('let v:hlsearch=[]', 'E745')
+  call garbagecollect(1)
+  call getchar(1)
+  enew!
+endfunction
new file mode 100644
--- /dev/null
+++ b/src/testdir/test_smartindent.vim
@@ -0,0 +1,14 @@
+
+" Tests for not doing smart indenting when it isn't set.
+function! Test_nosmartindent()
+  new
+  call append(0, ["		some test text",
+      	\ "		test text",
+      	\ "test text",
+      	\ "		test text"])
+  set nocindent nosmartindent autoindent
+  exe "normal! gg/some\<CR>"
+  exe "normal! 2cc#test\<Esc>"
+  call assert_equal("		#test", getline(1))
+  enew! | close
+endfunction
--- a/src/testdir/test_tagjump.vim
+++ b/src/testdir/test_tagjump.vim
@@ -23,4 +23,34 @@ func Test_cancel_ptjump()
   quit
 endfunc
 
+" Tests for [ CTRL-I and CTRL-W CTRL-I commands
+function Test_keyword_jump()
+  call writefile(["#include Xinclude", "",
+	      \ "",
+	      \ "/* test text test tex start here",
+	      \ "		some text",
+	      \ "		test text",
+	      \ "		start OK if found this line",
+	      \ "	start found wrong line",
+	      \ "test text"], 'Xtestfile')
+  call writefile(["/* test text test tex start here",
+	      \ "		some text",
+	      \ "		test text",
+	      \ "		start OK if found this line",
+	      \ "	start found wrong line",
+	      \ "test text"], 'Xinclude')
+  new Xtestfile
+  call cursor(1,1)
+  call search("start")
+  exe "normal! 5[\<C-I>"
+  call assert_equal("		start OK if found this line", getline('.'))
+  call cursor(1,1)
+  call search("start")
+  exe "normal! 5\<C-W>\<C-I>"
+  call assert_equal("		start OK if found this line", getline('.'))
+  enew! | only
+  call delete('Xtestfile')
+  call delete('Xinclude')
+endfunction
+
 " vim: shiftwidth=2 sts=2 expandtab
--- a/src/version.c
+++ b/src/version.c
@@ -764,6 +764,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2343,
+/**/
     2342,
 /**/
     2341,