To: vim_dev@googlegroups.com Subject: Patch 8.0.1158 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1158 Problem: Still old style tests. Solution: Convert serveral tests to new style. (Yegappan Lakshmanan) 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 *** ../vim-8.0.1157/src/Makefile 2017-09-23 19:24:20.590848308 +0200 --- src/Makefile 2017-09-28 21:32:41.493778403 +0200 *************** *** 2103,2111 **** 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 \ test60 test64 test66 test68 test69 \ test70 test72 test73 test77 test78 test79 \ test83 test85 test86 test87 test88 \ --- 2104,2112 ---- test3 test4 test5 test7 test8 \ test11 test12 test14 test15 test17 test19 \ test20 test25 test28 test29 \ ! 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 \ *** ../vim-8.0.1157/src/testdir/Make_all.mak 2017-09-23 19:24:20.594848284 +0200 --- src/testdir/Make_all.mak 2017-09-28 21:32:41.493778403 +0200 *************** *** 25,44 **** 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 \ --- 25,40 ---- *** ../vim-8.0.1157/src/testdir/Make_vms.mms 2017-09-23 19:24:20.594848284 +0200 --- src/testdir/Make_vms.mms 2017-09-28 21:32:41.497778377 +0200 *************** *** 78,87 **** 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 \ test55.out test60.out \ test64.out \ test66.out test68.out test69.out \ --- 78,87 ---- test14.out test15.out \ test19.out test20.out \ test28.out test29.out test30.out test31.out test32.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 \ *** ../vim-8.0.1157/src/testdir/main.aap 2017-08-04 22:36:01.562927288 +0200 --- src/testdir/main.aap 2017-09-28 21:32:41.497778377 +0200 *************** *** 10,18 **** 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 test48.out test49.out test74.out ScriptsGUI = test16.out --- 10,18 ---- test18.out test19.out test20.out test21.out test25.out test27.out test28.out test29.out test30.out test31.out test32.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 *** ../vim-8.0.1157/src/testdir/test33.in 2010-05-15 13:04:10.000000000 +0200 --- src/testdir/test33.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,34 **** - 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 "" (html-file ,dest)) - ,@body - (princ ""))) --- 0 ---- *** ../vim-8.0.1157/src/testdir/test33.ok 2010-05-15 13:04:10.000000000 +0200 --- src/testdir/test33.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,23 **** - (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 "" (html-file ,dest)) - ,@body - (princ ""))) --- 0 ---- *** ../vim-8.0.1157/src/testdir/test41.in 2010-05-15 13:04:10.000000000 +0200 --- src/testdir/test41.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,24 **** - 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 - --- 0 ---- *** ../vim-8.0.1157/src/testdir/test41.ok 2010-05-15 13:04:10.000000000 +0200 --- src/testdir/test41.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,3 **** - This is the start - This is the middle - This is the end --- 0 ---- *** ../vim-8.0.1157/src/testdir/test43.in 2012-01-26 18:00:06.000000000 +0100 --- src/testdir/test43.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,34 **** - 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 - --- 0 ---- *** ../vim-8.0.1157/src/testdir/test43.ok 2012-01-10 13:42:39.000000000 +0100 --- src/testdir/test43.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,11 **** - 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 - --- 0 ---- *** ../vim-8.0.1157/src/testdir/test53.in 2016-07-24 17:21:02.000000000 +0200 --- src/testdir/test53.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,75 **** - 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 - :" - /^ 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 - - - -asdfXasdfasdf- - -asdXasdfasdf- - -asdfXasdfasdf- - -asdXasdfasdf- - - - innertext object - - - SEARCH: - end: --- 0 ---- *** ../vim-8.0.1157/src/testdir/test53.ok 2016-07-24 17:21:02.000000000 +0200 --- src/testdir/test53.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,45 **** - start: foo - xxxxxxxxxxxx'piep' - bla bla blah - out " in "" - "'" 'blah'yyyyy'buh' - bla `` b`la - voo "zzzzzzzzzzzzzzzzzzzzzzzzzzzzsd - - - -asdfasdf- - -- - -asdfasdf- - -- - - - - 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: --- 0 ---- *** ../vim-8.0.1157/src/testdir/test_file_size.vim 2017-08-04 22:56:34.641851505 +0200 --- src/testdir/test_file_size.vim 2017-09-28 21:32:41.497778377 +0200 *************** *** 28,30 **** --- 28,58 ---- 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 *** ../vim-8.0.1157/src/testdir/test_lispwords.vim 2015-12-03 16:45:12.000000000 +0100 --- src/testdir/test_lispwords.vim 2017-09-28 21:32:41.497778377 +0200 *************** *** 14,16 **** --- 14,81 ---- 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 "" (html-file ,dest))', + \ ',@body', + \ '(princ "")))' + \ ]) + 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 "" (html-file ,dest))', + \ ' ,@body', + \ ' (princ "")))', + \ '' + \ ], getline(1, "$")) + + enew! + let &cpoptions=save_copt + endfunc *** ../vim-8.0.1157/src/testdir/test_search.vim 2017-07-01 23:11:11.127835714 +0200 --- src/testdir/test_search.vim 2017-09-28 21:32:41.497778377 +0200 *************** *** 356,358 **** --- 356,414 ---- 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' . "\" + call assert_equal([0, 2, 17, 0], getpos('.')) + + put ='2 d dd dee deefff' + exe 'normal! /\Md\*e\{2}f\+/e' . "\" + call assert_equal([0, 3, 17, 0], getpos('.')) + + set nomagic + put ='3 g gg ghh ghhiii' + exe 'normal! /g\*h\{2}i\+/e' . "\" + call assert_equal([0, 4, 17, 0], getpos('.')) + + put ='4 j jj jkk jkklll' + exe 'normal! /\mj*k\{2}l\+/e' . "\" + call assert_equal([0, 5, 17, 0], getpos('.')) + + put ='5 m mm mnn mnnooo' + exe 'normal! /\vm*n{2}o+/e' . "\" + call assert_equal([0, 6, 17, 0], getpos('.')) + + put ='6 x ^aa$ x' + exe 'normal! /\V^aa$' . "\" + call assert_equal([0, 7, 5, 0], getpos('.')) + + set magic + put ='7 (a)(b) abbaa' + exe 'normal! /\v(a)(b)\2\1\1/e' . "\" + call assert_equal([0, 8, 14, 0], getpos('.')) + + put ='8 axx [ab]xx' + exe 'normal! /\V[ab]\(\[xy]\)\1' . "\" + call assert_equal([0, 9, 7, 0], getpos('.')) + + set undolevels=100 + put ='9 foobar' + put ='' + exe "normal! a\u\" + normal G + exe 'normal! dv?bar?' . "\" + 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 *** ../vim-8.0.1157/src/testdir/test_textobjects.vim 2017-06-05 16:37:03.327465111 +0200 --- src/testdir/test_textobjects.vim 2017-09-28 21:36:13.652463428 +0200 *************** *** 52,54 **** --- 52,155 ---- 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 = "-asdfXasdfasdf-" + put =t + normal! fXdit + call assert_equal('-asdfasdf-', getline('.')) + + let t = "-asdXasdfasdf-" + put =t + normal! 0fXdit + call assert_equal('--', getline('.')) + + let t = "-asdfXasdfasdf-" + put =t + normal! fXdat + call assert_equal('-asdfasdf-', getline('.')) + + let t = "-asdXasdfasdf-" + put =t + normal! 0fXdat + call assert_equal('--', getline('.')) + + let t = "-\ninnertext object\n" + put =t + normal! dit + call assert_equal('-', 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 *** ../vim-8.0.1157/src/version.c 2017-09-27 21:46:12.419402953 +0200 --- src/version.c 2017-09-28 21:33:51.753342817 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1158, /**/ -- I noticed my daughter's Disney-net password on a sticky note: "MickeyMinnieGoofyPluto". I asked her why it was so long. "Because they say it has to have at least four characters." /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///