possibly working

This commit is contained in:
Barrett Ruth 2025-09-23 10:17:22 -04:00
parent 545793df39
commit f9cf5b1614
5 changed files with 20 additions and 75 deletions

View file

@ -87,14 +87,11 @@ end
---@param expected_file string
---@return TestCase[]
local function parse_test_cases_from_files(input_file, expected_file)
if vim.fn.filereadable(input_file) == 0 or vim.fn.filereadable(expected_file) == 0 then
return {}
end
local base_name = vim.fn.fnamemodify(input_file, ':r')
local test_cases = {}
local i = 1
-- Try numbered files first (created by scraper)
local i = 1
while true do
local individual_input_file = base_name .. '.' .. i .. '.cpin'
local individual_expected_file = base_name .. '.' .. i .. '.cpout'
@ -113,12 +110,6 @@ local function parse_test_cases_from_files(input_file, expected_file)
end
end
if #test_cases == 0 then
local input_content = table.concat(vim.fn.readfile(input_file), '\n')
local expected_content = table.concat(vim.fn.readfile(expected_file), '\n')
return { create_test_case(1, input_content, expected_content) }
end
return test_cases
end