Use apply_text_edits to avoid making the unexpected indentation by '<CR>'

This commit is contained in:
hrsh7th
2021-11-05 21:13:47 +09:00
parent 9734453d77
commit e1f880b7e0
3 changed files with 118 additions and 95 deletions

View File

@@ -40,4 +40,30 @@ describe('utils.async', function()
end)
assert.is.truthy(math.abs(vim.loop.now() - now) < 10)
end)
it('step', function()
local done = false
local step = {}
async.step(function(next)
vim.defer_fn(function()
table.insert(step, 1)
next()
end, 10)
end, function(next)
vim.defer_fn(function()
table.insert(step, 2)
next()
end, 10)
end, function(next)
vim.defer_fn(function()
table.insert(step, 3)
next()
end, 10)
end, function()
done = true
end)
vim.wait(1000, function()
return done
end)
assert.are.same(step, { 1, 2, 3 })
end)
end)