arglist_spec.lua (2009B)
1 -- Test argument list commands 2 3 local t = require('test.testutil') 4 local n = require('test.functional.testnvim')() 5 local Screen = require('test.functional.ui.screen') 6 7 local clear, command, eq = n.clear, n.command, t.eq 8 local expect_exit = n.expect_exit 9 local feed = n.feed 10 local pcall_err = t.pcall_err 11 12 describe('argument list commands', function() 13 before_each(clear) 14 15 it('quitting Vim with unedited files in the argument list throws E173', function() 16 command('set nomore') 17 command('args a b c') 18 eq('Vim(quit):E173: 2 more files to edit', pcall_err(command, 'quit')) 19 end) 20 21 it(':confirm quit with unedited files in arglist', function() 22 local screen = Screen.new(60, 6) 23 command('set nomore') 24 command('args a b c') 25 feed(':confirm quit\n') 26 screen:expect([[ 27 | 28 {1:~ }| 29 {3: }| 30 :confirm quit | 31 {6:2 more files to edit. Quit anyway?} | 32 {6:[Y]es, (N)o: }^ | 33 ]]) 34 feed('N') 35 screen:expect([[ 36 ^ | 37 {1:~ }|*4 38 | 39 ]]) 40 feed(':confirm quit\n') 41 screen:expect([[ 42 | 43 {1:~ }| 44 {3: }| 45 :confirm quit | 46 {6:2 more files to edit. Quit anyway?} | 47 {6:[Y]es, (N)o: }^ | 48 ]]) 49 expect_exit(1000, feed, 'Y') 50 end) 51 end)