diff options
Diffstat (limited to 'test/functional/legacy/arglist_spec.lua')
-rw-r--r-- | test/functional/legacy/arglist_spec.lua | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/test/functional/legacy/arglist_spec.lua b/test/functional/legacy/arglist_spec.lua index 6a2e86ccb4..8379e426e0 100644 --- a/test/functional/legacy/arglist_spec.lua +++ b/test/functional/legacy/arglist_spec.lua @@ -1,8 +1,11 @@ -- Test argument list commands local helpers = require('test.functional.helpers')(after_each) +local Screen = require('test.functional.ui.screen') local clear, command, eq = helpers.clear, helpers.command, helpers.eq local eval, exc_exec, neq = helpers.eval, helpers.exc_exec, helpers.neq +local feed = helpers.feed +local pcall_err = helpers.pcall_err describe('argument list commands', function() before_each(clear) @@ -17,7 +20,7 @@ describe('argument list commands', function() end local function assert_fails(cmd, err) - neq(exc_exec(cmd):find(err), nil) + neq(nil, exc_exec(cmd):find(err)) end it('test that argidx() works', function() @@ -206,7 +209,6 @@ describe('argument list commands', function() command('%argd') end) - it('test for autocommand that redefines the argument list, when doing ":all"', function() command('autocmd BufReadPost Xxx2 next Xxx2 Xxx1') command("call writefile(['test file Xxx1'], 'Xxx1')") @@ -234,4 +236,45 @@ describe('argument list commands', function() command('argdelete Xxx*') command('bwipe! Xxx1 Xxx2 Xxx3') end) + + it('quitting Vim with unedited files in the argument list throws E173', function() + command('set nomore') + command('args a b c') + eq('Vim(quit):E173: 2 more files to edit', pcall_err(command, 'quit')) + end) + + it(':confirm quit with unedited files in arglist', function() + local screen = Screen.new(60, 6) + screen:attach() + command('set nomore') + command('args a b c') + feed(':confirm quit\n') + screen:expect([[ + | + ~ | + | + :confirm quit | + 2 more files to edit. Quit anyway? | + [Y]es, (N)o: ^ | + ]]) + feed('N') + screen:expect([[ + ^ | + ~ | + ~ | + ~ | + ~ | + | + ]]) + feed(':confirm quit\n') + screen:expect([[ + | + ~ | + | + :confirm quit | + 2 more files to edit. Quit anyway? | + [Y]es, (N)o: ^ | + ]]) + feed('Y') + end) end) |