aboutsummaryrefslogtreecommitdiff
path: root/test/functional/autocmd/show_spec.lua
blob: 59757a7d611796f7343a961af73cc63411ff217d (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
local helpers = require('test.functional.helpers')(after_each)

local clear = helpers.clear
local command = helpers.command
local dedent = helpers.dedent
local eq = helpers.eq
local funcs = helpers.funcs

describe(":autocmd", function()
  before_each(clear)

  it("should not segfault when you just do autocmd", function()
    command ":autocmd"
  end)

  it("should filter based on ++once", function()
    command "autocmd! BufEnter"
    command "autocmd BufEnter * :echo 'Hello'"
    command [[augroup TestingOne]]
    command [[  autocmd BufEnter * :echo "Line 1"]]
    command [[  autocmd BufEnter * :echo "Line 2"]]
    command [[augroup END]]

    eq(dedent([[

       --- Autocommands ---
       BufEnter
           *         :echo 'Hello'
       TestingOne  BufEnter
           *         :echo "Line 1"
                     :echo "Line 2"]]),
       funcs.execute('autocmd BufEnter'))

  end)
end)