]> granicus.if.org Git - vim/commitdiff
patch 8.0.1158: still old style tests v8.0.1158
authorBram Moolenaar <Bram@vim.org>
Thu, 28 Sep 2017 19:52:17 +0000 (21:52 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 28 Sep 2017 19:52:17 +0000 (21:52 +0200)
Problem:    Still old style tests.
Solution:   Convert serveral tests to new style. (Yegappan Lakshmanan)

17 files changed:
src/Makefile
src/testdir/Make_all.mak
src/testdir/Make_vms.mms
src/testdir/main.aap
src/testdir/test33.in [deleted file]
src/testdir/test33.ok [deleted file]
src/testdir/test41.in [deleted file]
src/testdir/test41.ok [deleted file]
src/testdir/test43.in [deleted file]
src/testdir/test43.ok [deleted file]
src/testdir/test53.in [deleted file]
src/testdir/test53.ok [deleted file]
src/testdir/test_file_size.vim
src/testdir/test_lispwords.vim
src/testdir/test_search.vim
src/testdir/test_textobjects.vim
src/version.c

index cecef8d4425baf19611256b68222f20620599c53..06204bddb0b2fc1d63b31cc51f354d61a113bc31 100644 (file)
@@ -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 \
index fe6aa5235e8cd8099ebb3897f88043613a6af7cf..e27ee93466b0034ac917aae59930b027b008e9c8 100644 (file)
@@ -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 \
index e4373965ef0f7a5d231b787fb55e34e2ab83556f..5d7770d330d15a560e1bfd3fc9d744e29277e20d 100644 (file)
@@ -78,10 +78,10 @@ SCRIPT = test1.out  test3.out  test4.out  test5.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 \
index 4fb6ca699129078abdcb1facae2a71b414777c15..eb80a81f0d079a0275aba0c04c942425d7c35481 100644 (file)
@@ -10,9 +10,9 @@ Scripts = test1.out test2.out test3.out test4.out test5.out test6.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
diff --git a/src/testdir/test33.in b/src/testdir/test33.in
deleted file mode 100644 (file)
index 5644760..0000000
+++ /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>")))
diff --git a/src/testdir/test33.ok b/src/testdir/test33.ok
deleted file mode 100644 (file)
index cd1d87a..0000000
+++ /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>")))
diff --git a/src/testdir/test41.in b/src/testdir/test41.in
deleted file mode 100644 (file)
index 2d294ca..0000000
+++ /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 end\ekY3000p2GY3000p
-:w! Xtest
-:%d
-:e! Xtest
-:.w! test.out
-3003G:.w >>test.out
-6005G:.w >>test.out
-:qa!
-ENDTEST
-
diff --git a/src/testdir/test41.ok b/src/testdir/test41.ok
deleted file mode 100644 (file)
index 988e5f2..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-This is the start
-This is the middle
-This is the end
diff --git a/src/testdir/test43.in b/src/testdir/test43.in
deleted file mode 100644 (file)
index 7c54507..0000000
+++ /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
-
diff --git a/src/testdir/test43.ok b/src/testdir/test43.ok
deleted file mode 100644 (file)
index 0b37a6a..0000000
+++ /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
-
diff --git a/src/testdir/test53.in b/src/testdir/test53.in
deleted file mode 100644 (file)
index b5f97f2..0000000
+++ /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:
diff --git a/src/testdir/test53.ok b/src/testdir/test53.ok
deleted file mode 100644 (file)
index d57d86b..0000000
+++ /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:
index 624d49359b756039254041538b2ee40e281db556..8dac3b2ac4c79842f40add6461cb67b9df909350 100644 (file)
@@ -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
index 6d370a8bfe1e0fbc524af5d932960a281dd21cd3..c7eda83540334102d58ff0eb312d16dbd9a913e3 100644 (file)
@@ -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
index 69b1335efbd430fed347819a8c234a181e76bc84..5ae101f1ecd295750aeeac964cc02f0755c2bcc0 100644 (file)
@@ -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
index dca8f6320bbca4a5670c8523992384272706dd57..8b92ba15d9b37d459deae65506bb5cfab0fb140f 100644 (file)
@@ -52,3 +52,104 @@ func Test_quote_selection_selection_exclusive()
   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
index cf76f81d5212434c0516be8a05b4e9e79a1d2565..f45ad7d0f4eaf4d36c7a2d8a650020a6d8570c10 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1158,
 /**/
     1157,
 /**/