Skip to content

Commit 0a8b941

Browse files
chore: minor edit to table unit test
1 parent 9ba6ff7 commit 0a8b941

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

lua/render-markdown/health.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ local M = {}
55

66
---@private
77
---@type string
8-
M.version = '6.1.12'
8+
M.version = '6.2.0'
99

1010
function M.check()
1111
vim.health.start('render-markdown.nvim [version]')

tests/list_table_spec.lua

+15-10
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,24 @@
33
local util = require('tests.util')
44

55
---@param row integer
6-
---@param text string
6+
---@param sections integer[][]
77
---@return render.md.MarkInfo
8-
local function delimiter(row, text)
8+
local function delimiter(row, sections)
9+
local text = vim.iter(sections)
10+
:map(function(widths)
11+
return vim.iter(widths)
12+
:map(function(width)
13+
return width == 1 and '' or string.rep('', width)
14+
end)
15+
:join('')
16+
end)
17+
:join('')
18+
919
---@type render.md.MarkInfo
1020
return {
1121
row = { row, row },
12-
col = { 0, vim.fn.strdisplaywidth(text) },
13-
virt_text = { { text, util.hl('TableHead') } },
22+
col = { 0, vim.fn.strdisplaywidth(text) + 2 },
23+
virt_text = { { '' .. text .. '', util.hl('TableHead') } },
1424
virt_text_pos = 'overlay',
1525
}
1626
end
@@ -52,12 +62,7 @@ describe('list_table.md', function()
5262
util.table_pipe(row:get(), 33, true),
5363
util.table_pipe(row:get(), 40, true),
5464
})
55-
vim.list_extend(expected, {
56-
delimiter(
57-
row:increment(),
58-
'├━───────┼───────━───────┼──────━┼──────┤'
59-
),
60-
})
65+
table.insert(expected, delimiter(row:increment(), { { 1, 7 }, { 7, 1, 7 }, { 6, 1 }, { 6 } }))
6166
vim.list_extend(expected, {
6267
util.table_pipe(row:increment(), 0, false),
6368
util.inline_code(row:get(), 2, 8),

0 commit comments

Comments
 (0)