test: convert some colorcolumn tests to Lua screen tests

This commit is contained in:
zeertzjq 2022-02-12 06:36:17 +08:00
parent 612696bedc
commit 4ca522fd02

View File

@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local os = require('os')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local command = helpers.command
local command, exec = helpers.command, helpers.exec
local eval, exc_exec = helpers.eval, helpers.exc_exec
local feed_command, eq = helpers.feed_command, helpers.eq
local curbufmeths = helpers.curbufmeths
@ -1172,6 +1172,105 @@ describe('CursorLine highlight', function()
end)
end)
describe('ColorColumn highlight', function()
local screen
before_each(function()
clear()
screen = Screen.new(40, 15)
Screen:set_default_attr_ids({
[1] = {background = Screen.colors.LightRed}, -- ColorColumn
[2] = {background = Screen.colors.Grey90}, -- CursorLine
[3] = {foreground = Screen.colors.Brown}, -- LineNr
[4] = {foreground = Screen.colors.Brown, bold = true}, -- CursorLineNr
[5] = {foreground = Screen.colors.Blue, bold = true}, -- NonText
-- NonText and ColorColumn
[6] = {foreground = Screen.colors.Blue, background = Screen.colors.LightRed, bold = true},
[7] = {reverse = true, bold = true}, -- StatusLine
[8] = {reverse = true}, -- StatusLineNC
})
screen:attach()
end)
it('when entering a buffer vim-patch:8.1.2073', function()
exec([[
set nohidden
split
edit X
call setline(1, ["1111111111","22222222222","3333333333"])
set nomodified
set colorcolumn=3,9
set number cursorline cursorlineopt=number
wincmd w
buf X
]])
screen:expect([[
{4: 1 }11{1:1}11111{1:1}1 |
{3: 2 }22{1:2}22222{1:2}22 |
{3: 3 }33{1:3}33333{1:3}3 |
{5:~ }|
{5:~ }|
{5:~ }|
{8:X }|
{4: 1 }^11{1:1}11111{1:1}1 |
{3: 2 }22{1:2}22222{1:2}22 |
{3: 3 }33{1:3}33333{1:3}3 |
{5:~ }|
{5:~ }|
{5:~ }|
{7:X }|
|
]])
end)
it("in 'breakindent' vim-patch:8.2.1689", function()
exec([[
call setline(1, 'The quick brown fox jumped over the lazy dogs')
set co=40 linebreak bri briopt=shift:2 cc=40,41,43
]])
screen:expect([[
^The quick brown fox jumped over the {1: }|
{1: } {1:l}azy dogs |
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
|
]])
end)
it("in 'showbreak' vim-patch:8.2.1689", function()
exec([[
call setline(1, 'The quick brown fox jumped over the lazy dogs')
set co=40 showbreak=+++>\\ cc=40,41,43
]])
screen:expect([[
^The quick brown fox jumped over the laz{1:y}|
{6:+}{5:+}{6:+}{5:>\} dogs |
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
{5:~ }|
|
]])
end)
end)
describe("MsgSeparator highlight and msgsep fillchar", function()
local screen