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