robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

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