aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/argument_count_spec.lua
blob: ece875d235fd7bf71f7832b2acb836e5ecb6127f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
-- Tests for :[count]argument! and :[count]argdelete

local helpers = require('test.functional.helpers')
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect

describe('argument_count', function()
  setup(clear)

  it('is working', function()
    execute('%argd')
    execute('argadd a b c d')
    execute('set hidden')
    execute('let buffers = []')
    execute('augroup TEST')
    execute([[au BufEnter * call add(buffers, expand('%:t'))]])
    execute('augroup END')
    execute('$argu')
    execute('$-argu')
    execute('-argu')
    execute('1argu')
    execute('+2argu')
    execute('augroup TEST')
    execute('au!')
    execute('augroup END')
    execute('let arglists = []')
    execute('.argd')
    execute('call add(arglists, argv())')
    execute('-argd')
    execute('call add(arglists, argv())')
    execute('$argd')
    execute('call add(arglists, argv())')
    execute('1arga c')
    execute('1arga b')
    execute('$argu')
    execute('$arga x')
    execute('call add(arglists, argv())')
    execute('0arga Y')
    execute('call add(arglists, argv())')
    execute('%argd')
    execute('call add(arglists, argv())')
    execute('arga a b c d e f')
    execute('2,$-argd')
    execute('call add(arglists, argv())')
    execute('call append(0, buffers)')
    execute([[let lnr = line('$')]])
    execute([[call append(lnr, map(copy(arglists), 'join(v:val, " ")'))]])
    -- Assert buffer contents.
    expect([=[
      d
      c
      b
      a
      c
      
      a b d
      a d
      a
      a b c x
      Y a b c x
      
      a f]=])
  end)
end)