aboutsummaryrefslogtreecommitdiff
path: root/test/functional/editor/macro_spec.lua
blob: 102d8fc7234e6a21435ac830fbf3050e44a0773b (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
local helpers = require('test.functional.helpers')(after_each)

local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed
local clear = helpers.clear
local expect = helpers.expect
local command = helpers.command

describe('macros', function()
  before_each(clear)
  it('can be recorded and replayed', function()
    feed('qiahello<esc>q')
    expect('hello')
    eq(eval('@i'), 'ahello')
    feed('@i')
    expect('hellohello')
    eq(eval('@i'), 'ahello')
  end)
  it('applies maps', function()
    command('imap x l')
    command('nmap l a')
    feed('qilxxx<esc>q')
    expect('lll')
    eq(eval('@i'), 'lxxx')
    feed('@i')
    expect('llllll')
    eq(eval('@i'), 'lxxx')
  end)
end)