changeset 12560:44aa2997239d v8.0.1158

patch 8.0.1158: still old style tests commit https://github.com/vim/vim/commit/db51007108a6ab0671e7f7b4844557cbe647185f Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 28 21:52:17 2017 +0200 patch 8.0.1158: still old style tests Problem: Still old style tests. Solution: Convert serveral tests to new style. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Thu, 28 Sep 2017 22:00:05 +0200
parents 34c8ec888122
children 0fa54e30be58
files src/Makefile src/testdir/Make_all.mak src/testdir/Make_vms.mms src/testdir/main.aap src/testdir/test33.in src/testdir/test33.ok src/testdir/test41.in src/testdir/test41.ok src/testdir/test43.in src/testdir/test43.ok src/testdir/test53.in src/testdir/test53.ok src/testdir/test_file_size.vim src/testdir/test_lispwords.vim src/testdir/test_search.vim src/testdir/test_textobjects.vim src/version.c
diffstat 17 files changed, 262 insertions(+), 263 deletions(-) [+]
line wrap: on
line diff
--- a/src/Makefile
+++ b/src/Makefile
@@ -2103,9 +2103,9 @@ test1 \
 	test3 test4 test5 test7 test8 \
 	test11 test12 test14 test15 test17 test19 \
 	test20 test25 test28 test29 \
-	test30 test31 test32 test33 test34 test36 test37 test38 test39 \
-	test40 test41 test42 test43 test44 test45 test48 test49 \
-	test50 test52 test53 test54 test55 test59 \
+	test30 test31 test32 test34 test36 test37 test38 test39 \
+	test40 test42 test44 test45 test48 test49 \
+	test50 test52 test54 test55 test59 \
 	test60 test64 test66 test68 test69 \
 	test70 test72 test73 test77 test78 test79 \
 	test83 test85 test86 test87 test88 \
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -25,20 +25,16 @@ SCRIPTS_ALL = \
 	test28.out \
 	test29.out \
 	test31.out \
-	test33.out \
 	test34.out \
 	test36.out \
 	test37.out \
 	test38.out \
 	test39.out \
 	test40.out \
-	test41.out \
 	test42.out \
-	test43.out \
 	test44.out \
 	test45.out \
 	test48.out \
-	test53.out \
 	test55.out \
 	test60.out \
 	test64.out \
--- a/src/testdir/Make_vms.mms
+++ b/src/testdir/Make_vms.mms
@@ -78,10 +78,10 @@ SCRIPT = test1.out  test3.out  test4.out
        test14.out test15.out \
        test19.out test20.out \
        test28.out test29.out test30.out test31.out test32.out \
-       test33.out test34.out test36.out test37.out \
-       test38.out test39.out test40.out test41.out test42.out \
-       test43.out test44.out test45.out \
-       test48.out test49.out test53.out test54.out \
+       test34.out test36.out test37.out \
+       test38.out test39.out test40.out test42.out \
+       test44.out test45.out \
+       test48.out test49.out test54.out \
        test55.out test60.out \
        test64.out \
        test66.out test68.out test69.out \
--- a/src/testdir/main.aap
+++ b/src/testdir/main.aap
@@ -10,9 +10,9 @@ Scripts = test1.out test2.out test3.out 
 		test18.out test19.out test20.out test21.out
 		test25.out test27.out
 		test28.out test29.out test30.out test31.out test32.out
-		test33.out test34.out test36.out test37.out
-		test38.out test39.out test40.out test41.out test42.out
-		test43.out test44.out test45.out test46.out test47.out
+		test34.out test36.out test37.out
+		test38.out test39.out test40.out test42.out
+		test44.out test45.out test46.out test47.out
 		test48.out test49.out test74.out
 
 ScriptsGUI = test16.out
