diff options
Diffstat (limited to 'test/functional/legacy/030_fileformats_spec.lua')
-rw-r--r-- | test/functional/legacy/030_fileformats_spec.lua | 343 |
1 files changed, 180 insertions, 163 deletions
diff --git a/test/functional/legacy/030_fileformats_spec.lua b/test/functional/legacy/030_fileformats_spec.lua index 5fd78b2c59..7384fdf847 100644 --- a/test/functional/legacy/030_fileformats_spec.lua +++ b/test/functional/legacy/030_fileformats_spec.lua @@ -1,8 +1,9 @@ -- Test for a lot of variations of the 'fileformats' option local helpers = require('test.functional.helpers')(after_each) -local feed, clear, execute = helpers.feed, helpers.clear, helpers.execute +local feed, clear, command = helpers.feed, helpers.clear, helpers.command local eq, write_file = helpers.eq, helpers.write_file +local wait = helpers.wait if helpers.pending_win32(pending) then return end @@ -45,198 +46,214 @@ describe('fileformats option', function() it('is working', function() -- Try reading and writing with 'fileformats' empty. - execute('set fileformats=') - execute('set fileformat=unix') - execute('e! XXUnix') - execute('w! test.out') - execute('e! XXDos') - execute('w! XXtt01') - execute('e! XXMac') - execute('w! XXtt02') - execute('bwipe XXUnix XXDos XXMac') - execute('set fileformat=dos') - execute('e! XXUnix') - execute('w! XXtt11') - execute('e! XXDos') - execute('w! XXtt12') - execute('e! XXMac') - execute('w! XXtt13') - execute('bwipe XXUnix XXDos XXMac') - execute('set fileformat=mac') - execute('e! XXUnix') - execute('w! XXtt21') - execute('e! XXDos') - execute('w! XXtt22') - execute('e! XXMac') - execute('w! XXtt23') - execute('bwipe XXUnix XXDos XXMac') + command('set fileformats=') + command('set fileformat=unix') + command('e! XXUnix') + command('w! test.out') + command('e! XXDos') + command('w! XXtt01') + command('e! XXMac') + command('w! XXtt02') + command('bwipe XXUnix XXDos XXMac') + command('set fileformat=dos') + command('e! XXUnix') + command('w! XXtt11') + command('e! XXDos') + command('w! XXtt12') + command('e! XXMac') + command('w! XXtt13') + command('bwipe XXUnix XXDos XXMac') + command('set fileformat=mac') + command('e! XXUnix') + command('w! XXtt21') + command('e! XXDos') + command('w! XXtt22') + command('e! XXMac') + command('w! XXtt23') + command('bwipe XXUnix XXDos XXMac') -- Try reading and writing with 'fileformats' set to one format. - execute('set fileformats=unix') - execute('e! XXUxDsMc') - execute('w! XXtt31') - execute('bwipe XXUxDsMc') - execute('set fileformats=dos') - execute('e! XXUxDsMc') - execute('w! XXtt32') - execute('bwipe XXUxDsMc') - execute('set fileformats=mac') - execute('e! XXUxDsMc') - execute('w! XXtt33') - execute('bwipe XXUxDsMc') + command('set fileformats=unix') + command('e! XXUxDsMc') + command('w! XXtt31') + command('bwipe XXUxDsMc') + command('set fileformats=dos') + command('e! XXUxDsMc') + command('w! XXtt32') + command('bwipe XXUxDsMc') + command('set fileformats=mac') + command('e! XXUxDsMc') + command('w! XXtt33') + command('bwipe XXUxDsMc') -- Try reading and writing with 'fileformats' set to two formats. - execute('set fileformats=unix,dos') - execute('e! XXUxDsMc') - execute('w! XXtt41') - execute('bwipe XXUxDsMc') - execute('e! XXUxMac') - execute('w! XXtt42') - execute('bwipe XXUxMac') - execute('e! XXDosMac') - execute('w! XXtt43') - execute('bwipe XXDosMac') - execute('set fileformats=unix,mac') - execute('e! XXUxDs') - execute('w! XXtt51') - execute('bwipe XXUxDs') - execute('e! XXUxDsMc') - execute('w! XXtt52') - execute('bwipe XXUxDsMc') - execute('e! XXDosMac') - execute('w! XXtt53') - execute('bwipe XXDosMac') - execute('e! XXEol') + command('set fileformats=unix,dos') + command('e! XXUxDsMc') + command('w! XXtt41') + command('bwipe XXUxDsMc') + command('e! XXUxMac') + command('w! XXtt42') + command('bwipe XXUxMac') + command('e! XXDosMac') + command('w! XXtt43') + command('bwipe XXDosMac') + command('set fileformats=unix,mac') + command('e! XXUxDs') + command('w! XXtt51') + command('bwipe XXUxDs') + command('e! XXUxDsMc') + command('w! XXtt52') + command('bwipe XXUxDsMc') + command('e! XXDosMac') + command('w! XXtt53') + command('bwipe XXDosMac') + command('e! XXEol') feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>') - execute('w! XXtt54') - execute('bwipe XXEol') - execute('set fileformats=dos,mac') - execute('e! XXUxDs') - execute('w! XXtt61') - execute('bwipe XXUxDs') - execute('e! XXUxMac') + wait() + command('w! XXtt54') + command('bwipeout! XXEol') + command('set fileformats=dos,mac') + command('e! XXUxDs') + command('w! XXtt61') + command('bwipe XXUxDs') + command('e! XXUxMac') feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>') - execute('w! XXtt62') - execute('bwipe XXUxMac') - execute('e! XXUxDsMc') - execute('w! XXtt63') - execute('bwipe XXUxDsMc') - execute('e! XXMacEol') + wait() + command('w! XXtt62') + command('bwipeout! XXUxMac') + command('e! XXUxDsMc') + command('w! XXtt63') + command('bwipe XXUxDsMc') + command('e! XXMacEol') feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>') - execute('w! XXtt64') - execute('bwipe XXMacEol') + wait() + command('w! XXtt64') + command('bwipeout! XXMacEol') -- Try reading and writing with 'fileformats' set to three formats. - execute('set fileformats=unix,dos,mac') - execute('e! XXUxDsMc') - execute('w! XXtt71') - execute('bwipe XXUxDsMc') - execute('e! XXEol') + command('set fileformats=unix,dos,mac') + command('e! XXUxDsMc') + command('w! XXtt71') + command('bwipe XXUxDsMc') + command('e! XXEol') feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>') - execute('w! XXtt72') - execute('bwipe XXEol') - execute('set fileformats=mac,dos,unix') - execute('e! XXUxDsMc') - execute('w! XXtt81') - execute('bwipe XXUxDsMc') - execute('e! XXEol') + wait() + command('w! XXtt72') + command('bwipeout! XXEol') + command('set fileformats=mac,dos,unix') + command('e! XXUxDsMc') + command('w! XXtt81') + command('bwipe XXUxDsMc') + command('e! XXEol') feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>') - execute('w! XXtt82') - execute('bwipe XXEol') + wait() + command('w! XXtt82') + command('bwipeout! XXEol') -- Try with 'binary' set. - execute('set fileformats=mac,unix,dos') - execute('set binary') - execute('e! XXUxDsMc') - execute('w! XXtt91') - execute('bwipe XXUxDsMc') - execute('set fileformats=mac') - execute('e! XXUxDsMc') - execute('w! XXtt92') - execute('bwipe XXUxDsMc') - execute('set fileformats=dos') - execute('e! XXUxDsMc') - execute('w! XXtt93') + command('set fileformats=mac,unix,dos') + command('set binary') + command('e! XXUxDsMc') + command('w! XXtt91') + command('bwipe XXUxDsMc') + command('set fileformats=mac') + command('e! XXUxDsMc') + command('w! XXtt92') + command('bwipe XXUxDsMc') + command('set fileformats=dos') + command('e! XXUxDsMc') + command('w! XXtt93') -- Append "END" to each file so that we can see what the last written -- char was. - execute('set fileformat=unix nobin') + command('set fileformat=unix nobin') feed('ggdGaEND<esc>') - execute('w >>XXtt01') - execute('w >>XXtt02') - execute('w >>XXtt11') - execute('w >>XXtt12') - execute('w >>XXtt13') - execute('w >>XXtt21') - execute('w >>XXtt22') - execute('w >>XXtt23') - execute('w >>XXtt31') - execute('w >>XXtt32') - execute('w >>XXtt33') - execute('w >>XXtt41') - execute('w >>XXtt42') - execute('w >>XXtt43') - execute('w >>XXtt51') - execute('w >>XXtt52') - execute('w >>XXtt53') - execute('w >>XXtt54') - execute('w >>XXtt61') - execute('w >>XXtt62') - execute('w >>XXtt63') - execute('w >>XXtt64') - execute('w >>XXtt71') - execute('w >>XXtt72') - execute('w >>XXtt81') - execute('w >>XXtt82') - execute('w >>XXtt91') - execute('w >>XXtt92') - execute('w >>XXtt93') + wait() + command('w >>XXtt01') + command('w >>XXtt02') + command('w >>XXtt11') + command('w >>XXtt12') + command('w >>XXtt13') + command('w >>XXtt21') + command('w >>XXtt22') + command('w >>XXtt23') + command('w >>XXtt31') + command('w >>XXtt32') + command('w >>XXtt33') + command('w >>XXtt41') + command('w >>XXtt42') + command('w >>XXtt43') + command('w >>XXtt51') + command('w >>XXtt52') + command('w >>XXtt53') + command('w >>XXtt54') + command('w >>XXtt61') + command('w >>XXtt62') + command('w >>XXtt63') + command('w >>XXtt64') + command('w >>XXtt71') + command('w >>XXtt72') + command('w >>XXtt81') + command('w >>XXtt82') + command('w >>XXtt91') + command('w >>XXtt92') + command('w >>XXtt93') -- Concatenate the results. -- Make fileformat of test.out the native fileformat. -- Add a newline at the end. - execute('set binary') - execute('e! test.out') - execute('$r XXtt01') - execute('$r XXtt02') + command('set binary') + command('e! test.out') + command('$r XXtt01') + command('$r XXtt02') feed('Go1<esc>') - execute('$r XXtt11') - execute('$r XXtt12') - execute('$r XXtt13') + wait() + command('$r XXtt11') + command('$r XXtt12') + command('$r XXtt13') feed('Go2<esc>') - execute('$r XXtt21') - execute('$r XXtt22') - execute('$r XXtt23') + wait() + command('$r XXtt21') + command('$r XXtt22') + command('$r XXtt23') feed('Go3<esc>') - execute('$r XXtt31') - execute('$r XXtt32') - execute('$r XXtt33') + wait() + command('$r XXtt31') + command('$r XXtt32') + command('$r XXtt33') feed('Go4<esc>') - execute('$r XXtt41') - execute('$r XXtt42') - execute('$r XXtt43') + wait() + command('$r XXtt41') + command('$r XXtt42') + command('$r XXtt43') feed('Go5<esc>') - execute('$r XXtt51') - execute('$r XXtt52') - execute('$r XXtt53') - execute('$r XXtt54') + wait() + command('$r XXtt51') + command('$r XXtt52') + command('$r XXtt53') + command('$r XXtt54') feed('Go6<esc>') - execute('$r XXtt61') - execute('$r XXtt62') - execute('$r XXtt63') - execute('$r XXtt64') + wait() + command('$r XXtt61') + command('$r XXtt62') + command('$r XXtt63') + command('$r XXtt64') feed('Go7<esc>') - execute('$r XXtt71') - execute('$r XXtt72') + wait() + command('$r XXtt71') + command('$r XXtt72') feed('Go8<esc>') - execute('$r XXtt81') - execute('$r XXtt82') + wait() + command('$r XXtt81') + command('$r XXtt82') feed('Go9<esc>') - execute('$r XXtt91') - execute('$r XXtt92') - execute('$r XXtt93') + wait() + command('$r XXtt91') + command('$r XXtt92') + command('$r XXtt93') feed('Go10<esc>') - execute('$r XXUnix') - execute('set nobinary ff&') + wait() + command('$r XXUnix') + command('set nobinary ff&') -- Assert buffer contents. This has to be done manually as -- helpers.expect() calls helpers.dedent() which messes up the white space |