Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
157 lines
3.1 KiB
Lua
157 lines
3.1 KiB
Lua
local builtin = require "telescope.builtin"
|
|
|
|
local DELAY = vim.g.telescope_test_delay or 50
|
|
local runner = {}
|
|
|
|
-- State is test variable
|
|
runner.state = {
|
|
done = false,
|
|
results = {},
|
|
msgs = {},
|
|
}
|
|
|
|
local writer = function(val)
|
|
table.insert(runner.state.results, val)
|
|
end
|
|
|
|
local invalid_test_case = function(k)
|
|
error { case = k, expected = "<a valid key>", actual = k }
|
|
end
|
|
|
|
local _VALID_KEYS = {
|
|
post_typed = true,
|
|
post_close = true,
|
|
}
|
|
|
|
local replace_terms = function(input)
|
|
return vim.api.nvim_replace_termcodes(input, true, false, true)
|
|
end
|
|
|
|
runner.nvim_feed = function(text, feed_opts)
|
|
feed_opts = feed_opts or "m"
|
|
|
|
vim.api.nvim_feedkeys(text, feed_opts, true)
|
|
end
|
|
|
|
local end_test_cases = function()
|
|
runner.state.done = true
|
|
end
|
|
|
|
local execute_test_case = function(location, key, spec)
|
|
local ok, actual = pcall(spec[2])
|
|
|
|
if not ok then
|
|
writer {
|
|
location = "Error: " .. location,
|
|
case = key,
|
|
expected = "To succeed and return: " .. tostring(spec[1]),
|
|
actual = actual,
|
|
|
|
_type = spec._type,
|
|
}
|
|
|
|
end_test_cases()
|
|
else
|
|
writer {
|
|
location = location,
|
|
case = key,
|
|
expected = spec[1],
|
|
actual = actual,
|
|
|
|
_type = spec._type,
|
|
}
|
|
end
|
|
|
|
return ok
|
|
end
|
|
|
|
runner.log = function(msg)
|
|
table.insert(runner.state.msgs, msg)
|
|
end
|
|
|
|
runner.picker = function(picker_name, input, test_cases, opts)
|
|
opts = opts or {}
|
|
|
|
for k, _ in pairs(test_cases) do
|
|
if not _VALID_KEYS[k] then
|
|
return invalid_test_case(k)
|
|
end
|
|
end
|
|
|
|
opts.on_complete = {
|
|
runner.create_on_complete(input, test_cases),
|
|
}
|
|
|
|
opts._on_error = function(self, msg)
|
|
runner.state.done = true
|
|
writer {
|
|
location = "Error while running on complete",
|
|
expected = "To Work",
|
|
actual = msg,
|
|
}
|
|
end
|
|
|
|
runner.log "Starting picker"
|
|
builtin[picker_name](opts)
|
|
runner.log "Called picker"
|
|
end
|
|
|
|
runner.create_on_complete = function(input, test_cases)
|
|
input = replace_terms(input)
|
|
|
|
local actions = {}
|
|
for i = 1, #input do
|
|
local char = input:sub(i, i)
|
|
table.insert(actions, {
|
|
cb = function()
|
|
runner.log("Inserting char: " .. char)
|
|
runner.nvim_feed(char, "")
|
|
end,
|
|
char = char,
|
|
})
|
|
end
|
|
|
|
return function()
|
|
local action
|
|
|
|
repeat
|
|
action = table.remove(actions, 1)
|
|
if action then
|
|
action.cb()
|
|
end
|
|
until not action or string.match(action.char, "%g")
|
|
|
|
if #actions > 0 then
|
|
return
|
|
end
|
|
|
|
vim.defer_fn(function()
|
|
if test_cases.post_typed then
|
|
for k, v in ipairs(test_cases.post_typed) do
|
|
if not execute_test_case("post_typed", k, v) then
|
|
return
|
|
end
|
|
end
|
|
end
|
|
|
|
vim.defer_fn(function()
|
|
runner.nvim_feed(replace_terms "<CR>", "")
|
|
|
|
vim.defer_fn(function()
|
|
if test_cases.post_close then
|
|
for k, v in ipairs(test_cases.post_close) do
|
|
if not execute_test_case("post_close", k, v) then
|
|
return
|
|
end
|
|
end
|
|
end
|
|
|
|
vim.defer_fn(end_test_cases, DELAY)
|
|
end, DELAY)
|
|
end, DELAY)
|
|
end, DELAY)
|
|
end
|
|
end
|
|
|
|
return runner
|