diff options
| -rw-r--r-- | test/functional/legacy/conceal_spec.lua | 146 | ||||
| -rw-r--r-- | test/functional/legacy/matchparen_spec.lua | 73 | ||||
| -rw-r--r-- | test/functional/ui/popupmenu_spec.lua | 197 | ||||
| -rw-r--r-- | test/functional/vimscript/api_functions_spec.lua | 15 | ||||
| -rw-r--r-- | test/functional/vimscript/eval_spec.lua | 21 | ||||
| -rw-r--r-- | test/functional/vimscript/timer_spec.lua | 6 |
6 files changed, 205 insertions, 253 deletions
diff --git a/test/functional/legacy/conceal_spec.lua b/test/functional/legacy/conceal_spec.lua index f4c1983bb7..5bd8944247 100644 --- a/test/functional/legacy/conceal_spec.lua +++ b/test/functional/legacy/conceal_spec.lua @@ -382,11 +382,9 @@ describe('Conceal', function() -- oldtest: Test_conceal_with_cursorcolumn() it('CursorColumn and ColorColumn on wrapped line', function() local screen = Screen.new(40, 10) - screen:set_default_attr_ids({ - [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText - [1] = { background = Screen.colors.Grey90 }, -- CursorColumn - [2] = { background = Screen.colors.LightRed }, -- ColorColumn - }) + screen:add_extra_attr_ids { + [100] = { background = Screen.colors.LightRed }, + } screen:attach() -- Check that cursorcolumn and colorcolumn don't get broken in presence of -- wrapped lines containing concealed text @@ -408,12 +406,12 @@ describe('Conceal', function() -- luacheck: pop screen:expect([[ - one one one one one one {1:o}ne | - {0: >>> }one {2:o}ne one one | + one one one one one one {21:o}ne | + {1: >>> }one {100:o}ne one one | two two two two |hidden| ^here two two | - three three three three {1:t}hree | - {0: >>> }thre{2:e} three three three | - {0:~ }|*4 + three three three three {21:t}hree | + {1: >>> }thre{100:e} three three three | + {1:~ }|*4 /here | ]]) @@ -421,11 +419,11 @@ describe('Conceal', function() feed('$') screen:expect([[ one one one one one one one | - {0: >>> }one {2:o}ne one one | + {1: >>> }one {100:o}ne one one | two two two two |hidden| here two tw^o | three three three three three | - {0: >>> }thre{2:e} three three three | - {0:~ }|*4 + {1: >>> }thre{100:e} three three three | + {1:~ }|*4 /here | ]]) end) @@ -433,11 +431,9 @@ describe('Conceal', function() -- oldtest: Test_conceal_wrapped_cursorline_wincolor() it('CursorLine highlight on wrapped lines', function() local screen = Screen.new(40, 4) - screen:set_default_attr_ids({ - [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText - [1] = { background = Screen.colors.Green }, -- CursorLine (low-priority) - [2] = { foreground = Screen.colors.Red }, -- CursorLine (high-priority) - }) + screen:add_extra_attr_ids { + [100] = { background = Screen.colors.WebGreen }, + } screen:attach() exec([[ call setline(1, 'one one one |hidden| one one one one one one one one') @@ -447,16 +443,16 @@ describe('Conceal', function() hi! CursorLine guibg=Green ]]) screen:expect([[ - {1:one one one one one one one on^e }| - {1: one one one }| - {0:~ }| + {100:one one one one one one one on^e }| + {100: one one one }| + {1:~ }| | ]]) command('hi! CursorLine guibg=NONE guifg=Red') screen:expect([[ - {2:one one one one one one one on^e }| - {2: one one one }| - {0:~ }| + {19:one one one one one one one on^e }| + {19: one one one }| + {1:~ }| | ]]) end) @@ -464,11 +460,9 @@ describe('Conceal', function() -- oldtest: Test_conceal_wrapped_cursorline_wincolor_rightleft() it('CursorLine highlight on wrapped lines with rightleft', function() local screen = Screen.new(40, 4) - screen:set_default_attr_ids({ - [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText - [1] = { background = Screen.colors.Green }, -- CursorLine (low-priority) - [2] = { foreground = Screen.colors.Red }, -- CursorLine (high-priority) - }) + screen:add_extra_attr_ids { + [100] = { background = Screen.colors.WebGreen }, + } screen:attach() exec([[ call setline(1, 'one one one |hidden| one one one one one one one one') @@ -478,16 +472,16 @@ describe('Conceal', function() hi! CursorLine guibg=Green ]]) screen:expect([[ - {1: ^eno eno eno eno eno eno eno eno}| - {1: eno eno eno }| - {0: ~}| + {100: ^eno eno eno eno eno eno eno eno}| + {100: eno eno eno }| + {1: ~}| | ]]) command('hi! CursorLine guibg=NONE guifg=Red') screen:expect([[ - {2: ^eno eno eno eno eno eno eno eno}| - {2: eno eno eno }| - {0: ~}| + {19: ^eno eno eno eno eno eno eno eno}| + {19: eno eno eno }| + {1: ~}| | ]]) end) @@ -625,9 +619,6 @@ describe('Conceal', function() local function test_conceal_virtualedit_after_eol(wrap) local screen = Screen.new(60, 3) - screen:set_default_attr_ids({ - [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText - }) screen:attach() api.nvim_set_option_value('wrap', wrap, {}) exec([[ @@ -638,31 +629,31 @@ describe('Conceal', function() ]]) screen:expect([[ abcdefghijklmnpo^p | - {0:~ }| + {1:~ }| | ]]) feed('l') screen:expect([[ abcdefghijklmnpop^ | - {0:~ }| + {1:~ }| | ]]) feed('l') screen:expect([[ abcdefghijklmnpop ^ | - {0:~ }| + {1:~ }| | ]]) feed('l') screen:expect([[ abcdefghijklmnpop ^ | - {0:~ }| + {1:~ }| | ]]) feed('rr') screen:expect([[ abcdefghijklmnpop ^r | - {0:~ }| + {1:~ }| | ]]) end @@ -679,9 +670,6 @@ describe('Conceal', function() local function test_conceal_virtualedit_after_eol_rightleft(wrap) local screen = Screen.new(60, 3) - screen:set_default_attr_ids({ - [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText - }) screen:attach() api.nvim_set_option_value('wrap', wrap, {}) exec([[ @@ -692,31 +680,31 @@ describe('Conceal', function() ]]) screen:expect([[ ^popnmlkjihgfedcba| - {0: ~}| + {1: ~}| | ]]) feed('h') screen:expect([[ ^ popnmlkjihgfedcba| - {0: ~}| + {1: ~}| | ]]) feed('h') screen:expect([[ ^ popnmlkjihgfedcba| - {0: ~}| + {1: ~}| | ]]) feed('h') screen:expect([[ ^ popnmlkjihgfedcba| - {0: ~}| + {1: ~}| | ]]) feed('rr') screen:expect([[ ^r popnmlkjihgfedcba| - {0: ~}| + {1: ~}| | ]]) end @@ -733,11 +721,9 @@ describe('Conceal', function() local function test_conceal_double_width(wrap) local screen = Screen.new(60, 4) - screen:set_default_attr_ids({ - [0] = { bold = true, foreground = Screen.colors.Blue }, - [1] = { background = Screen.colors.DarkGrey, foreground = Screen.colors.LightGrey }, - [2] = { background = Screen.colors.LightRed }, - }) + screen:add_extra_attr_ids { + [100] = { background = Screen.colors.LightRed }, + } screen:attach() api.nvim_set_option_value('wrap', wrap, {}) exec([[ @@ -747,30 +733,30 @@ describe('Conceal', function() normal! $ ]]) screen:expect([[ - aaaaa{1:β}bbbbb{1:β}cccc^c {2: } | - foobar {2: } | - {0:~ }| + aaaaa{14:β}bbbbb{14:β}cccc^c {100: } | + foobar {100: } | + {1:~ }| | ]]) feed('gM') screen:expect([[ - aaaaa{1:β}bb^bbb{1:β}ccccc {2: } | - foobar {2: } | - {0:~ }| + aaaaa{14:β}bb^bbb{14:β}ccccc {100: } | + foobar {100: } | + {1:~ }| | ]]) command('set conceallevel=3') screen:expect([[ - aaaaabb^bbbccccc {2: } | - foobar {2: } | - {0:~ }| + aaaaabb^bbbccccc {100: } | + foobar {100: } | + {1:~ }| | ]]) feed('$') screen:expect([[ - aaaaabbbbbcccc^c {2: } | - foobar {2: } | - {0:~ }| + aaaaabbbbbcccc^c {100: } | + foobar {100: } | + {1:~ }| | ]]) end @@ -788,11 +774,9 @@ describe('Conceal', function() -- oldtest: Test_conceal_double_width_wrap() it('line wraps correctly when double-width chars are concealed', function() local screen = Screen.new(20, 4) - screen:set_default_attr_ids({ - [0] = { bold = true, foreground = Screen.colors.Blue }, - [1] = { background = Screen.colors.DarkGrey, foreground = Screen.colors.LightGrey }, - [2] = { background = Screen.colors.LightRed }, - }) + screen:add_extra_attr_ids { + [100] = { background = Screen.colors.LightRed }, + } screen:attach() exec([[ call setline(1, 'aaaaaaaaaa口=口bbbbbbbbbb口=口cccccccccc') @@ -801,30 +785,30 @@ describe('Conceal', function() normal! $ ]]) screen:expect([[ - aaaaaaaaaa{1:β}bbbbb | - bbbbb{1:β}ccccccccc^c | - {0:~ }| + aaaaaaaaaa{14:β}bbbbb | + bbbbb{14:β}ccccccccc^c | + {1:~ }| | ]]) feed('gM') screen:expect([[ - aaaaaaaaaa{1:β}bbbbb | - ^bbbbb{1:β}cccccccccc | - {0:~ }| + aaaaaaaaaa{14:β}bbbbb | + ^bbbbb{14:β}cccccccccc | + {1:~ }| | ]]) command('set conceallevel=3') screen:expect([[ aaaaaaaaaabbbbb | ^bbbbbcccccccccc | - {0:~ }| + {1:~ }| | ]]) feed('$') screen:expect([[ aaaaaaaaaabbbbb | bbbbbccccccccc^c | - {0:~ }| + {1:~ }| | ]]) end) diff --git a/test/functional/legacy/matchparen_spec.lua b/test/functional/legacy/matchparen_spec.lua index df0d80f0ab..9adeaf7e3d 100644 --- a/test/functional/legacy/matchparen_spec.lua +++ b/test/functional/legacy/matchparen_spec.lua @@ -34,20 +34,19 @@ describe('matchparen', function() -- oldtest: Test_matchparen_clear_highlight() it('matchparen highlight is cleared when switching buffer', function() local screen = Screen.new(20, 5) - screen:set_default_attr_ids({ - [0] = { bold = true, foreground = Screen.colors.Blue }, - [1] = { background = Screen.colors.Cyan }, - }) + screen:add_extra_attr_ids { + [100] = { background = Screen.colors.Cyan1 }, + } screen:attach() local screen1 = [[ - {1:^()} | - {0:~ }|*3 + {100:^()} | + {1:~ }|*3 | ]] local screen2 = [[ ^aa | - {0:~ }|*3 + {1:~ }|*3 | ]] @@ -77,11 +76,9 @@ describe('matchparen', function() -- oldtest: Test_matchparen_win_execute() it('matchparen highlight when switching buffer in win_execute()', function() local screen = Screen.new(20, 5) - screen:set_default_attr_ids({ - [1] = { background = Screen.colors.Cyan }, - [2] = { reverse = true, bold = true }, - [3] = { reverse = true }, - }) + screen:add_extra_attr_ids { + [100] = { background = Screen.colors.Cyan1 }, + } screen:attach() exec([[ @@ -95,10 +92,10 @@ describe('matchparen', function() endfunc ]]) screen:expect([[ - {1:^{}} | - {2:[No Name] [+] }| - {} | + {100:^{}} | {3:[No Name] [+] }| + {} | + {2:[No Name] [+] }| | ]]) @@ -136,11 +133,9 @@ describe('matchparen', function() -- oldtest: Test_matchparen_mbyte() it("works with multibyte chars in 'matchpairs'", function() local screen = Screen.new(30, 10) - screen:set_default_attr_ids({ - [0] = { bold = true, foreground = Screen.colors.Blue }, - [1] = { background = Screen.colors.Cyan }, - [2] = { bold = true }, - }) + screen:add_extra_attr_ids { + [100] = { background = Screen.colors.Cyan1 }, + } screen:attach() exec([[ @@ -152,57 +147,57 @@ describe('matchparen', function() screen:expect([[ ^aaaaaaaa( | bbbb)cc | - {0:~ }|*7 + {1:~ }|*7 | ]]) feed('$') screen:expect([[ - aaaaaaaa{1:^(} | - bbbb{1:)}cc | - {0:~ }|*7 + aaaaaaaa{100:^(} | + bbbb{100:)}cc | + {1:~ }|*7 | ]]) feed('j') screen:expect([[ aaaaaaaa( | bbbb)c^c | - {0:~ }|*7 + {1:~ }|*7 | ]]) feed('2h') screen:expect([[ - aaaaaaaa{1:(} | - bbbb{1:^)}cc | - {0:~ }|*7 + aaaaaaaa{100:(} | + bbbb{100:^)}cc | + {1:~ }|*7 | ]]) feed('0') screen:expect([[ aaaaaaaa( | ^bbbb)cc | - {0:~ }|*7 + {1:~ }|*7 | ]]) feed('kA') screen:expect([[ - aaaaaaaa{1:(}^ | - bbbb{1:)}cc | - {0:~ }|*7 - {2:-- INSERT --} | + aaaaaaaa{100:(}^ | + bbbb{100:)}cc | + {1:~ }|*7 + {5:-- INSERT --} | ]]) feed('<Down>') screen:expect([[ aaaaaaaa( | bbbb)cc^ | - {0:~ }|*7 - {2:-- INSERT --} | + {1:~ }|*7 + {5:-- INSERT --} | ]]) feed('<C-W>') screen:expect([[ - aaaaaaaa{1:(} | - bbbb{1:)}^ | - {0:~ }|*7 - {2:-- INSERT --} | + aaaaaaaa{100:(} | + bbbb{100:)}^ | + {1:~ }|*7 + {5:-- INSERT --} | ]]) end) end) diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index d096311703..2f7ff80f02 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -21,16 +21,6 @@ describe('ui/ext_popupmenu', function() clear() screen = Screen.new(60, 8) screen:attach({ rgb = true, ext_popupmenu = true }) - screen:set_default_attr_ids({ - [1] = { bold = true, foreground = Screen.colors.Blue }, - [2] = { bold = true }, - [3] = { reverse = true }, - [4] = { bold = true, reverse = true }, - [5] = { bold = true, foreground = Screen.colors.SeaGreen }, - [6] = { background = Screen.colors.WebGray }, - [7] = { background = Screen.colors.LightMagenta }, - [8] = { foreground = Screen.colors.Red }, - }) source([[ function! TestComplete() abort call complete(1, [{'word':'foo', 'abbr':'fo', 'menu':'the foo', 'info':'foo-y', 'kind':'x'}, 'bar', 'spam']) @@ -52,7 +42,7 @@ describe('ui/ext_popupmenu', function() | foo^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]], popupmenu = { items = expected, @@ -67,7 +57,7 @@ describe('ui/ext_popupmenu', function() | ^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]], popupmenu = { items = expected, @@ -83,7 +73,7 @@ describe('ui/ext_popupmenu', function() | ^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]], popupmenu = { items = expected, @@ -98,7 +88,7 @@ describe('ui/ext_popupmenu', function() | bar^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]], } end) @@ -110,7 +100,7 @@ describe('ui/ext_popupmenu', function() | foo^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]], popupmenu = { items = expected, @@ -125,7 +115,7 @@ describe('ui/ext_popupmenu', function() | foo^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]], popupmenu = { items = expected, @@ -140,7 +130,7 @@ describe('ui/ext_popupmenu', function() | spam^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]], popupmenu = { items = expected, @@ -154,7 +144,7 @@ describe('ui/ext_popupmenu', function() | foo^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]]) feed('<c-w><C-r>=TestComplete()<CR>') @@ -163,7 +153,7 @@ describe('ui/ext_popupmenu', function() | foo^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]], popupmenu = { items = expected, @@ -178,7 +168,7 @@ describe('ui/ext_popupmenu', function() | foo^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]], popupmenu = { items = expected, @@ -193,7 +183,7 @@ describe('ui/ext_popupmenu', function() | bar^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]], popupmenu = { items = expected, @@ -208,7 +198,7 @@ describe('ui/ext_popupmenu', function() | ^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]], popupmenu = { items = expected, @@ -223,7 +213,7 @@ describe('ui/ext_popupmenu', function() | foo^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]], popupmenu = { items = expected, @@ -237,7 +227,7 @@ describe('ui/ext_popupmenu', function() | ^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]]) command('set wildmenu') @@ -332,7 +322,7 @@ describe('ui/ext_popupmenu', function() | foo^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]], popupmenu = { items = expected, @@ -347,7 +337,7 @@ describe('ui/ext_popupmenu', function() | spam^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]], popupmenu = { items = expected, @@ -362,7 +352,7 @@ describe('ui/ext_popupmenu', function() | spam^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]], popupmenu = { items = expected, @@ -376,7 +366,7 @@ describe('ui/ext_popupmenu', function() | bar^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]]) feed('<Esc>:sign <Tab>') @@ -440,33 +430,33 @@ describe('ui/ext_popupmenu', function() screen:expect([[ | foo^ | - {6:fo x the foo }{1: }| - {7:bar }{1: }| - {7:spam }{1: }| + {12:fo x the foo }{1: }| + {4:bar }{1: }| + {4:spam }{1: }| {1:~ }|*2 - {2:-- INSERT --} | + {5:-- INSERT --} | ]]) feed('<f1>') screen:expect([[ | spam^ | - {7:fo x the foo }{1: }| - {7:bar }{1: }| - {6:spam }{1: }| + {4:fo x the foo }{1: }| + {4:bar }{1: }| + {12:spam }{1: }| {1:~ }|*2 - {2:-- INSERT --} | + {5:-- INSERT --} | ]]) feed('<f2>') screen:expect([[ | spam^ | - {7:fo x the foo }{1: }| - {7:bar }{1: }| - {7:spam }{1: }| + {4:fo x the foo }{1: }| + {4:bar }{1: }| + {4:spam }{1: }| {1:~ }|*2 - {2:-- INSERT --} | + {5:-- INSERT --} | ]]) feed('<f3>') @@ -474,42 +464,42 @@ describe('ui/ext_popupmenu', function() | bar^ | {1:~ }|*5 - {2:-- INSERT --} | + {5:-- INSERT --} | ]]) feed('<Esc>:sign <Tab>') screen:expect([[ | - bar {6: define } | - {1:~ }{7: jump }{1: }| - {1:~ }{7: list }{1: }| - {1:~ }{7: place }{1: }| - {1:~ }{7: undefine }{1: }| - {1:~ }{7: unplace }{1: }| + bar {12: define } | + {1:~ }{4: jump }{1: }| + {1:~ }{4: list }{1: }| + {1:~ }{4: place }{1: }| + {1:~ }{4: undefine }{1: }| + {1:~ }{4: unplace }{1: }| :sign define^ | ]]) feed('<f1>') screen:expect([[ | - bar {7: define } | - {1:~ }{7: jump }{1: }| - {1:~ }{6: list }{1: }| - {1:~ }{7: place }{1: }| - {1:~ }{7: undefine }{1: }| - {1:~ }{7: unplace }{1: }| + bar {4: define } | + {1:~ }{4: jump }{1: }| + {1:~ }{12: list }{1: }| + {1:~ }{4: place }{1: }| + {1:~ }{4: undefine }{1: }| + {1:~ }{4: unplace }{1: }| :sign list^ | ]]) feed('<f2>') screen:expect([[ | - bar {7: define } | - {1:~ }{7: jump }{1: }| - {1:~ }{7: list }{1: }| - {1:~ }{7: place }{1: }| - {1:~ }{7: undefine }{1: }| - {1:~ }{7: unplace }{1: }| + bar {4: define } | + {1:~ }{4: jump }{1: }| + {1:~ }{4: list }{1: }| + {1:~ }{4: place }{1: }| + {1:~ }{4: undefine }{1: }| + {1:~ }{4: unplace }{1: }| :sign ^ | ]]) @@ -542,33 +532,33 @@ describe('ui/ext_popupmenu', function() screen:expect([[ aa bb cc | aa^ | - {6:aa }{1: }| - {7:bb }{1: }| - {7:cc }{1: }| + {12:aa }{1: }| + {4:bb }{1: }| + {4:cc }{1: }| {1:~ }|*2 - {2:-- Keyword Local completion (^N^P) }{5:match 1 of 3} | + {5:-- Keyword Local completion (^N^P) }{6:match 1 of 3} | ]]) feed('<f1>') screen:expect([[ aa bb cc | cc^ | - {7:aa }{1: }| - {7:bb }{1: }| - {6:cc }{1: }| + {4:aa }{1: }| + {4:bb }{1: }| + {12:cc }{1: }| {1:~ }|*2 - {2:-- Keyword Local completion (^N^P) }{5:match 3 of 3} | + {5:-- Keyword Local completion (^N^P) }{6:match 3 of 3} | ]]) feed('<f2>') screen:expect([[ aa bb cc | cc^ | - {7:aa }{1: }| - {7:bb }{1: }| - {7:cc }{1: }| + {4:aa }{1: }| + {4:bb }{1: }| + {4:cc }{1: }| {1:~ }|*2 - {2:-- Keyword Local completion (^N^P) }{8:Back at original} | + {5:-- Keyword Local completion (^N^P) }{19:Back at original} | ]]) feed('<f3>') @@ -576,7 +566,7 @@ describe('ui/ext_popupmenu', function() aa bb cc | bb^ | {1:~ |