robin/laufey

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

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

master
931 B38 linesraw
1local n = require('test.functional.testnvim')()
2local t = require('test.testutil')
3
4local describe, it, before_each = t.describe, t.it, t.before_each
5local clear = n.clear
6local insert = n.insert
7local feed = n.feed
8local expect = n.expect
9local feed_command = n.feed_command
10local command = n.command
11
12describe(':undojoin command', function()
13  before_each(function()
14    clear()
15    insert([[
16    Line of text 1
17    Line of text 2]])
18    feed_command('goto 1')
19  end)
20  it('joins changes in a buffer', function()
21    feed_command('undojoin | delete')
22    expect([[
23    Line of text 2]])
24    feed('u')
25    expect([[
26    ]])
27  end)
28  it('does not corrupt undolist when connected with redo', function()
29    feed('ixx<esc>')
30    feed_command('undojoin | redo')
31    expect([[
32    xxLine of text 1
33    Line of text 2]])
34  end)
35  it('does not raise an error when called twice', function()
36    command('undojoin | undojoin')
37  end)
38end)