fix: remove combined test case files
This commit is contained in:
parent
5f236153cc
commit
66b7db6da4
3 changed files with 6 additions and 26 deletions
|
|
@ -60,11 +60,7 @@ M.defaults = {
|
|||
setup_code = nil,
|
||||
},
|
||||
debug = false,
|
||||
scrapers = vim.iter(constants.PLATFORMS)
|
||||
:map(function(platform)
|
||||
return platform, true
|
||||
end)
|
||||
:totable(),
|
||||
scrapers = constants.PLATFORMS,
|
||||
filename = nil,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ local function setup_problem(contest_id, problem_id, language)
|
|||
|
||||
local ctx = problem.create_context(state.platform, contest_id, problem_id, config, language)
|
||||
|
||||
if config.scrapers[state.platform] then
|
||||
if vim.tbl_contains(config.scrapers, state.platform) then
|
||||
local metadata_result = scrape.scrape_contest_metadata(state.platform, contest_id)
|
||||
if not metadata_result.success then
|
||||
logger.log(
|
||||
|
|
@ -73,7 +73,7 @@ local function setup_problem(contest_id, problem_id, language)
|
|||
state.test_cases = cached_test_cases
|
||||
end
|
||||
|
||||
if config.scrapers[state.platform] then
|
||||
if vim.tbl_contains(config.scrapers, state.platform) then
|
||||
local scrape_result = scrape.scrape_problem(ctx)
|
||||
|
||||
if not scrape_result.success then
|
||||
|
|
@ -567,7 +567,7 @@ function M.handle_command(opts)
|
|||
if cmd.type == "contest_setup" then
|
||||
if set_platform(cmd.platform) then
|
||||
state.contest_id = cmd.contest
|
||||
if config.scrapers[cmd.platform] then
|
||||
if vim.tbl_contains(config.scrapers, cmd.platform) then
|
||||
local metadata_result = scrape.scrape_contest_metadata(cmd.platform, cmd.contest)
|
||||
if not metadata_result.success then
|
||||
logger.log(
|
||||
|
|
@ -590,7 +590,7 @@ function M.handle_command(opts)
|
|||
local problem_ids = {}
|
||||
local has_metadata = false
|
||||
|
||||
if config.scrapers[cmd.platform] then
|
||||
if vim.tbl_contains(config.scrapers, cmd.platform) then
|
||||
local metadata_result = scrape.scrape_contest_metadata(cmd.platform, cmd.contest)
|
||||
if not metadata_result.success then
|
||||
logger.log(
|
||||
|
|
@ -633,7 +633,7 @@ function M.handle_command(opts)
|
|||
|
||||
if cmd.type == "cses_problem" then
|
||||
if set_platform(cmd.platform) then
|
||||
if config.scrapers[cmd.platform] then
|
||||
if vim.tbl_contains(config.scrapers, cmd.platform) then
|
||||
local metadata_result = scrape.scrape_contest_metadata(cmd.platform, "")
|
||||
if not metadata_result.success then
|
||||
logger.log(
|
||||
|
|
|
|||
|
|
@ -273,22 +273,6 @@ function M.scrape_problem(ctx)
|
|||
vim.fn.writefile(vim.split(input_content, "\n", true), input_file)
|
||||
vim.fn.writefile(vim.split(expected_content, "\n", true), expected_file)
|
||||
end
|
||||
|
||||
local combined_input = table.concat(
|
||||
vim.tbl_map(function(tc)
|
||||
return tc.input
|
||||
end, data.tests),
|
||||
"\n"
|
||||
)
|
||||
local combined_output = table.concat(
|
||||
vim.tbl_map(function(tc)
|
||||
return tc.expected
|
||||
end, data.tests),
|
||||
"\n"
|
||||
)
|
||||
|
||||
vim.fn.writefile(vim.split(combined_input, "\n", true), ctx.input_file)
|
||||
vim.fn.writefile(vim.split(combined_output, "\n", true), ctx.expected_file)
|
||||
end
|
||||
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue