diff options
-rw-r--r-- | src/Makefile | 2 | ||||
-rw-r--r-- | src/testdir/Make_all.mak | 1 | ||||
-rw-r--r-- | src/testdir/Make_vms.mms | 4 | ||||
-rw-r--r-- | src/testdir/test30.in | 238 | ||||
-rw-r--r-- | src/testdir/test30.ok | 130 | ||||
-rw-r--r-- | src/testdir/test_fileformat.vim | 247 | ||||
-rw-r--r-- | src/version.c | 2 |
7 files changed, 250 insertions, 374 deletions
diff --git a/src/Makefile b/src/Makefile index d74eac40a..10405c61c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2182,7 +2182,7 @@ test_libvterm: test1 \ test_eval \ test3 \ - test30 test39 \ + test39 \ test42 test44 test48 test49 \ test52 test59 \ test64 test69 \ diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 9de5f1662..ce9955f59 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -42,7 +42,6 @@ SCRIPTS_MORE2 = \ # Tests that run on most systems, but not on VMS SCRIPTS_MORE4 = \ - test30.out \ test59.out \ test72.out \ diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 9a6d2d7e7..09d0692f8 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -74,7 +74,7 @@ VIMPROG = <->vim.exe .SUFFIXES : .out .in SCRIPT = test1.out test3.out \ - test30.out test39.out \ + test39.out \ test42.out test44.out test48.out test49.out \ test64.out test69.out \ test72.out test77a.out test88.out \ @@ -83,8 +83,6 @@ SCRIPT = test1.out test3.out \ # 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). # diff --git a/src/testdir/test30.in b/src/testdir/test30.in deleted file mode 100644 index df494048e..000000000 --- a/src/testdir/test30.in +++ /dev/null @@ -1,238 +0,0 @@ -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
diff --git a/src/testdir/test30.ok b/src/testdir/test30.ok deleted file mode 100644 index b35f4f590..000000000 --- a/src/testdir/test30.ok +++ /dev/null @@ -1,130 +0,0 @@ -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 diff --git a/src/testdir/test_fileformat.vim b/src/testdir/test_fileformat.vim index 8dc25f62b..394c27475 100644 --- a/src/testdir/test_fileformat.vim +++ b/src/testdir/test_fileformat.vim @@ -1,5 +1,5 @@ -" Test behavior of fileformat after bwipeout of last buffer +" Test behavior of fileformat after bwipeout of last buffer func Test_fileformat_after_bw() bwipeout set fileformat& @@ -31,3 +31,248 @@ func Test_fileformat_autocommand() 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\<C-R>=&ffs\<CR>:\<C-R>=&ff\<CR>" + 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\<C-R>=&ffs\<CR>:\<C-R>=&ff\<CR>" + 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\<C-R>=&ffs\<CR>:\<C-R>=&ff\<CR>" + 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\<C-R>=&ffs\<CR>:\<C-R>=&ff\<CR>" + 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\<C-R>=&ffs\<CR>:\<C-R>=&ff\<CR>" + 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 diff --git a/src/version.c b/src/version.c index b0cb4c1de..d5221414f 100644 --- a/src/version.c +++ b/src/version.c @@ -768,6 +768,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1412, +/**/ 1411, /**/ 1410, |