fix(ci): remove unused vars
This commit is contained in:
parent
d89b30cbeb
commit
b00f06377f
3 changed files with 18 additions and 30 deletions
|
|
@ -8,7 +8,6 @@ describe('cp.execute', function()
|
||||||
mock_system_calls = {}
|
mock_system_calls = {}
|
||||||
temp_files = {}
|
temp_files = {}
|
||||||
|
|
||||||
local original_system = vim.system
|
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function(cmd, opts)
|
||||||
table.insert(mock_system_calls, { cmd = cmd, opts = opts })
|
table.insert(mock_system_calls, { cmd = cmd, opts = opts })
|
||||||
if not cmd or #cmd == 0 then
|
if not cmd or #cmd == 0 then
|
||||||
|
|
@ -52,7 +51,6 @@ describe('cp.execute', function()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local original_uv = vim.uv
|
|
||||||
vim.uv = vim.tbl_extend('force', vim.uv or {}, {
|
vim.uv = vim.tbl_extend('force', vim.uv or {}, {
|
||||||
hrtime = function()
|
hrtime = function()
|
||||||
return 1000000000
|
return 1000000000
|
||||||
|
|
@ -135,7 +133,7 @@ describe('cp.execute', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('handles compilation errors gracefully', function()
|
it('handles compilation errors gracefully', function()
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function()
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
return { code = 1, stderr = 'error: undefined variable' }
|
return { code = 1, stderr = 'error: undefined variable' }
|
||||||
|
|
@ -218,7 +216,7 @@ describe('cp.execute', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('captures stderr output', function()
|
it('captures stderr output', function()
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function()
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
return { code = 1, stdout = '', stderr = 'runtime error\n' }
|
return { code = 1, stdout = '', stderr = 'runtime error\n' }
|
||||||
|
|
@ -278,17 +276,11 @@ describe('cp.execute', function()
|
||||||
describe('language detection', function()
|
describe('language detection', function()
|
||||||
it('detects cpp from extension', function()
|
it('detects cpp from extension', function()
|
||||||
-- This tests get_language_from_file indirectly
|
-- This tests get_language_from_file indirectly
|
||||||
local contest_config = {
|
|
||||||
default_language = 'python',
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Mock the file extension detection
|
-- Mock the file extension detection
|
||||||
vim.fn.fnamemodify = function(path, modifier)
|
vim.fn.fnamemodify = function()
|
||||||
if modifier == ':e' and path == 'test.cpp' then
|
|
||||||
return 'cpp'
|
return 'cpp'
|
||||||
end
|
end
|
||||||
return ''
|
|
||||||
end
|
|
||||||
|
|
||||||
-- The actual function is local, but we can test it indirectly
|
-- The actual function is local, but we can test it indirectly
|
||||||
-- through functions that use it
|
-- through functions that use it
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ describe('cp integration', function()
|
||||||
}
|
}
|
||||||
|
|
||||||
temp_files['test.run'] = {}
|
temp_files['test.run'] = {}
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function(cmd)
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
return { code = 0, stdout = '3\n', stderr = '' }
|
return { code = 0, stdout = '3\n', stderr = '' }
|
||||||
|
|
@ -200,7 +200,7 @@ describe('cp integration', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('handles scraper communication properly', function()
|
it('handles scraper communication properly', function()
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function(cmd)
|
||||||
if cmd[1] == 'uv' and vim.tbl_contains(cmd, 'metadata') then
|
if cmd[1] == 'uv' and vim.tbl_contains(cmd, 'metadata') then
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
|
|
@ -231,7 +231,7 @@ describe('cp integration', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('processes scraper output correctly', function()
|
it('processes scraper output correctly', function()
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function(cmd)
|
||||||
if vim.tbl_contains(cmd, 'metadata') then
|
if vim.tbl_contains(cmd, 'metadata') then
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
|
|
@ -338,7 +338,7 @@ describe('cp integration', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('recovers from interrupted operations', function()
|
it('recovers from interrupted operations', function()
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function(cmd)
|
||||||
if vim.tbl_contains(cmd, 'metadata') then
|
if vim.tbl_contains(cmd, 'metadata') then
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
|
|
@ -393,7 +393,7 @@ describe('cp integration', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('maintains system stability on errors', function()
|
it('maintains system stability on errors', function()
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function(cmd)
|
||||||
if vim.tbl_contains(cmd, 'metadata') then
|
if vim.tbl_contains(cmd, 'metadata') then
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
|
|
@ -422,7 +422,7 @@ describe('cp integration', function()
|
||||||
table.insert(large_problems, { id = string.char(96 + i % 26), name = 'Problem ' .. i })
|
table.insert(large_problems, { id = string.char(96 + i % 26), name = 'Problem ' .. i })
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function(cmd)
|
||||||
if vim.tbl_contains(cmd, 'metadata') then
|
if vim.tbl_contains(cmd, 'metadata') then
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
|
|
@ -462,7 +462,7 @@ describe('cp integration', function()
|
||||||
|
|
||||||
it('maintains responsiveness during operations', function()
|
it('maintains responsiveness during operations', function()
|
||||||
local call_count = 0
|
local call_count = 0
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function(cmd)
|
||||||
call_count = call_count + 1
|
call_count = call_count + 1
|
||||||
vim.wait(10)
|
vim.wait(10)
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ describe('cp.scrape', function()
|
||||||
|
|
||||||
mock_system_calls = {}
|
mock_system_calls = {}
|
||||||
|
|
||||||
local original_system = vim.system
|
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function(cmd, opts)
|
||||||
table.insert(mock_system_calls, { cmd = cmd, opts = opts })
|
table.insert(mock_system_calls, { cmd = cmd, opts = opts })
|
||||||
|
|
||||||
|
|
@ -26,7 +25,7 @@ describe('cp.scrape', function()
|
||||||
if cmd[1] == 'ping' then
|
if cmd[1] == 'ping' then
|
||||||
result = { code = 0 }
|
result = { code = 0 }
|
||||||
elseif cmd[1] == 'uv' and cmd[2] == 'sync' then
|
elseif cmd[1] == 'uv' and cmd[2] == 'sync' then
|
||||||
result = { code = 0 }
|
result = { code = 0, stdout = '', stderr = '' }
|
||||||
elseif cmd[1] == 'uv' and cmd[2] == 'run' then
|
elseif cmd[1] == 'uv' and cmd[2] == 'run' then
|
||||||
if vim.tbl_contains(cmd, 'metadata') then
|
if vim.tbl_contains(cmd, 'metadata') then
|
||||||
result.stdout = '{"success": true, "problems": [{"id": "a", "name": "Test Problem"}]}'
|
result.stdout = '{"success": true, "problems": [{"id": "a", "name": "Test Problem"}]}'
|
||||||
|
|
@ -124,10 +123,7 @@ describe('cp.scrape', function()
|
||||||
describe('system dependency checks', function()
|
describe('system dependency checks', function()
|
||||||
it('handles missing uv executable', function()
|
it('handles missing uv executable', function()
|
||||||
vim.fn.executable = function(cmd)
|
vim.fn.executable = function(cmd)
|
||||||
if cmd == 'uv' then
|
return cmd == 'uv' and 0 or 1
|
||||||
return 0
|
|
||||||
end
|
|
||||||
return 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local result = scrape.scrape_contest_metadata('atcoder', 'abc123')
|
local result = scrape.scrape_contest_metadata('atcoder', 'abc123')
|
||||||
|
|
@ -137,7 +133,7 @@ describe('cp.scrape', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('handles python environment setup failure', function()
|
it('handles python environment setup failure', function()
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function(cmd)
|
||||||
if cmd[1] == 'ping' then
|
if cmd[1] == 'ping' then
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
|
|
@ -169,7 +165,7 @@ describe('cp.scrape', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('handles network connectivity issues', function()
|
it('handles network connectivity issues', function()
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function(cmd)
|
||||||
if cmd[1] == 'ping' then
|
if cmd[1] == 'ping' then
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
|
|
@ -228,7 +224,7 @@ describe('cp.scrape', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('handles subprocess execution failure', function()
|
it('handles subprocess execution failure', function()
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function(cmd)
|
||||||
if cmd[1] == 'ping' then
|
if cmd[1] == 'ping' then
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
|
|
@ -259,7 +255,7 @@ describe('cp.scrape', function()
|
||||||
|
|
||||||
describe('json parsing', function()
|
describe('json parsing', function()
|
||||||
it('handles invalid json output', function()
|
it('handles invalid json output', function()
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function(cmd)
|
||||||
if cmd[1] == 'ping' then
|
if cmd[1] == 'ping' then
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
|
|
@ -287,7 +283,7 @@ describe('cp.scrape', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('handles scraper-reported failures', function()
|
it('handles scraper-reported failures', function()
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function(cmd)
|
||||||
if cmd[1] == 'ping' then
|
if cmd[1] == 'ping' then
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue