2016-05-14 05:26:03 -05:00
|
|
|
-- Test argument list commands
|
|
|
|
|
2016-04-23 18:53:11 -05:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2022-07-12 00:28:17 -05:00
|
|
|
local Screen = require('test.functional.ui.screen')
|
2017-04-08 16:12:26 -05:00
|
|
|
local clear, command, eq = helpers.clear, helpers.command, helpers.eq
|
2022-07-19 06:36:29 -05:00
|
|
|
local expect_exit = helpers.expect_exit
|
2022-07-12 00:28:17 -05:00
|
|
|
local feed = helpers.feed
|
2022-07-08 04:43:05 -05:00
|
|
|
local pcall_err = helpers.pcall_err
|
2016-05-14 05:26:03 -05:00
|
|
|
|
|
|
|
describe('argument list commands', function()
|
|
|
|
before_each(clear)
|
|
|
|
|
2022-07-08 04:43:05 -05:00
|
|
|
it('quitting Vim with unedited files in the argument list throws E173', function()
|
2022-07-12 01:45:36 -05:00
|
|
|
command('set nomore')
|
2022-07-08 04:43:05 -05:00
|
|
|
command('args a b c')
|
|
|
|
eq('Vim(quit):E173: 2 more files to edit', pcall_err(command, 'quit'))
|
|
|
|
end)
|
2022-07-12 00:28:17 -05:00
|
|
|
|
|
|
|
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([[
|
|
|
|
|
|
2024-03-22 05:02:52 -05:00
|
|
|
{1:~ }|
|
|
|
|
{3: }|
|
2022-07-12 00:28:17 -05:00
|
|
|
:confirm quit |
|
2024-03-22 05:02:52 -05:00
|
|
|
{6:2 more files to edit. Quit anyway?} |
|
|
|
|
{6:[Y]es, (N)o: }^ |
|
2022-07-12 00:28:17 -05:00
|
|
|
]])
|
|
|
|
feed('N')
|
|
|
|
screen:expect([[
|
|
|
|
^ |
|
2024-03-22 05:02:52 -05:00
|
|
|
{1:~ }|*4
|
2022-07-12 00:28:17 -05:00
|
|
|
|
|
|
|
|
]])
|
|
|
|
feed(':confirm quit\n')
|
|
|
|
screen:expect([[
|
|
|
|
|
|
2024-03-22 05:02:52 -05:00
|
|
|
{1:~ }|
|
|
|
|
{3: }|
|
2022-07-12 00:28:17 -05:00
|
|
|
:confirm quit |
|
2024-03-22 05:02:52 -05:00
|
|
|
{6:2 more files to edit. Quit anyway?} |
|
|
|
|
{6:[Y]es, (N)o: }^ |
|
2022-07-12 00:28:17 -05:00
|
|
|
]])
|
2022-08-08 09:04:21 -05:00
|
|
|
expect_exit(1000, feed, 'Y')
|
2022-07-12 00:28:17 -05:00
|
|
|
end)
|
2016-05-14 05:26:03 -05:00
|
|
|
end)
|