2016-05-14 05:26:03 -05:00
|
|
|
-- Test argument list commands
|
|
|
|
|
2024-04-20 10:44:13 -05:00
|
|
|
local t = require('test.testutil')
|
|
|
|
local n = require('test.functional.testnvim')()
|
2022-07-12 00:28:17 -05:00
|
|
|
local Screen = require('test.functional.ui.screen')
|
2024-04-20 10:44:13 -05:00
|
|
|
|
|
|
|
local clear, command, eq = n.clear, n.command, t.eq
|
|
|
|
local expect_exit = n.expect_exit
|
|
|
|
local feed = n.feed
|
2024-04-08 04:03:20 -05:00
|
|
|
local pcall_err = t.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)
|
|
|
|
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)
|