fix
This commit is contained in:
parent
de14552a3e
commit
5f555a0285
5 changed files with 33 additions and 17 deletions
|
|
@ -98,7 +98,7 @@ function M.setup_problem_async(contest_id, problem_id, language)
|
|||
state.set_test_cases(nil)
|
||||
end
|
||||
|
||||
vim.cmd('silent only')
|
||||
vim.cmd.only({ mods = { silent = true } })
|
||||
state.set_run_panel_active(false)
|
||||
state.set_contest_id(contest_id)
|
||||
state.set_problem_id(problem_id)
|
||||
|
|
|
|||
|
|
@ -75,11 +75,12 @@ describe('async integration', function()
|
|||
end,
|
||||
}
|
||||
|
||||
vim.cmd = function() end
|
||||
vim.cmd.e = function() end
|
||||
vim.cmd.only = function() end
|
||||
vim.cmd.startinsert = function() end
|
||||
vim.cmd.stopinsert = function() end
|
||||
vim.cmd = {
|
||||
e = function() end,
|
||||
only = function() end,
|
||||
startinsert = function() end,
|
||||
stopinsert = function() end,
|
||||
}
|
||||
vim.api.nvim_get_current_buf = function()
|
||||
return 1
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ describe('cp.async.scraper', function()
|
|||
end,
|
||||
}
|
||||
|
||||
vim.system = function(cmd, _, callback)
|
||||
vim.system = function(cmd, opts, callback)
|
||||
local result = { code = 0, stdout = '{}', stderr = '' }
|
||||
if cmd[1] == 'ping' then
|
||||
result = { code = 0 }
|
||||
|
|
@ -36,7 +36,17 @@ describe('cp.async.scraper', function()
|
|||
result.stdout =
|
||||
'{"success": true, "tests": [{"input": "1 2", "expected": "3"}], "timeout_ms": 2000, "memory_mb": 256.0, "url": "https://example.com"}'
|
||||
end
|
||||
callback(result)
|
||||
|
||||
if callback then
|
||||
callback(result)
|
||||
else
|
||||
-- Return object with :wait() for sync calls
|
||||
return {
|
||||
wait = function()
|
||||
return result
|
||||
end,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
vim.fn.mkdir = function() end
|
||||
|
|
|
|||
|
|
@ -69,11 +69,12 @@ describe('cp.async.setup', function()
|
|||
end,
|
||||
}
|
||||
|
||||
vim.cmd = function() end
|
||||
vim.cmd.e = function() end
|
||||
vim.cmd.only = function() end
|
||||
vim.cmd.startinsert = function() end
|
||||
vim.cmd.stopinsert = function() end
|
||||
vim.cmd = {
|
||||
e = function() end,
|
||||
only = function() end,
|
||||
startinsert = function() end,
|
||||
stopinsert = function() end,
|
||||
}
|
||||
vim.api.nvim_get_current_buf = function()
|
||||
return 1
|
||||
end
|
||||
|
|
|
|||
|
|
@ -35,10 +35,14 @@ local function setup_vim_mocks()
|
|||
if not vim.cmd then
|
||||
vim.cmd = {}
|
||||
end
|
||||
vim.cmd.e = function() end
|
||||
vim.cmd.only = function() end
|
||||
vim.cmd.split = function() end
|
||||
vim.cmd.vsplit = function() end
|
||||
vim.cmd = {
|
||||
only = function() end,
|
||||
e = function() end,
|
||||
split = function() end,
|
||||
vsplit = function() end,
|
||||
startinsert = function() end,
|
||||
stopinsert = function() end,
|
||||
}
|
||||
if not vim.system then
|
||||
vim.system = function(_)
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue