Fix failing tests
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
local config = require('cmp.config')
|
local config = require('cmp.config')
|
||||||
local async = require('cmp.utils.async')
|
|
||||||
local spec = require('cmp.utils.spec')
|
local spec = require('cmp.utils.spec')
|
||||||
|
|
||||||
local source = require('cmp.source')
|
local source = require('cmp.source')
|
||||||
@@ -86,15 +85,25 @@ describe('source', function()
|
|||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
vim.wait(100, function() return s.status == source.SourceStatus.COMPLETED end, 100, false)
|
vim.wait(100, function()
|
||||||
|
return s.status == source.SourceStatus.COMPLETED
|
||||||
|
end, 100, false)
|
||||||
assert.is.truthy(s:complete(state.input('s'), function() end))
|
assert.is.truthy(s:complete(state.input('s'), function() end))
|
||||||
vim.wait(100, function() return s.status == source.SourceStatus.COMPLETED end, 100, false)
|
vim.wait(100, function()
|
||||||
|
return s.status == source.SourceStatus.COMPLETED
|
||||||
|
end, 100, false)
|
||||||
assert.is.truthy(s:complete(state.input('p'), function() end))
|
assert.is.truthy(s:complete(state.input('p'), function() end))
|
||||||
vim.wait(100, function() return s.status == source.SourceStatus.COMPLETED end, 100, false)
|
vim.wait(100, function()
|
||||||
|
return s.status == source.SourceStatus.COMPLETED
|
||||||
|
end, 100, false)
|
||||||
assert.is.truthy(s:complete(state.input('e'), function() end))
|
assert.is.truthy(s:complete(state.input('e'), function() end))
|
||||||
vim.wait(100, function() return s.status == source.SourceStatus.COMPLETED end, 100, false)
|
vim.wait(100, function()
|
||||||
|
return s.status == source.SourceStatus.COMPLETED
|
||||||
|
end, 100, false)
|
||||||
assert.is.truthy(s:complete(state.input('c'), function() end))
|
assert.is.truthy(s:complete(state.input('c'), function() end))
|
||||||
vim.wait(100, function() return s.status == source.SourceStatus.COMPLETED end, 100, false)
|
vim.wait(100, function()
|
||||||
|
return s.status == source.SourceStatus.COMPLETED
|
||||||
|
end, 100, false)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -51,20 +51,5 @@ async.dedup = function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---Wiat for callback.
|
|
||||||
---@param runner fun(done: function)
|
|
||||||
---@param timeout number
|
|
||||||
---@return any
|
|
||||||
async.sync = function(runner, timeout)
|
|
||||||
local done = false
|
|
||||||
local res = runner(function()
|
|
||||||
done = true
|
|
||||||
end)
|
|
||||||
vim.wait(timeout or 1000, function()
|
|
||||||
return done
|
|
||||||
end, 100, false)
|
|
||||||
return res
|
|
||||||
end
|
|
||||||
|
|
||||||
return async
|
return async
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user