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