diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-01-03 02:09:18 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2024-01-03 02:09:29 +0100 |
commit | 04f2f864e270e772c6326cefdf24947f0130e492 (patch) | |
tree | 46f83f909b888a66c741032ab955afc6eab84292 /test/functional/ui/bufhl_spec.lua | |
parent | 59d117ec99b6037cb9fad5bbfb6d0b18f5012927 (diff) | |
download | rneovim-04f2f864e270e772c6326cefdf24947f0130e492.tar.gz rneovim-04f2f864e270e772c6326cefdf24947f0130e492.tar.bz2 rneovim-04f2f864e270e772c6326cefdf24947f0130e492.zip |
refactor: format test/*
Diffstat (limited to 'test/functional/ui/bufhl_spec.lua')
-rw-r--r-- | test/functional/ui/bufhl_spec.lua | 405 |
1 files changed, 246 insertions, 159 deletions
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua index e47ab273bd..220537f58a 100644 --- a/test/functional/ui/bufhl_spec.lua +++ b/test/functional/ui/bufhl_spec.lua @@ -16,26 +16,26 @@ describe('Buffer highlighting', function() screen = Screen.new(40, 8) screen:attach() screen:set_default_attr_ids({ - [1] = {bold=true, foreground=Screen.colors.Blue}, - [2] = {foreground = Screen.colors.Fuchsia}, -- String - [3] = {foreground = Screen.colors.Brown, bold = true}, -- Statement - [4] = {foreground = Screen.colors.SlateBlue}, -- Special - [5] = {bold = true, foreground = Screen.colors.SlateBlue}, - [6] = {foreground = Screen.colors.DarkCyan}, -- Identifier - [7] = {bold = true}, - [8] = {underline = true, bold = true, foreground = Screen.colors.SlateBlue}, - [9] = {foreground = Screen.colors.SlateBlue, underline = true}, - [10] = {foreground = Screen.colors.Red}, - [11] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red}, - [12] = {foreground = Screen.colors.Blue1}, - [13] = {background = Screen.colors.LightGrey}, - [14] = {background = Screen.colors.Gray90}, - [15] = {background = Screen.colors.Gray90, bold = true, foreground = Screen.colors.Brown}, - [16] = {foreground = Screen.colors.Magenta, background = Screen.colors.Gray90}, - [17] = {foreground = Screen.colors.Magenta, background = Screen.colors.LightRed}, - [18] = {background = Screen.colors.LightRed}, - [19] = {foreground = Screen.colors.Blue1, background = Screen.colors.LightRed}, - [20] = {underline = true, bold = true, foreground = Screen.colors.Cyan4}, + [1] = { bold = true, foreground = Screen.colors.Blue }, + [2] = { foreground = Screen.colors.Fuchsia }, -- String + [3] = { foreground = Screen.colors.Brown, bold = true }, -- Statement + [4] = { foreground = Screen.colors.SlateBlue }, -- Special + [5] = { bold = true, foreground = Screen.colors.SlateBlue }, + [6] = { foreground = Screen.colors.DarkCyan }, -- Identifier + [7] = { bold = true }, + [8] = { underline = true, bold = true, foreground = Screen.colors.SlateBlue }, + [9] = { foreground = Screen.colors.SlateBlue, underline = true }, + [10] = { foreground = Screen.colors.Red }, + [11] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red }, + [12] = { foreground = Screen.colors.Blue1 }, + [13] = { background = Screen.colors.LightGrey }, + [14] = { background = Screen.colors.Gray90 }, + [15] = { background = Screen.colors.Gray90, bold = true, foreground = Screen.colors.Brown }, + [16] = { foreground = Screen.colors.Magenta, background = Screen.colors.Gray90 }, + [17] = { foreground = Screen.colors.Magenta, background = Screen.colors.LightRed }, + [18] = { background = Screen.colors.LightRed }, + [19] = { foreground = Screen.colors.Blue1, background = Screen.colors.LightRed }, + [20] = { underline = true, bold = true, foreground = Screen.colors.Cyan4 }, }) end) @@ -55,8 +55,8 @@ describe('Buffer highlighting', function() | ]]) - add_highlight(-1, "String", 0 , 10, 14) - add_highlight(-1, "Statement", 1 , 5, -1) + add_highlight(-1, 'String', 0, 10, 14) + add_highlight(-1, 'Statement', 1, 5, -1) screen:expect([[ these are {2:some} lines | @@ -65,7 +65,7 @@ describe('Buffer highlighting', function() | ]]) - feed("ggo<esc>") + feed('ggo<esc>') screen:expect([[ these are {2:some} lines | ^ | @@ -93,22 +93,22 @@ describe('Buffer highlighting', function() combining highlights from different sources]]) - command("hi ImportantWord gui=bold cterm=bold") - id1 = add_highlight(0, "ImportantWord", 0, 2, 8) - add_highlight(id1, "ImportantWord", 1, 12, -1) - add_highlight(id1, "ImportantWord", 2, 0, 9) - add_highlight(id1, "ImportantWord", 3, 5, 14) + command('hi ImportantWord gui=bold cterm=bold') + id1 = add_highlight(0, 'ImportantWord', 0, 2, 8) + add_highlight(id1, 'ImportantWord', 1, 12, -1) + add_highlight(id1, 'ImportantWord', 2, 0, 9) + add_highlight(id1, 'ImportantWord', 3, 5, 14) -- add_highlight can be called like this to get a new source -- without adding any highlight - id2 = add_highlight(0, "", 0, 0, 0) + id2 = add_highlight(0, '', 0, 0, 0) neq(id1, id2) - add_highlight(id2, "Special", 0, 2, 8) - add_highlight(id2, "Identifier", 1, 3, 8) - add_highlight(id2, "Special", 1, 14, 20) - add_highlight(id2, "Underlined", 2, 6, 12) - add_highlight(id2, "Underlined", 3, 0, 9) + add_highlight(id2, 'Special', 0, 2, 8) + add_highlight(id2, 'Identifier', 1, 3, 8) + add_highlight(id2, 'Special', 1, 14, 20) + add_highlight(id2, 'Underlined', 2, 6, 12) + add_highlight(id2, 'Underlined', 3, 0, 9) screen:expect([[ a {5:longer} example | @@ -185,14 +185,16 @@ describe('Buffer highlighting', function() -- the deleted line wrapping around. we should invalidate -- highlights when they are completely inside deleted text command('3move 4') - screen:expect{grid=[[ + screen:expect { + grid = [[ a {5:longer} example | | {8:from different sources} | {8:^in }{20:order}{8: to demonstrate} | {1:~ }|*3 | - ]]} + ]], + } --screen:expect([[ -- a {5:longer} example | -- | @@ -203,165 +205,196 @@ describe('Buffer highlighting', function() --]]) command('undo') - screen:expect{grid=[[ + screen:expect { + grid = [[ a {5:longer} example | ^ | in {6:order} to {7:de}{5:monstr}{7:ate} | {9:from }{8:diff}{7:erent} sources | {1:~ }|*3 1 change; before #4 {MATCH:.*}| - ]]} + ]], + } command('undo') - screen:expect{grid=[[ + screen:expect { + grid = [[ ^a {5:longer} example | in {6:order} to {7:de}{5:monstr}{7:ate} | {9:from }{8:diff}{7:erent} sources | {1:~ }|*4 1 line less; before #3 {MATCH:.*}| - ]]} + ]], + } command('undo') - screen:expect{grid=[[ + screen:expect { + grid = [[ a {5:longer} example | in {6:order} to {7:de}{5:monstr}{7:ate} | {7:^combin}{8:ing}{9: hi}ghlights | {9:from }{8:diff}{7:erent} sources | {1:~ }|*3 1 more line; before #2 {MATCH:.*}| - ]]} + ]], + } end) it('and moving lines around', function() command('2move 3') - screen:expect{grid=[[ + screen:expect { + grid = [[ a {5:longer} example | {7:combin}{8:ing}{9: hi}ghlights | ^in {6:order} to {7:de}{5:monstr}{7:ate} | {9:from }{8:diff}{7:erent} sources | {1:~ }|*3 | - ]]} + ]], + } command('1,2move 4') - screen:expect{grid=[[ + screen:expect { + grid = [[ in {6:order} to {7:de}{5:monstr}{7:ate} | {9:from }{8:diff}{7:erent} sources | a {5:longer} example | {7:^combin}{8:ing}{9: hi}ghlights | {1:~ }|*3 | - ]]} + ]], + } command('undo') - screen:expect{grid=[[ + screen:expect { + grid = [[ a {5:longer} example | {7:combin}{8:ing}{9: hi}ghlights | ^in {6:order} to {7:de}{5:monstr}{7:ate} | {9:from }{8:diff}{7:erent} sources | {1:~ }|*3 2 changes; before #3 {MATCH:.*}| - ]]} + ]], + } command('undo') - screen:expect{grid=[[ + screen:expect { + grid = [[ a {5:longer} example | ^in {6:order} to {7:de}{5:monstr}{7:ate} | {7:combin}{8:ing}{9: hi}ghlights | {9:from }{8:diff}{7:erent} sources | {1:~ }|*3 1 change; before #2 {MATCH:.*}| - ]]} + ]], + } end) it('and adjusting columns', function() -- insert before feed('ggiquite <esc>') - screen:expect{grid=[[ + screen:expect { + grid = [[ quite^ a {5:longer} example | in {6:order} to {7:de}{5:monstr}{7:ate} | {7:combin}{8:ing}{9: hi}ghlights | {9:from }{8:diff}{7:erent} sources | {1:~ }|*3 | - ]]} + ]], + } feed('u') - screen:expect{grid=[[ + screen:expect { + grid = [[ ^a {5:longer} example | in {6:order} to {7:de}{5:monstr}{7:ate} | {7:combin}{8:ing}{9: hi}ghlights | {9:from }{8:diff}{7:erent} sources | {1:~ }|*3 1 change; before #2 {MATCH:.*}| - ]]} + ]], + } -- change/insert in the middle feed('+fesAAAA') - screen:expect{grid=[[ + screen:expect { + grid = [[ a {5:longer} example | in {6:ordAAAA^r} to {7:de}{5:monstr}{7:ate} | {7:combin}{8:ing}{9: hi}ghlights | {9:from }{8:diff}{7:erent} sources | {1:~ }|*3 {7:-- INSERT --} | - ]]} + ]], + } feed('<esc>tdD') - screen:expect{grid=[[ + screen:expect { + grid = [[ a {5:longer} example | in {6:ordAAAAr} t^o | {7:combin}{8:ing}{9: hi}ghlights | {9:from }{8:diff}{7:erent} sources | {1:~ }|*3 | - ]]} + ]], + } feed('u') - screen:expect{grid=[[ + screen:expect { + grid = [[ a {5:longer} example | in {6:ordAAAAr} to^ {7:de}{5:monstr}{7:ate} | {7:combin}{8:ing}{9: hi}ghlights | {9:from }{8:diff}{7:erent} sources | {1:~ }|*3 1 change; before #4 {MATCH:.*}| - ]]} + ]], + } feed('u') - screen:expect{grid=[[ + screen:expect { + grid = [[ a {5:longer} example | in {6:ord^er} to {7:de}{5:monstr}{7:ate} | {7:combin}{8:ing}{9: hi}ghlights | {9:from }{8:diff}{7:erent} sources | {1:~ }|*3 1 change; before #3 {MATCH:.*}| - ]]} + ]], + } end) it('and joining lines', function() feed('ggJJJ') - screen:expect{grid=[[ + screen:expect { + grid = [[ a {5:longer} example in {6:order} to {7:de}{5:monstr}{7:ate}| {7:combin}{8:ing}{9: hi}ghlights^ {9:from }{8:diff}{7:erent} sou| rces | {1:~ }|*4 | - ]]} + ]], + } feed('uuu') - screen:expect{grid=[[ + screen:expect { + grid = [[ ^a {5:longer} example | in {6:order} to {7:de}{5:monstr}{7:ate} | {7:combin}{8:ing}{9: hi}ghlights | {9:from }{8:diff}{7:erent} sources | {1:~ }|*3 1 more line; before #2 {MATCH:.*}| - ]]} + ]], + } end) it('and splitting lines', function() feed('2Gtti<cr>') - screen:expect{grid=[[ + screen:expect { + grid = [[ a {5:longer} example | in {6:order} | ^ to {7:de}{5:monstr}{7:ate} | @@ -369,10 +402,12 @@ describe('Buffer highlighting', function() {9:from }{8:diff}{7:erent} sources | {1:~ }|*2 {7:-- INSERT --} | - ]]} + ]], + } feed('<esc>tsi<cr>') - screen:expect{grid=[[ + screen:expect { + grid = [[ a {5:longer} example | in {6:order} | to {7:de}{5:mo} | @@ -381,10 +416,12 @@ describe('Buffer highlighting', function() {9:from }{8:diff}{7:erent} sources | {1:~ }| {7:-- INSERT --} | - ]]} + ]], + } feed('<esc>u') - screen:expect{grid=[[ + screen:expect { + grid = [[ a {5:longer} example | in {6:order} | to {7:de}{5:mo^nstr}{7:ate} | @@ -392,26 +429,29 @@ describe('Buffer highlighting', function() {9:from }{8:diff}{7:erent} sources | {1:~ }|*2 1 line less; before #3 {MATCH:.*}| - ]]} + ]], + } feed('<esc>u') - screen:expect{grid=[[ + screen:expect { + grid = [[ a {5:longer} example | in {6:order}^ to {7:de}{5:monstr}{7:ate} | {7:combin}{8:ing}{9: hi}ghlights | {9:from }{8:diff}{7:erent} sources | {1:~ }|*3 1 line less; before #2 {MATCH:.*}| - ]]} + ]], + } end) end) pending('prioritizes latest added highlight', function() insert([[ three overlapping colors]]) - add_highlight(0, "Identifier", 0, 6, 17) - add_highlight(0, "String", 0, 14, 23) - local id = add_highlight(0, "Special", 0, 0, 9) + add_highlight(0, 'Identifier', 0, 6, 17) + add_highlight(0, 'String', 0, 14, 23) + local id = add_highlight(0, 'Special', 0, 0, 9) screen:expect([[ {4:three ove}{6:rlapp}{2:ing color}^s | @@ -430,22 +470,26 @@ describe('Buffer highlighting', function() it('prioritizes earlier highlight groups (TEMP)', function() insert([[ three overlapping colors]]) - add_highlight(0, "Identifier", 0, 6, 17) - add_highlight(0, "String", 0, 14, 23) - local id = add_highlight(0, "Special", 0, 0, 9) + add_highlight(0, 'Identifier', 0, 6, 17) + add_highlight(0, 'String', 0, 14, 23) + local id = add_highlight(0, 'Special', 0, 0, 9) - screen:expect{grid=[[ + screen:expect { + grid = [[ {4:three }{6:overlapp}{2:ing color}^s | {1:~ }|*6 | - ]]} + ]], + } clear_namespace(id, 0, 1) - screen:expect{grid=[[ + screen:expect { + grid = [[ three {6:overlapp}{2:ing color}^s | {1:~ }|*6 | - ]]} + ]], + } end) it('respects priority', function() @@ -456,14 +500,14 @@ describe('Buffer highlighting', function() set_extmark(id, 0, 0, { end_line = 0, end_col = 5, - hl_group = "Statement", - priority = 100 + hl_group = 'Statement', + priority = 100, }) set_extmark(id, 0, 0, { end_line = 0, end_col = 6, - hl_group = "String", - priority = 1 + hl_group = 'String', + priority = 1, }) screen:expect [[ @@ -473,23 +517,25 @@ describe('Buffer highlighting', function() ]] clear_namespace(id, 0, -1) - screen:expect{grid=[[ + screen:expect { + grid = [[ fooba^r | {1:~ }|*6 | - ]]} + ]], + } set_extmark(id, 0, 0, { end_line = 0, end_col = 6, - hl_group = "String", - priority = 1 + hl_group = 'String', + priority = 1, }) set_extmark(id, 0, 0, { end_line = 0, end_col = 5, - hl_group = "Statement", - priority = 100 + hl_group = 'Statement', + priority = 100, }) screen:expect [[ @@ -502,8 +548,8 @@ describe('Buffer highlighting', function() it('works with multibyte text', function() insert([[ Ta båten över sjön!]]) - add_highlight(-1, "Identifier", 0, 3, 9) - add_highlight(-1, "String", 0, 16, 21) + add_highlight(-1, 'Identifier', 0, 3, 9) + add_highlight(-1, 'String', 0, 16, 21) screen:expect([[ Ta {6:båten} över {2:sjön}^! | @@ -515,7 +561,7 @@ describe('Buffer highlighting', function() it('works with new syntax groups', function() insert([[ fancy code in a new fancy language]]) - add_highlight(-1, "FancyLangItem", 0, 0, 5) + add_highlight(-1, 'FancyLangItem', 0, 0, 5) screen:expect([[ fancy code in a new fancy languag^e | {1:~ }|*6 @@ -549,11 +595,14 @@ describe('Buffer highlighting', function() | ]]) - id1 = set_virtual_text(0, 0, {{"=", "Statement"}, {" 3", "Number"}}, {}) - set_virtual_text(id1, 1, {{"ERROR:", "ErrorMsg"}, {" invalid syntax"}}, {}) - id2 = set_virtual_text(0, 2, {{"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."}}, {}) + id1 = set_virtual_text(0, 0, { { '=', 'Statement' }, { ' 3', 'Number' } }, {}) + set_virtual_text(id1, 1, { { 'ERROR:', 'ErrorMsg' }, { ' invalid syntax' } }, {}) + id2 = set_virtual_text(0, 2, { + { + 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', + }, + }, {}) neq(id2, id1) - end) it('works', function() @@ -580,7 +629,15 @@ describe('Buffer highlighting', function() -- Handles doublewidth chars, leaving a space if truncating -- in the middle of a char - eq(-1, set_virtual_text(-1, 1, {{"暗x事zz速野谷質結育副住新覚丸活解終事", "Comment"}}, {})) + eq( + -1, + set_virtual_text( + -1, + 1, + { { '暗x事zz速野谷質結育副住新覚丸活解終事', 'Comment' } }, + {} + ) + ) screen:expect([[ ^1 + 2 | 3 + {12:暗x事zz速野谷質結育副住新覚丸活解終 }| @@ -591,7 +648,7 @@ describe('Buffer highlighting', function() | ]]) - feed("2Gx") + feed('2Gx') screen:expect([[ 1 + 2 | ^ + {12:暗x事zz速野谷質結育副住新覚丸活解終事}| @@ -602,18 +659,20 @@ describe('Buffer highlighting', function() | ]]) - feed("2Gdd") + feed('2Gdd') -- TODO(bfredl): currently decorations get moved from a deleted line -- to the next one. We might want to add "invalidation" when deleting -- over a decoration. - screen:expect{grid=[[ + screen:expect { + grid = [[ 1 + 2 | ^5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5| , 5, 5, 5, 5, 5, 5, {12:暗x事zz速野谷質結育}| x = 4 | {1:~ }|*3 | - ]]} + ]], + } --screen:expect([[ -- 1 + 2 | -- ^5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5| @@ -626,47 +685,67 @@ describe('Buffer highlighting', function() it('validates contents', function() -- this used to leak memory - eq("Invalid 'chunk': expected Array, got String", pcall_err(set_virtual_text, id1, 0, {"texty"}, {})) - eq("Invalid 'chunk': expected Array, got String", pcall_err(set_virtual_text, id1, 0, {{"very"}, "texty"}, {})) + eq( + "Invalid 'chunk': expected Array, got String", + pcall_err(set_virtual_text, id1, 0, { 'texty' }, {}) + ) + eq( + "Invalid 'chunk': expected Array, got String", + pcall_err(set_virtual_text, id1, 0, { { 'very' }, 'texty' }, {}) + ) end) it('can be retrieved', function() local get_extmarks = curbufmeths.get_extmarks local line_count = curbufmeths.line_count - local s1 = {{'Köttbullar', 'Comment'}, {'Kräuterbutter'}} - local s2 = {{'こんにちは', 'Comment'}} + local s1 = { { 'Köttbullar', 'Comment' }, { 'Kräuterbutter' } } + local s2 = { { 'こんにちは', 'Comment' } } set_virtual_text(id1, 0, s1, {}) - eq({{1, 0, 0, { - ns_id = 1, - priority = 0, - virt_text = s1, - -- other details - right_gravity = true, - virt_text_repeat_linebreak = false, - virt_text_pos = 'eol', - virt_text_hide = false, - }}}, get_extmarks(id1, {0,0}, {0, -1}, {details=true})) + eq({ + { + 1, + 0, + 0, + { + ns_id = 1, + priority = 0, + virt_text = s1, + -- other details + right_gravity = true, + virt_text_repeat_linebreak = false, + virt_text_pos = 'eol', + virt_text_hide = false, + }, + }, + }, get_extmarks(id1, { 0, 0 }, { 0, -1 }, { details = true })) local lastline = line_count() set_virtual_text(id1, line_count(), s2, {}) - eq({{3, lastline, 0, { - ns_id = 1, - priority = 0, - virt_text = s2, - -- other details - right_gravity = true, - virt_text_repeat_linebreak = false, - virt_text_pos = 'eol', - virt_text_hide = false, - }}}, get_extmarks(id1, {lastline,0}, {lastline, -1}, {details=true})) - - eq({}, get_extmarks(id1, {lastline+9000,0}, {lastline+9000, -1}, {})) + eq({ + { + 3, + lastline, + 0, + { + ns_id = 1, + priority = 0, + virt_text = s2, + -- other details + right_gravity = true, + virt_text_repeat_linebreak = false, + virt_text_pos = 'eol', + virt_text_hide = false, + }, + }, + }, get_extmarks(id1, { lastline, 0 }, { lastline, -1 }, { details = true })) + + eq({}, get_extmarks(id1, { lastline + 9000, 0 }, { lastline + 9000, -1 }, {})) end) it('is not highlighted by visual selection', function() - feed("ggVG") + feed('ggVG') screen:expect([[ {13:1 + 2} {3:=}{2: 3} | {13:3 +} {11:ERROR:} invalid syntax | @@ -677,7 +756,7 @@ describe('Buffer highlighting', function() {7:-- VISUAL LINE --} | ]]) - feed("<esc>") + feed('<esc>') screen:expect([[ 1 + 2 {3:=}{2: 3} | 3 + {11:ERROR:} invalid syntax | @@ -689,7 +768,7 @@ describe('Buffer highlighting', function() ]]) -- special case: empty line has extra eol highlight - feed("ggd$") + feed('ggd$') screen:expect([[ ^ {3:=}{2: 3} | 3 + {11:ERROR:} invalid syntax | @@ -700,7 +779,7 @@ describe('Buffer highlighting', function() | ]]) - feed("jvk") + feed('jvk') screen:expect([[ ^ {3:=}{2: 3} | {13:3} + {11:ERROR:} invalid syntax | @@ -711,7 +790,7 @@ describe('Buffer highlighting', function() {7:-- VISUAL --} | ]]) - feed("o") + feed('o') screen:expect([[ {13: }{3:=}{2: 3} | ^3 + {11:ERROR:} invalid syntax | @@ -723,9 +802,8 @@ describe('Buffer highlighting', function() ]]) end) - it('works with listchars', function() - command("set list listchars+=eol:$") + command('set list listchars+=eol:$') screen:expect([[ ^1 + 2{1:$}{3:=}{2: 3} | 3 +{1:$}{11:ERROR:} invalid syntax | @@ -749,9 +827,10 @@ describe('Buffer highlighting', function() end) it('works with cursorline', function() - command("set cursorline") + command('set cursorline') - screen:expect{grid=[[ + screen:expect { + grid = [[ {14:^1 + 2 }{3:=}{2: 3}{14: }| 3 + {11:ERROR:} invalid syntax | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5| @@ -759,10 +838,12 @@ describe('Buffer highlighting', function() x = 4 | {1:~ }|*2 | - ]]} + ]], + } feed('j') - screen:expect{grid=[[ + screen:expect { + grid = [[ 1 + 2 {3:=}{2: 3} | {14:^3 + }{11:ERROR:} invalid syntax{14: }| 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5| @@ -770,11 +851,12 @@ describe('Buffer highlighting', function() x = 4 | {1:~ }|*2 | - ]]} - + ]], + } feed('j') - screen:expect{grid=[[ + screen:expect { + grid = [[ 1 + 2 {3:=}{2: 3} | 3 + {11:ERROR:} invalid syntax | {14:^5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}| @@ -782,12 +864,14 @@ describe('Buffer highlighting', function() x = 4 | {1:~ }|*2 | - ]]} + ]], + } end) it('works with color column', function() - eq(-1, set_virtual_text(-1, 3, {{"暗x事", "Comment"}}, {})) - screen:expect{grid=[[ + eq(-1, set_virtual_text(-1, 3, { { '暗x事', 'Comment' } }, {})) + screen:expect { + grid = [[ ^1 + 2 {3:=}{2: 3} | 3 + {11:ERROR:} invalid syntax | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5| @@ -795,10 +879,12 @@ describe('Buffer highlighting', function() x = 4 {12:暗x事} | {1:~ }|*2 | - ]]} + ]], + } - command("set colorcolumn=9") - screen:expect{grid=[[ + command('set colorcolumn=9') + screen:expect { + grid = [[ ^1 + 2 {3:=}{2: 3} | 3 + {11:ERROR:} invalid syntax | 5, 5, 5,{18: }5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5| @@ -806,17 +892,18 @@ describe('Buffer highlighting', function() x = 4 {12:暗x事} | {1:~ }|*2 | - ]]} + ]], + } end) end) it('and virtual text use the same namespace counter', function() local set_virtual_text = curbufmeths.set_virtual_text - eq(1, add_highlight(0, "String", 0 , 0, -1)) - eq(2, set_virtual_text(0, 0, {{"= text", "Comment"}}, {})) - eq(3, meths.create_namespace("my-ns")) - eq(4, add_highlight(0, "String", 0 , 0, -1)) - eq(5, set_virtual_text(0, 0, {{"= text", "Comment"}}, {})) - eq(6, meths.create_namespace("other-ns")) + eq(1, add_highlight(0, 'String', 0, 0, -1)) + eq(2, set_virtual_text(0, 0, { { '= text', 'Comment' } }, {})) + eq(3, meths.create_namespace('my-ns')) + eq(4, add_highlight(0, 'String', 0, 0, -1)) + eq(5, set_virtual_text(0, 0, { { '= text', 'Comment' } }, {})) + eq(6, meths.create_namespace('other-ns')) end) end) |