fix(ci): tests & lint

This commit is contained in:
Barrett Ruth 2025-09-20 11:44:25 -04:00
parent ffb5b2b209
commit e780b8ad4e
4 changed files with 7 additions and 9 deletions

View file

@ -48,7 +48,7 @@ function M.parse_ansi_text(text)
return table.concat(parts) return table.concat(parts)
end end
local function apply_highlight(start_line, start_col, end_line, end_col) local function apply_highlight(start_line, start_col, end_col)
local hl_group = get_highlight_group() local hl_group = get_highlight_group()
if hl_group then if hl_group then
table.insert(highlights, { table.insert(highlights, {
@ -73,7 +73,7 @@ function M.parse_ansi_text(text)
for char in segment:gmatch('.') do for char in segment:gmatch('.') do
if char == '\n' then if char == '\n' then
if col_pos > start_col then if col_pos > start_col then
apply_highlight(start_line, start_col, start_line, col_pos) apply_highlight(start_line, start_col, col_pos)
end end
line_num = line_num + 1 line_num = line_num + 1
start_line = line_num start_line = line_num
@ -85,7 +85,7 @@ function M.parse_ansi_text(text)
end end
if col_pos > start_col then if col_pos > start_col then
apply_highlight(start_line, start_col, start_line, col_pos) apply_highlight(start_line, start_col, col_pos)
end end
end end
@ -102,7 +102,7 @@ function M.parse_ansi_text(text)
for char in segment:gmatch('.') do for char in segment:gmatch('.') do
if char == '\n' then if char == '\n' then
if col_pos > start_col then if col_pos > start_col then
apply_highlight(start_line, start_col, start_line, col_pos) apply_highlight(start_line, start_col, col_pos)
end end
line_num = line_num + 1 line_num = line_num + 1
start_line = line_num start_line = line_num
@ -114,7 +114,7 @@ function M.parse_ansi_text(text)
end end
if col_pos > start_col then if col_pos > start_col then
apply_highlight(start_line, start_col, start_line, col_pos) apply_highlight(start_line, start_col, col_pos)
end end
end end
break break

View file

@ -242,7 +242,6 @@ local function toggle_run_panel(is_debug)
vim.api.nvim_buf_clear_namespace(bufnr, test_list_namespace, 0, -1) vim.api.nvim_buf_clear_namespace(bufnr, test_list_namespace, 0, -1)
for _, hl in ipairs(highlights) do for _, hl in ipairs(highlights) do
local logger = require('cp.log')
logger.log( logger.log(
'Applying extmark: buf=' 'Applying extmark: buf='
.. bufnr .. bufnr

View file

@ -372,7 +372,6 @@ end
function M.handle_compilation_failure(compilation_stderr) function M.handle_compilation_failure(compilation_stderr)
local ansi = require('cp.ansi') local ansi = require('cp.ansi')
local logger = require('cp.log')
local clean_text = 'Compilation failed' local clean_text = 'Compilation failed'
local highlights = {} local highlights = {}
@ -405,7 +404,7 @@ function M.handle_compilation_failure(compilation_stderr)
end end
end end
for i, test_case in ipairs(run_panel_state.test_cases) do for _, test_case in ipairs(run_panel_state.test_cases) do
test_case.status = 'fail' test_case.status = 'fail'
test_case.actual = clean_text test_case.actual = clean_text
test_case.actual_highlights = highlights test_case.actual_highlights = highlights

View file

@ -147,7 +147,7 @@ describe('ansi parser', function()
local message_highlight = result.highlights[2] local message_highlight = result.highlights[2]
assert.equals('CpAnsiBold', message_highlight.highlight_group) assert.equals('CpAnsiBold', message_highlight.highlight_group)
assert.equals(22, message_highlight.col_start) assert.equals(22, message_highlight.col_start)
assert.equals(48, message_highlight.col_end) assert.equals(51, message_highlight.col_end)
end) end)
it('handles multiline with persistent state', function() it('handles multiline with persistent state', function()