2017-01-03 14:10:38 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
|
|
|
|
|
|
|
local eq = helpers.eq
|
|
|
|
local clear = helpers.clear
|
|
|
|
local insert = helpers.insert
|
|
|
|
local feed = helpers.feed
|
|
|
|
local expect = helpers.expect
|
2017-04-08 14:12:26 -07:00
|
|
|
local feed_command = helpers.feed_command
|
2017-01-03 14:10:38 -07:00
|
|
|
local exc_exec = helpers.exc_exec
|
|
|
|
|
|
|
|
describe(':undojoin command', function()
|
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
insert([[
|
|
|
|
Line of text 1
|
|
|
|
Line of text 2]])
|
2017-04-08 14:12:26 -07:00
|
|
|
feed_command('goto 1')
|
2017-01-03 14:10:38 -07:00
|
|
|
end)
|
|
|
|
it('joins changes in a buffer', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
feed_command('undojoin | delete')
|
2017-01-03 14:10:38 -07:00
|
|
|
expect([[
|
|
|
|
Line of text 2]])
|
|
|
|
feed('u')
|
|
|
|
expect([[
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
it('does not corrupt undolist when connected with redo', function()
|
|
|
|
feed('ixx<esc>')
|
2017-04-08 14:12:26 -07:00
|
|
|
feed_command('undojoin | redo')
|
2017-01-03 14:10:38 -07:00
|
|
|
expect([[
|
|
|
|
xxLine of text 1
|
|
|
|
Line of text 2]])
|
|
|
|
end)
|
|
|
|
it('does not raise an error when called twice', function()
|
|
|
|
local ret = exc_exec('undojoin | undojoin')
|
|
|
|
eq(0, ret)
|
|
|
|
end)
|
|
|
|
end)
|