From d3414f3b7be72d1adfa2d6c5eef6010b742a7c96 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Thu, 18 Sep 2025 23:42:27 -0400 Subject: [PATCH] fix(ci): fix tests besides pane; --- lua/cp/config.lua | 7 +------ spec/command_parsing_spec.lua | 10 ++++++++-- spec/execute_spec.lua | 5 +++-- spec/health_spec.lua | 7 +++++++ 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/lua/cp/config.lua b/lua/cp/config.lua index 4b7b7bd..8b1a482 100644 --- a/lua/cp/config.lua +++ b/lua/cp/config.lua @@ -126,7 +126,7 @@ function M.setup(user_config) end if user_config.scrapers then - for contest_name, enabled in pairs(user_config.scrapers) do + for _, contest_name in ipairs(user_config.scrapers) do if not vim.tbl_contains(constants.PLATFORMS, contest_name) then error( ("Invalid contest '%s' in scrapers config. Valid contests: %s"):format( @@ -135,11 +135,6 @@ function M.setup(user_config) ) ) end - if type(enabled) ~= 'boolean' then - error( - ("Scraper setting for '%s' must be boolean, got %s"):format(contest_name, type(enabled)) - ) - end end end end diff --git a/spec/command_parsing_spec.lua b/spec/command_parsing_spec.lua index e114297..ddeaca1 100644 --- a/spec/command_parsing_spec.lua +++ b/spec/command_parsing_spec.lua @@ -15,8 +15,14 @@ describe('cp command parsing', function() cp = require('cp') cp.setup({ contests = { - atcoder = { default_language = 'cpp' }, - cses = { default_language = 'cpp' }, + atcoder = { + default_language = 'cpp', + cpp = { extension = 'cpp' }, + }, + cses = { + default_language = 'cpp', + cpp = { extension = 'cpp' }, + }, }, }) end) diff --git a/spec/execute_spec.lua b/spec/execute_spec.lua index 4ae93ba..b647d98 100644 --- a/spec/execute_spec.lua +++ b/spec/execute_spec.lua @@ -195,10 +195,11 @@ describe('cp.execute', function() execute.compile_generic(language_config, { binary_file = './test.run' }) end) - it('handles execution timeouts', function() + it('handles command execution', function() vim.system = function(_, opts) + -- Compilation doesn't set timeout, only text=true if opts then - assert.is_not_nil(opts.timeout) + assert.equals(true, opts.text) end return { wait = function() diff --git a/spec/health_spec.lua b/spec/health_spec.lua index 6962ed2..86f83c7 100644 --- a/spec/health_spec.lua +++ b/spec/health_spec.lua @@ -15,8 +15,15 @@ describe('cp.health', function() isdirectory = function() return 1 end, + fnamemodify = function() + return '/test/path' + end, }) + vim.system = function() + return { wait = function() return { code = 0, stdout = 'test version\n' } end } + end + health = require('cp.health') end)