To: vim_dev@googlegroups.com Subject: Patch 8.1.1412 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1412 Problem: Test 30 is old style. Solution: Turn it into a new style test. (Yegappan Lakshmanan, closes #4440) Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_vms.mms, src/testdir/test30.in, src/testdir/test30.ok, src/testdir/test_fileformat.vim *** ../vim-8.1.1411/src/Makefile 2019-05-25 19:51:03.772408479 +0200 --- src/Makefile 2019-05-27 22:18:04.383027066 +0200 *************** *** 2182,2188 **** test1 \ test_eval \ test3 \ ! test30 test39 \ test42 test44 test48 test49 \ test52 test59 \ test64 test69 \ --- 2183,2189 ---- test1 \ test_eval \ test3 \ ! test39 \ test42 test44 test48 test49 \ test52 test59 \ test64 test69 \ *** ../vim-8.1.1411/src/testdir/Make_all.mak 2019-05-25 19:51:03.780408437 +0200 --- src/testdir/Make_all.mak 2019-05-27 22:18:04.383027066 +0200 *************** *** 42,48 **** # Tests that run on most systems, but not on VMS SCRIPTS_MORE4 = \ - test30.out \ test59.out \ test72.out \ --- 42,47 ---- *** ../vim-8.1.1411/src/testdir/Make_vms.mms 2019-05-19 21:44:03.978804771 +0200 --- src/testdir/Make_vms.mms 2019-05-27 22:18:04.387027046 +0200 *************** *** 74,80 **** .SUFFIXES : .out .in SCRIPT = test1.out test3.out \ ! test30.out test39.out \ test42.out test44.out test48.out test49.out \ test64.out test69.out \ test72.out test77a.out test88.out \ --- 74,80 ---- .SUFFIXES : .out .in SCRIPT = test1.out test3.out \ ! test39.out \ test42.out test44.out test48.out test49.out \ test64.out test69.out \ test72.out test77a.out test88.out \ *************** *** 83,90 **** # Known problems: # - # test30: bug, most probably - a problem around mac format - # # test59: Failed/Hangs - VMS does not support spell files (file names # with too many dots). # --- 83,88 ---- *** ../vim-8.1.1411/src/testdir/test30.in 2017-03-08 22:48:59.000000000 +0100 --- src/testdir/test30.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,238 **** - Test for a lot of variations of the 'fileformats' option - - Note: This test will fail if "cat" is not available. - - STARTTEST - :so small.vim - :set belloff=all - :" first write three test files, one in each format - :set fileformat=unix - :set fileformats= - :/^unix/;/eof/-1w! XXUnix - :/^dos/;/eof/-1w! XXDos - :set bin noeol - :$w! XXMac - Gonoeol - :$w! XXEol - :set nobin eol - :enew! - :bwipe XXUnix XXDos XXMac - :" create mixed format files - :if has("vms") - : !copy XXUnix,XXDos XXUxDs. - : !copy XXUnix,XXMac XXUxMac. - : !copy XXDos,XXMac XXDosMac. - : !copy XXMac,XXEol XXMacEol. - : !copy XXUnix,XXDos,XXMac XXUxDsMc. - :elseif has("win32") - : !copy /b XXUnix+XXDos XXUxDs - : !copy /b XXUnix+XXMac XXUxMac - : !copy /b XXDos+XXMac XXDosMac - : !copy /b XXMac+XXEol XXMacEol - : !copy /b XXUnix+XXDos+XXMac XXUxDsMc - :else - : !cat XXUnix XXDos >XXUxDs - : !cat XXUnix XXMac >XXUxMac - : !cat XXDos XXMac >XXDosMac - : !cat XXMac XXEol >XXMacEol - : !cat XXUnix XXDos XXMac >XXUxDsMc - :endif - :" - :" try reading and writing with 'fileformats' empty - :set fileformat=unix - :e! XXUnix - :w! test.out - :e! XXDos - :w! XXtt01 - :e! XXMac - :w! XXtt02 - :bwipe XXUnix XXDos XXMac - :set fileformat=dos - :e! XXUnix - :w! XXtt11 - :e! XXDos - :w! XXtt12 - :e! XXMac - :w! XXtt13 - :bwipe XXUnix XXDos XXMac - :set fileformat=mac - :e! XXUnix - :w! XXtt21 - :e! XXDos - :w! XXtt22 - :e! XXMac - :w! XXtt23 - :bwipe XXUnix XXDos XXMac - :" - :" try reading and writing with 'fileformats' set to one format - :set fileformats=unix - :e! XXUxDsMc - :w! XXtt31 - :bwipe XXUxDsMc - :set fileformats=dos - :e! XXUxDsMc - :w! XXtt32 - :bwipe XXUxDsMc - :set fileformats=mac - :e! XXUxDsMc - :w! XXtt33 - :bwipe XXUxDsMc - :" - :" try reading and writing with 'fileformats' set to two formats - :set fileformats=unix,dos - :e! XXUxDsMc - :w! XXtt41 - :bwipe XXUxDsMc - :e! XXUxMac - :w! XXtt42 - :bwipe XXUxMac - :e! XXDosMac - :w! XXtt43 - :bwipe XXDosMac - :set fileformats=unix,mac - :e! XXUxDs - :w! XXtt51 - :bwipe XXUxDs - :e! XXUxDsMc - :w! XXtt52 - :bwipe XXUxDsMc - :e! XXDosMac - :w! XXtt53 - :bwipe XXDosMac - :e! XXEol - ggO=&ffs - :=&ff - :w! XXtt54 - :bwipe XXEol - :set fileformats=dos,mac - :e! XXUxDs - :w! XXtt61 - :bwipe XXUxDs - :e! XXUxMac - ggO=&ffs - :=&ff - :w! XXtt62 - :bwipe XXUxMac - :e! XXUxDsMc - :w! XXtt63 - :bwipe XXUxDsMc - :e! XXMacEol - ggO=&ffs - :=&ff - :w! XXtt64 - :bwipe XXMacEol - :" - :" try reading and writing with 'fileformats' set to three formats - :set fileformats=unix,dos,mac - :e! XXUxDsMc - :w! XXtt71 - :bwipe XXUxDsMc - :e! XXEol - ggO=&ffs - :=&ff - :w! XXtt72 - :bwipe XXEol - :set fileformats=mac,dos,unix - :e! XXUxDsMc - :w! XXtt81 - :bwipe XXUxDsMc - :e! XXEol - ggO=&ffs - :=&ff - :w! XXtt82 - :bwipe XXEol - :" try with 'binary' set - :set fileformats=mac,unix,dos - :set binary - :e! XXUxDsMc - :w! XXtt91 - :bwipe XXUxDsMc - :set fileformats=mac - :e! XXUxDsMc - :w! XXtt92 - :bwipe XXUxDsMc - :set fileformats=dos - :e! XXUxDsMc - :w! XXtt93 - :" - :" Append "END" to each file so that we can see what the last written char was. - :set fileformat=unix nobin - ggdGaEND:w >>XXtt01 - :w >>XXtt02 - :w >>XXtt11 - :w >>XXtt12 - :w >>XXtt13 - :w >>XXtt21 - :w >>XXtt22 - :w >>XXtt23 - :w >>XXtt31 - :w >>XXtt32 - :w >>XXtt33 - :w >>XXtt41 - :w >>XXtt42 - :w >>XXtt43 - :w >>XXtt51 - :w >>XXtt52 - :w >>XXtt53 - :w >>XXtt54 - :w >>XXtt61 - :w >>XXtt62 - :w >>XXtt63 - :w >>XXtt64 - :w >>XXtt71 - :w >>XXtt72 - :w >>XXtt81 - :w >>XXtt82 - :w >>XXtt91 - :w >>XXtt92 - :w >>XXtt93 - :" - :" Concatenate the results. - :" Make fileformat of test.out the native fileformat. - :" Add a newline at the end. - :set binary - :e! test.out - :$r XXtt01 - :$r XXtt02 - Go1:$r XXtt11 - :$r XXtt12 - :$r XXtt13 - Go2:$r XXtt21 - :$r XXtt22 - :$r XXtt23 - Go3:$r XXtt31 - :$r XXtt32 - :$r XXtt33 - Go4:$r XXtt41 - :$r XXtt42 - :$r XXtt43 - Go5:$r XXtt51 - :$r XXtt52 - :$r XXtt53 - :$r XXtt54 - Go6:$r XXtt61 - :$r XXtt62 - :$r XXtt63 - :$r XXtt64 - Go7:$r XXtt71 - :$r XXtt72 - Go8:$r XXtt81 - :$r XXtt82 - Go9:$r XXtt91 - :$r XXtt92 - :$r XXtt93 - Go10:$r XXUnix - :set nobinary ff& - :w - :qa! - ENDTEST - - unix - unix - eof - - dos - dos - eof - - mac mac --- 0 ---- *** ../vim-8.1.1411/src/testdir/test30.ok 2016-10-12 17:37:44.000000000 +0200 --- src/testdir/test30.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,130 **** - unix - unix - dos - dos - END - mac mac - END - 1 - unix - unix - END - dos - dos - END - mac mac - END - 2 - unix - unix - END - dos - dos - END - mac mac END - 3 - unix - unix - dos - dos - mac mac - END - unix - unix - dos - dos - mac mac - END - unix - unix - dos - dos - mac mac END - 4 - unix - unix - dos - dos - mac mac - END - unix - unix - mac mac - END - dos - dos - mac mac - END - 5 - unix - unix - dos - dos - END - unix - unix - dos - dos - mac mac - END - dos - dos - mac mac END - unix,mac:unix - noeol - END - 6 - unix - unix - dos - dos - END - dos,mac:dos - unix - unix - mac mac - END - unix - unix - dos - dos - mac mac - END - dos,mac:mac mac mac noeol END - 7 - unix - unix - dos - dos - mac mac - END - unix,dos,mac:unix - noeol - END - 8 - unix - unix - dos - dos - mac mac - END - mac,dos,unix:mac noeol END - 9 - unix - unix - dos - dos - mac mac END - unix - unix - dos - dos - mac mac END - unix - unix - dos - dos - mac mac END - 10 - unix - unix --- 0 ---- *** ../vim-8.1.1411/src/testdir/test_fileformat.vim 2017-01-24 15:36:35.000000000 +0100 --- src/testdir/test_fileformat.vim 2019-05-27 22:18:04.387027046 +0200 *************** *** 1,5 **** - " Test behavior of fileformat after bwipeout of last buffer func Test_fileformat_after_bw() bwipeout set fileformat& --- 1,5 ---- + " Test behavior of fileformat after bwipeout of last buffer func Test_fileformat_after_bw() bwipeout set fileformat& *************** *** 31,33 **** --- 31,278 ---- au! BufReadPre Xfile bw! endfunc + + " Convert the contents of a file into a literal string + func s:file2str(fname) + let b = readfile(a:fname, 'B') + let s = '' + for c in b + let s .= nr2char(c) + endfor + return s + endfunc + + " Concatenate the contents of files 'f1' and 'f2' and create 'destfile' + func s:concat_files(f1, f2, destfile) + let b1 = readfile(a:f1, 'B') + let b2 = readfile(a:f2, 'B') + let b3 = b1 + b2 + call writefile(b3, a:destfile, 'B') + endfun + + " Test for a lot of variations of the 'fileformats' option + func Test_fileformats() + " create three test files, one in each format + call writefile(['unix', 'unix'], 'XXUnix') + call writefile(["dos\r", "dos\r"], 'XXDos') + call writefile(["mac\rmac\r"], 'XXMac', 'b') + " create a file with no End Of Line + call writefile(["noeol"], 'XXEol', 'b') + " create mixed format files + call s:concat_files('XXUnix', 'XXDos', 'XXUxDs') + call s:concat_files('XXUnix', 'XXMac', 'XXUxMac') + call s:concat_files('XXDos', 'XXMac', 'XXDosMac') + call s:concat_files('XXMac', 'XXEol', 'XXMacEol') + call s:concat_files('XXUxDs', 'XXMac', 'XXUxDsMc') + + new + + " Test 1: try reading and writing with 'fileformats' empty + set fileformats= + + " try with 'fileformat' set to 'unix' + set fileformat=unix + e! XXUnix + w! Xtest + call assert_equal("unix\nunix\n", s:file2str('Xtest')) + e! XXDos + w! Xtest + call assert_equal("dos\r\ndos\r\n", s:file2str('Xtest')) + e! XXMac + w! Xtest + call assert_equal("mac\rmac\r\n", s:file2str('Xtest')) + bwipe XXUnix XXDos XXMac + + " try with 'fileformat' set to 'dos' + set fileformat=dos + e! XXUnix + w! Xtest + call assert_equal("unix\r\nunix\r\n", s:file2str('Xtest')) + e! XXDos + w! Xtest + call assert_equal("dos\r\ndos\r\n", s:file2str('Xtest')) + e! XXMac + w! Xtest + call assert_equal("mac\rmac\r\r\n", s:file2str('Xtest')) + bwipe XXUnix XXDos XXMac + + " try with 'fileformat' set to 'mac' + set fileformat=mac + e! XXUnix + w! Xtest + call assert_equal("unix\nunix\n\r", s:file2str('Xtest')) + e! XXDos + w! Xtest + call assert_equal("dos\r\ndos\r\n\r", s:file2str('Xtest')) + e! XXMac + w! Xtest + call assert_equal("mac\rmac\r", s:file2str('Xtest')) + bwipe XXUnix XXDos XXMac + + " Test 2: try reading and writing with 'fileformats' set to one format + + " try with 'fileformats' set to 'unix' + set fileformats=unix + e! XXUxDsMc + w! Xtest + call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r\n", + \ s:file2str('Xtest')) + bwipe XXUxDsMc + + " try with 'fileformats' set to 'dos' + set fileformats=dos + e! XXUxDsMc + w! Xtest + call assert_equal("unix\r\nunix\r\ndos\r\ndos\r\nmac\rmac\r\r\n", + \ s:file2str('Xtest')) + bwipe XXUxDsMc + + " try with 'fileformats' set to 'mac' + set fileformats=mac + e! XXUxDsMc + w! Xtest + call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r", + \ s:file2str('Xtest')) + bwipe XXUxDsMc + + " Test 3: try reading and writing with 'fileformats' set to two formats + + " try with 'fileformats' set to 'unix,dos' + set fileformats=unix,dos + e! XXUxDsMc + w! Xtest + call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r\n", + \ s:file2str('Xtest')) + bwipe XXUxDsMc + + e! XXUxMac + w! Xtest + call assert_equal("unix\nunix\nmac\rmac\r\n", s:file2str('Xtest')) + bwipe XXUxMac + + e! XXDosMac + w! Xtest + call assert_equal("dos\r\ndos\r\nmac\rmac\r\r\n", s:file2str('Xtest')) + bwipe XXDosMac + + " try with 'fileformats' set to 'unix,mac' + set fileformats=unix,mac + e! XXUxDs + w! Xtest + call assert_equal("unix\nunix\ndos\r\ndos\r\n", s:file2str('Xtest')) + bwipe XXUxDs + + e! XXUxDsMc + w! Xtest + call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r\n", + \ s:file2str('Xtest')) + bwipe XXUxDsMc + + e! XXDosMac + w! Xtest + call assert_equal("dos\r\ndos\r\nmac\rmac\r", s:file2str('Xtest')) + bwipe XXDosMac + + e! XXEol + exe "normal ggO\=&ffs\:\=&ff\" + w! Xtest + call assert_equal("unix,mac:unix\nnoeol\n", s:file2str('Xtest')) + bwipe! XXEol + + " try with 'fileformats' set to 'dos,mac' + set fileformats=dos,mac + e! XXUxDs + w! Xtest + call assert_equal("unix\r\nunix\r\ndos\r\ndos\r\n", s:file2str('Xtest')) + bwipe XXUxDs + + e! XXUxMac + exe "normal ggO\=&ffs\:\=&ff\" + w! Xtest + call assert_equal("dos,mac:dos\r\nunix\r\nunix\r\nmac\rmac\r\r\n", + \ s:file2str('Xtest')) + bwipe! XXUxMac + + e! XXUxDsMc + w! Xtest + call assert_equal("unix\r\nunix\r\ndos\r\ndos\r\nmac\rmac\r\r\n", + \ s:file2str('Xtest')) + bwipe XXUxDsMc + + e! XXMacEol + exe "normal ggO\=&ffs\:\=&ff\" + w! Xtest + call assert_equal("dos,mac:mac\rmac\rmac\rnoeol\r", s:file2str('Xtest')) + bwipe! XXMacEol + + " Test 4: try reading and writing with 'fileformats' set to three formats + set fileformats=unix,dos,mac + e! XXUxDsMc + w! Xtest + call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r\n", + \ s:file2str('Xtest')) + bwipe XXUxDsMc + + e! XXEol + exe "normal ggO\=&ffs\:\=&ff\" + w! Xtest + call assert_equal("unix,dos,mac:unix\nnoeol\n", s:file2str('Xtest')) + bwipe! XXEol + + set fileformats=mac,dos,unix + e! XXUxDsMc + w! Xtest + call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r\n", + \ s:file2str('Xtest')) + bwipe XXUxDsMc + + e! XXEol + exe "normal ggO\=&ffs\:\=&ff\" + w! Xtest + call assert_equal("mac,dos,unix:mac\rnoeol\r", s:file2str('Xtest')) + bwipe! XXEol + + " Test 5: try with 'binary' set + set fileformats=mac,unix,dos + set binary + e! XXUxDsMc + w! Xtest + call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r", + \ s:file2str('Xtest')) + bwipe XXUxDsMc + + set fileformats=mac + e! XXUxDsMc + w! Xtest + call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r", + \ s:file2str('Xtest')) + bwipe XXUxDsMc + + set fileformats=dos + e! XXUxDsMc + w! Xtest + call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r", + \ s:file2str('Xtest')) + bwipe XXUxDsMc + + e! XXUnix + w! Xtest + call assert_equal("unix\nunix\n", s:file2str('Xtest')) + bwipe! XXUnix + + set nobinary ff& ffs& + + " cleanup + only + %bwipe! + call delete('XXUnix') + call delete('XXDos') + call delete('XXMac') + call delete('XXEol') + call delete('XXUxDs') + call delete('XXUxMac') + call delete('XXDosMac') + call delete('XXMacEol') + call delete('XXUxDsMc') + call delete('Xtest') + endfunc *** ../vim-8.1.1411/src/version.c 2019-05-27 22:01:36.871920997 +0200 --- src/version.c 2019-05-27 22:19:45.142527742 +0200 *************** *** 769,770 **** --- 769,772 ---- { /* Add new patch number below this line */ + /**/ + 1412, /**/ -- You have the right to remain silent. Anything you say will be misquoted, then used against you. /// 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 ///