deleted file mode 100644
--- a/src/testdir/test33.in
+++ /dev/null
@@ -1,34 +0,0 @@
-Test for 'lisp'
-If the lisp feature is not enabled, this will fail!
-
-STARTTEST
-:so small.vim
-:set lisp
-/^(defun
-=G:/^(defun/,$w! test.out
-:q!
-ENDTEST
-
-(defun html-file (base)
-(format nil "~(~A~).html" base))
-
-(defmacro page (name title &rest body)
-(let ((ti (gensym)))
-`(with-open-file (*standard-output*
-(html-file ,name)
-:direction :output
-:if-exists :supersede)
-(let ((,ti ,title))
-(as title ,ti)
-(with center 
-(as h2 (string-upcase ,ti)))
-(brs 3)
-,@body))))
-
-;;; Utilities for generating links
-
-(defmacro with-link (dest &rest body)
-`(progn
-(format t "<a href=\"~A\">" (html-file ,dest))
-,@body
-(princ "</a>")))
deleted file mode 100644
--- a/src/testdir/test33.ok
+++ /dev/null
@@ -1,23 +0,0 @@
-(defun html-file (base)
-  (format nil "~(~A~).html" base))
-
-(defmacro page (name title &rest body)
-  (let ((ti (gensym)))
-       `(with-open-file (*standard-output*
-			 (html-file ,name)
-			 :direction :output
-			 :if-exists :supersede)
-			(let ((,ti ,title))
-			     (as title ,ti)
-			     (with center 
-				   (as h2 (string-upcase ,ti)))
-			     (brs 3)
-			     ,@body))))
-
-;;; Utilities for generating links
-
-(defmacro with-link (dest &rest body)
-  `(progn
-    (format t "<a href=\"~A\">" (html-file ,dest))
-    ,@body
-    (princ "</a>")))
deleted file mode 100644
--- a/src/testdir/test41.in
+++ /dev/null
@@ -1,24 +0,0 @@
-Test for writing and reading a file of over 100 Kbyte
-
-1 line: "This is the start"
-3001 lines: "This is the leader"
-1 line: "This is the middle"
-3001 lines: "This is the trailer"
-1 line: "This is the end"
-
-STARTTEST
-:%d
-aThis is the start
-This is the leader
-This is the middle
-This is the trailer
-This is the endkY3000p2GY3000p
-:w! Xtest
-:%d
-:e! Xtest
-:.w! test.out
-3003G:.w >>test.out
-6005G:.w >>test.out
-:qa!
-ENDTEST
-
deleted file mode 100644
--- a/src/testdir/test41.ok
+++ /dev/null
@@ -1,3 +0,0 @@
-This is the start
-This is the middle
-This is the end
deleted file mode 100644
--- a/src/testdir/test43.in
+++ /dev/null
@@ -1,34 +0,0 @@
-Tests for regexp with various magic settings.
-
-STARTTEST
-:so small.vim
-:set nocompatible viminfo+=nviminfo
-/^1
-/a*b\{2}c\+/e
-x/\Md\*e\{2}f\+/e
-x:set nomagic
-/g\*h\{2}i\+/e
-x/\mj*k\{2}l\+/e
-x/\vm*n{2}o+/e
-x/\V^aa$
-x:set magic
-/\v(a)(b)\2\1\1/e
-x/\V[ab]\(\[xy]\)\1
-x:$
-:set undolevels=100
-dv?bar?
-Yup:"
-:?^1?,$w! test.out
-:qa!
-ENDTEST
-
-1 a aa abb abbccc
-2 d dd dee deefff
-3 g gg ghh ghhiii
-4 j jj jkk jkklll
-5 m mm mnn mnnooo
-6 x ^aa$ x
-7 (a)(b) abbaa
-8 axx [ab]xx
-9 foobar
-
deleted file mode 100644
--- a/src/testdir/test43.ok
+++ /dev/null
@@ -1,11 +0,0 @@
-1 a aa abb abbcc
-2 d dd dee deeff
-3 g gg ghh ghhii
-4 j jj jkk jkkll
-5 m mm mnn mnnoo
-6 x aa$ x
-7 (a)(b) abba
-8 axx ab]xx
-9 foobar
-9 foo
-
deleted file mode 100644
--- a/src/testdir/test53.in
+++ /dev/null
@@ -1,75 +0,0 @@
-Tests for string and html text objects. vim: set ft=vim :
-
-Note that the end-of-line moves the cursor to the next test line.
-
-Also test match() and matchstr()
-
-STARTTEST
-:so small.vim
-/^start:/
-da"
-0va'a'rx
-02f`da`
-0fXdi"
-03f'vi'ry
-:set quoteescape=+*-
-di`
-$F"va"oha"i"rz
-:"
-/^<begin
-jfXdit
-0fXdit
-fXdat
-0fXdat
-dit
-:"
-:put =matchstr(\"abcd\", \".\", 0, 2) " b
-:put =matchstr(\"abcd\", \"..\", 0, 2) " bc
-:put =matchstr(\"abcd\", \".\", 2, 0) " c (zero and negative -> first match)
-:put =matchstr(\"abcd\", \".\", 0, -1) " a
-:put =match(\"abcd\", \".\", 0, 5) " -1
-:put =match(\"abcd\", \".\", 0, -1) " 0
-:put =match('abc', '.', 0, 1) " 0
-:put =match('abc', '.', 0, 2) " 1
-:put =match('abc', '.', 0, 3) " 2
-:put =match('abc', '.', 0, 4) " -1
-:put =match('abc', '.', 1, 1) " 1
-:put =match('abc', '.', 2, 1) " 2
-:put =match('abc', '.', 3, 1) " -1
-:put =match('abc', '$', 0, 1) " 3
-:put =match('abc', '$', 0, 2) " -1
-:put =match('abc', '$', 1, 1) " 3
-:put =match('abc', '$', 2, 1) " 3
-:put =match('abc', '$', 3, 1) " 3
-:put =match('abc', '$', 4, 1) " -1
-:put =match('abc', '\zs', 0, 1) " 0
-:put =match('abc', '\zs', 0, 2) " 1
-:put =match('abc', '\zs', 0, 3) " 2
-:put =match('abc', '\zs', 0, 4) " 3
-:put =match('abc', '\zs', 0, 5) " -1
-:put =match('abc', '\zs', 1, 1) " 1
-:put =match('abc', '\zs', 2, 1) " 2
-:put =match('abc', '\zs', 3, 1) " 3
-:put =match('abc', '\zs', 4, 1) " -1
-:/^start:/,/^end:/wq! test.out
-ENDTEST
-
-start: "wo\"rd\\" foo
-'foo' 'bar' 'piep'
-bla bla `quote` blah
-out " in "noXno"
-"'" 'blah' rep 'buh'
-bla `s*`d-`+++`l**` b`la
-voo "nah" sdf " asdf" sdf " sdf" sd
-
-<begin>
--<b>asdf<i>Xasdf</i>asdf</b>-
--<b>asdX<i>a<i />sdf</i>asdf</b>-
--<b>asdf<i>Xasdf</i>asdf</b>-
--<b>asdX<i>as<b />df</i>asdf</b>-
--<b>
-innertext object
-</b>
-</begin>
-SEARCH:
-end:
deleted file mode 100644
--- a/src/testdir/test53.ok
+++ /dev/null
@@ -1,45 +0,0 @@
-start: foo
-xxxxxxxxxxxx'piep'
-bla bla blah
-out " in ""
-"'" 'blah'yyyyy'buh'
-bla `` b`la
-voo "zzzzzzzzzzzzzzzzzzzzzzzzzzzzsd
-
-<begin>
--<b>asdf<i></i>asdf</b>-
--<b></b>-
--<b>asdfasdf</b>-
---
--<b></b>
-</begin>
-b
-bc
-c
-a
--1
-0
-0
-1
-2
--1
-1
-2
--1
-3
--1
-3
-3
-3
--1
-0
-1
-2
-3
--1
-1
-2
-3
--1
-SEARCH:
-end:
--- a/src/testdir/test_file_size.vim
+++ b/src/testdir/test_file_size.vim
@@ -28,3 +28,31 @@ func Test_File_Size()
   call delete('Xtest')
   set belloff& fileformat& undolevels&
 endfunc
+
+" Test for writing and reading a file of over 100 Kbyte
+func Test_File_Read_Write()
+  enew!
+
+  " Create a file with the following contents
+  " 1 line: "This is the start"
+  " 3001 lines: "This is the leader"
+  " 1 line: "This is the middle"
+  " 3001 lines: "This is the trailer"
+  " 1 line: "This is the end"
+  call append(0, "This is the start")
+  call append(1, repeat(["This is the leader"], 3001))
+  call append(3002, "This is the middle")
+  call append(3003, repeat(["This is the trailer"], 3001))
+  call append(6004, "This is the end")
+
+  write! Xtest
+  enew!
+  edit! Xtest
+
+  call assert_equal("This is the start", getline(1))
+  call assert_equal("This is the middle", getline(3003))
+  call assert_equal("This is the end", getline(6005))
+
+  enew!
+  call delete("Xtest")
+endfunc
--- a/src/testdir/test_lispwords.vim
+++ b/src/testdir/test_lispwords.vim
@@ -14,3 +14,68 @@ func Test_global_local_lispwords()
   call assert_equal('foo,bar,baz', &l:lispwords)
   call assert_equal('foo,bar,baz', &lispwords)
 endfunc
+
+func Test_lisp_indent()
+  enew!
+
+  call append(0, [
+	      \ '(defun html-file (base)',
+	      \ '(format nil "~(~A~).html" base))',
+	      \ '',
+	      \ '(defmacro page (name title &rest body)',
+	      \ '(let ((ti (gensym)))',
+	      \ '`(with-open-file (*standard-output*',
+	      \ '(html-file ,name)',
+	      \ ':direction :output',
+	      \ ':if-exists :supersede)',
+	      \ '(let ((,ti ,title))',
+	      \ '(as title ,ti)',
+	      \ '(with center ',
+	      \ '(as h2 (string-upcase ,ti)))',
+	      \ '(brs 3)',
+	      \ ',@body))))',
+	      \ '',
+	      \ ';;; Utilities for generating links',
+	      \ '',
+	      \ '(defmacro with-link (dest &rest body)',
+	      \ '`(progn',
+	      \ '(format t "<a href=\"~A\">" (html-file ,dest))',
+	      \ ',@body',
+	      \ '(princ "</a>")))'
+	      \ ])
+  set lisp
+  set lispwords&
+  let save_copt = &cpoptions
+  set cpoptions+=p
+  normal 1G=G
+
+  call assert_equal([
+	      \ '(defun html-file (base)',
+	      \ '  (format nil "~(~A~).html" base))',
+	      \ '',
+	      \ '(defmacro page (name title &rest body)',
+	      \ '  (let ((ti (gensym)))',
+	      \ '       `(with-open-file (*standard-output*',
+	      \ '			 (html-file ,name)',
+	      \ '			 :direction :output',
+	      \ '			 :if-exists :supersede)',
+	      \ '			(let ((,ti ,title))',
+	      \ '			     (as title ,ti)',
+	      \ '			     (with center ',
+	      \ '				   (as h2 (string-upcase ,ti)))',
+	      \ '			     (brs 3)',
+	      \ '			     ,@body))))',
+	      \ '',
+	      \ ';;; Utilities for generating links',
+	      \ '',
+	      \ '(defmacro with-link (dest &rest body)',
+	      \ '  `(progn',
+	      \ '    (format t "<a href=\"~A\">" (html-file ,dest))',
+	      \ '    ,@body',
+	      \ '    (princ "</a>")))',
+	      \ ''
+	      \ ], getline(1, "$"))
+
+  enew!
+  let &cpoptions=save_copt
+endfunc
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -356,3 +356,59 @@ func Test_search_cmdline4()
   call test_override("char_avail", 0)
   bw!
 endfunc
+
+" Tests for regexp with various magic settings
+func Test_search_regexp()
+  enew!
+
+  put ='1 a aa abb abbccc'
+  exe 'normal! /a*b\{2}c\+/e' . "\<CR>"
+  call assert_equal([0, 2, 17, 0], getpos('.'))
+
+  put ='2 d dd dee deefff'
+  exe 'normal! /\Md\*e\{2}f\+/e' . "\<CR>"
+  call assert_equal([0, 3, 17, 0], getpos('.'))
+
+  set nomagic
+  put ='3 g gg ghh ghhiii'
+  exe 'normal! /g\*h\{2}i\+/e' . "\<CR>"
+  call assert_equal([0, 4, 17, 0], getpos('.'))
+
+  put ='4 j jj jkk jkklll'
+  exe 'normal! /\mj*k\{2}l\+/e' . "\<CR>"
+  call assert_equal([0, 5, 17, 0], getpos('.'))
+
+  put ='5 m mm mnn mnnooo'
+  exe 'normal! /\vm*n{2}o+/e' . "\<CR>"
+  call assert_equal([0, 6, 17, 0], getpos('.'))
+
+  put ='6 x ^aa$ x'
+  exe 'normal! /\V^aa$' . "\<CR>"
+  call assert_equal([0, 7, 5, 0], getpos('.'))
+
+  set magic
+  put ='7 (a)(b) abbaa'
+  exe 'normal! /\v(a)(b)\2\1\1/e' . "\<CR>"
+  call assert_equal([0, 8, 14, 0], getpos('.'))
+
+  put ='8 axx [ab]xx'
+  exe 'normal! /\V[ab]\(\[xy]\)\1' . "\<CR>"
+  call assert_equal([0, 9, 7, 0], getpos('.'))
+
+  set undolevels=100
+  put ='9 foobar'
+  put =''
+  exe "normal! a\<C-G>u\<Esc>"
+  normal G
+  exe 'normal! dv?bar?' . "\<CR>"
+  call assert_equal('9 foo', getline('.'))
+  call assert_equal([0, 10, 5, 0], getpos('.'))
+  call assert_equal(10, line('$'))
+  normal u
+  call assert_equal('9 foobar', getline('.'))
+  call assert_equal([0, 10, 6, 0], getpos('.'))
+  call assert_equal(11, line('$'))
+
+  set undolevels&
+  enew!
+endfunc
--- a/src/testdir/test_textobjects.vim
+++ b/src/testdir/test_textobjects.vim
@@ -52,3 +52,104 @@ func Test_quote_selection_selection_excl
   set selection&vim
   bw!
 endfunc
+
+" Tests for string and html text objects
+func Test_string_html_objects()
+  enew!
+
+  let t = '"wo\"rd\\" foo'
+  put =t
+  normal! da"
+  call assert_equal('foo', getline('.'))
+
+  let t = "'foo' 'bar' 'piep'"
+  put =t
+  normal! 0va'a'rx
+  call assert_equal("xxxxxxxxxxxx'piep'", getline('.'))
+
+  let t = "bla bla `quote` blah"
+  put =t
+  normal! 02f`da`
+  call assert_equal("bla bla blah", getline('.'))
+
+  let t = 'out " in "noXno"'
+  put =t
+  normal! 0fXdi"
+  call assert_equal('out " in ""', getline('.'))
+
+  let t = "\"'\" 'blah' rep 'buh'"
+  put =t
+  normal! 03f'vi'ry
+  call assert_equal("\"'\" 'blah'yyyyy'buh'", getline('.'))
+
+  set quoteescape=+*-
+  let t = "bla `s*`d-`+++`l**` b`la"
+  put =t
+  normal! di`
+  call assert_equal("bla `` b`la", getline('.'))
+
+  let t = 'voo "nah" sdf " asdf" sdf " sdf" sd'
+  put =t
+  normal! $F"va"oha"i"rz
+  call assert_equal('voo "zzzzzzzzzzzzzzzzzzzzzzzzzzzzsd', getline('.'))
+
+  let t = "-<b>asdf<i>Xasdf</i>asdf</b>-"
+  put =t
+  normal! fXdit
+  call assert_equal('-<b>asdf<i></i>asdf</b>-', getline('.'))
+
+  let t = "-<b>asdX<i>a<i />sdf</i>asdf</b>-"
+  put =t
+  normal! 0fXdit
+  call assert_equal('-<b></b>-', getline('.'))
+
+  let t = "-<b>asdf<i>Xasdf</i>asdf</b>-"
+  put =t
+  normal! fXdat
+  call assert_equal('-<b>asdfasdf</b>-', getline('.'))
+
+  let t = "-<b>asdX<i>as<b />df</i>asdf</b>-"
+  put =t
+  normal! 0fXdat
+  call assert_equal('--', getline('.'))
+
+  let t = "-<b>\ninnertext object\n</b>"
+  put =t
+  normal! dit
+  call assert_equal('-<b></b>', getline('.'))
+
+  set quoteescape&
+  enew!
+endfunc
+
+" Tests for match() and matchstr()
+func Test_match()
+  call assert_equal("b", matchstr("abcd", ".", 0, 2))
+  call assert_equal("bc", matchstr("abcd", "..", 0, 2))
+  call assert_equal("c", matchstr("abcd", ".", 2, 0))
+  call assert_equal("a", matchstr("abcd", ".", 0, -1))
+  call assert_equal(-1, match("abcd", ".", 0, 5))
+  call assert_equal(0 , match("abcd", ".", 0, -1))
+  call assert_equal(0 , match('abc', '.', 0, 1))
+  call assert_equal(1 , match('abc', '.', 0, 2))
+  call assert_equal(2 , match('abc', '.', 0, 3))
+  call assert_equal(-1, match('abc', '.', 0, 4))
+  call assert_equal(1 , match('abc', '.', 1, 1))
+  call assert_equal(2 , match('abc', '.', 2, 1))
+  call assert_equal(-1, match('abc', '.', 3, 1))
+  call assert_equal(3 , match('abc', '$', 0, 1))
+  call assert_equal(-1, match('abc', '$', 0, 2))
+  call assert_equal(3 , match('abc', '$', 1, 1))
+  call assert_equal(3 , match('abc', '$', 2, 1))
+  call assert_equal(3 , match('abc', '$', 3, 1))
+  call assert_equal(-1, match('abc', '$', 4, 1))
+  call assert_equal(0 , match('abc', '\zs', 0, 1))
+  call assert_equal(1 , match('abc', '\zs', 0, 2))
+  call assert_equal(2 , match('abc', '\zs', 0, 3))
+  call assert_equal(3 , match('abc', '\zs', 0, 4))
+  call assert_equal(-1, match('abc', '\zs', 0, 5))
+  call assert_equal(1 , match('abc', '\zs', 1, 1))
+  call assert_equal(2 , match('abc', '\zs', 2, 1))
+  call assert_equal(3 , match('abc', '\zs', 3, 1))
+  call assert_equal(-1, match('abc', '\zs', 4, 1))
+endfunc
--- a/src/version.c
+++ b/src/version.c
@@ -762,6 +762,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1158,
+/**/
     1157,
 /**/
     1156,