dotfiles bugabingas dorkfiles
owned by bugabinga
README Source History Refs Compare Notes Search Review guide test(cmdline): add tests for per-format corner highlights 688ab0a31f2820b3f5e6097ff67fb14956b16f0c
Oliver Jan Krylow <oliver@bugabinga.net > · 15 Apr 2026
unsigned
Browse files Compare with HEAD
Test that:
- winhighlight contains different border and corner groups
- corner is CmdlineBorderCornerCmdline for cmdline format
- corner is CmdlineBorderCornerHelp for help format
- corner highlight updates when format changes between show calls
Changed files (1) neovim/tests/bugabinga/cmdline/render_spec.lua Modified 135 135 local anchor
= pos.get_cmdline_anchor()
136 136 assert .is_nil(anchor)
140 + describe(
'render corner highlights' ,
function ()
141 + before_each(
function ()
142 + package .
loaded [
'bugabinga.cmdline.state' ]
= nil 143 + package .
loaded [
'bugabinga.cmdline.format' ]
= nil 144 + package .
loaded [
'bugabinga.cmdline.position' ]
= nil 145 + package .
loaded [
'bugabinga.cmdline.cursor' ]
= nil 146 + package .
loaded [
'bugabinga.cmdline.render' ]
= nil 149 + after_each(
function ()
150 + local ok, render
= pcall (
require ,
'bugabinga.cmdline.render' )
154 + local ok2, pos
= pcall (
require ,
'bugabinga.cmdline.position' )
156 + pos.set_cmdline_anchor(
nil )
160 + it(
'winhighlight contains different border and corner highlights' ,
function ()
161 + local state
= require 'bugabinga.cmdline.state' 162 + local render
= require 'bugabinga.cmdline.render' 163 + local cmdline_state
= state.new({
165 + },
1 ,
':' ,
'' ,
0 ,
1 )
166 + render.show(cmdline_state)
167 + local pos
= require (
'bugabinga.cmdline.position' )
168 + local anchor
= pos.get_cmdline_anchor()
169 + local wh
= vim.wo[anchor.win].winhighlight
170 + local border_hl
= wh:match
'FloatBorder:(%w+)' 171 + local corner_hl
= wh:match
'FloatBorderCorner:(%w+)' 172 + assert .is_not_nil(border_hl,
'FloatBorder highlight not found in: ' .. wh)
173 + assert .is_not_nil(corner_hl,
'FloatBorderCorner highlight not found in: ' .. wh)
174 + assert .is_true(border_hl
~= corner_hl,
'border and corner should differ' )
178 + it(
'corner highlight is CmdlineBorderCornerCmdline for cmdline format' ,
function ()
179 + local state
= require 'bugabinga.cmdline.state' 180 + local render
= require 'bugabinga.cmdline.render' 181 + local cmdline_state
= state.new({
183 + },
1 ,
':' ,
'' ,
0 ,
1 )
184 + render.show(cmdline_state)
185 + local pos
= require (
'bugabinga.cmdline.position' )
186 + local anchor
= pos.get_cmdline_anchor()
187 + local wh
= vim.wo[anchor.win].winhighlight
188 + local corner_hl
= wh:match
'FloatBorderCorner:(%w+)' 189 + assert .equals(
'CmdlineBorderCornerCmdline' , corner_hl)
193 + it(
'corner highlight is CmdlineBorderCornerHelp for help format' ,
function ()
194 + local state
= require 'bugabinga.cmdline.state' 195 + local render
= require 'bugabinga.cmdline.render' 196 + local cmdline_state
= state.new({
198 + },
2 ,
':' ,
'' ,
0 ,
1 )
199 + render.show(cmdline_state)
200 + local pos
= require (
'bugabinga.cmdline.position' )
201 + local anchor
= pos.get_cmdline_anchor()
202 + local wh
= vim.wo[anchor.win].winhighlight
203 + local corner_hl
= wh:match
'FloatBorderCorner:(%w+)' 204 + assert .equals(
'CmdlineBorderCornerHelp' , corner_hl)
208 + it(
'corner highlight updates when format changes between show calls' ,
function ()
209 + local state
= require 'bugabinga.cmdline.state' 210 + local render
= require 'bugabinga.cmdline.render' 211 + local cmdline_state1
= state.new({
213 + },
1 ,
':' ,
'' ,
0 ,
1 )
214 + render.show(cmdline_state1)
215 + local pos
= require (
'bugabinga.cmdline.position' )
216 + local anchor1
= pos.get_cmdline_anchor()
217 + local wh1
= vim.wo[anchor1.win].winhighlight
218 + local corner1
= wh1:match
'FloatBorderCorner:(%w+)' 219 + local cmdline_state2
= state.new({
221 + },
2 ,
':' ,
'' ,
0 ,
1 )
222 + render.show(cmdline_state2)
223 + local anchor2
= pos.get_cmdline_anchor()
224 + local wh2
= vim.wo[anchor2.win].winhighlight
225 + local corner2
= wh2:match
'FloatBorderCorner:(%w+)' 226 + assert .is_true(corner1
~= corner2,
'corner should change: ' .. corner1
.. ' vs ' .. corner2)