view src/testdir/test30.in @ 9058:87c2e43a4a12 v7.4.1814

commit https://github.com/vim/vim/commit/b8d4905592fc26fcd09180d7d6bfefd899f2f6c6 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 1 14:22:16 2016 +0200 patch 7.4.1814 Problem: A channel may be garbage collected while it's still being used by a job. (James McCoy) Solution: Mark the channel as used if the job is still used. Do the same for channels that are still used.
author Christian Brabandt <cb@256bit.org>
date Sun, 01 May 2016 14:30:06 +0200
parents 050e6df85f99
children ae45d497868f
line wrap: on
line source

Test for a lot of variations of the 'fileformats' option

Note: This test will fail if "cat" is not available.

STARTTEST
:so small.vim
:" 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