diff options
Diffstat (limited to 'test/functional/ui')
-rw-r--r-- | test/functional/ui/bufhl_spec.lua | 19 | ||||
-rw-r--r-- | test/functional/ui/highlight_spec.lua | 138 | ||||
-rw-r--r-- | test/functional/ui/inccommand_spec.lua | 130 | ||||
-rw-r--r-- | test/functional/ui/input_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/ui/mouse_spec.lua | 72 | ||||
-rw-r--r-- | test/functional/ui/quickfix_spec.lua | 52 | ||||
-rw-r--r-- | test/functional/ui/screen_basic_spec.lua | 52 | ||||
-rw-r--r-- | test/functional/ui/searchhl_spec.lua | 34 | ||||
-rw-r--r-- | test/functional/ui/sign_spec.lua | 14 | ||||
-rw-r--r-- | test/functional/ui/syntax_conceal_spec.lua | 70 | ||||
-rw-r--r-- | test/functional/ui/wildmode_spec.lua | 14 |
11 files changed, 304 insertions, 297 deletions
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua index 53fe303762..e1e11203e0 100644 --- a/test/functional/ui/bufhl_spec.lua +++ b/test/functional/ui/bufhl_spec.lua @@ -1,7 +1,8 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') + local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local execute, request, neq = helpers.execute, helpers.request, helpers.neq +local command, request, neq = helpers.command, helpers.request, helpers.neq if helpers.pending_win32(pending) then return end @@ -11,7 +12,7 @@ describe('Buffer highlighting', function() before_each(function() clear() - execute("syntax on") + command('syntax on') screen = Screen.new(40, 8) screen:attach() screen:set_default_attr_ids({ @@ -106,7 +107,7 @@ describe('Buffer highlighting', function() combining highlights from different sources]]) - execute("hi ImportantWord gui=bold cterm=bold") + command("hi ImportantWord gui=bold cterm=bold") id1 = add_hl(0, "ImportantWord", 0, 2, 8) add_hl(id1, "ImportantWord", 1, 12, -1) add_hl(id1, "ImportantWord", 2, 0, 9) @@ -131,7 +132,7 @@ describe('Buffer highlighting', function() {1:~ }| {1:~ }| {1:~ }| - :hi ImportantWord gui=bold cterm=bold | + | ]]) end) @@ -145,7 +146,7 @@ describe('Buffer highlighting', function() {1:~ }| {1:~ }| {1:~ }| - :hi ImportantWord gui=bold cterm=bold | + | ]]) end) @@ -159,7 +160,7 @@ describe('Buffer highlighting', function() {1:~ }| {1:~ }| {1:~ }| - :hi ImportantWord gui=bold cterm=bold | + | ]]) end) @@ -175,7 +176,7 @@ describe('Buffer highlighting', function() {1:~ }| {1:~ }| {1:~ }| - :hi ImportantWord gui=bold cterm=bold | + | ]]) end) @@ -192,7 +193,7 @@ describe('Buffer highlighting', function() | ]]) - execute(':3move 4') + command(':3move 4') screen:expect([[ a {5:longer} example | | @@ -201,7 +202,7 @@ describe('Buffer highlighting', function() {1:~ }| {1:~ }| {1:~ }| - ::3move 4 | + | ]]) end) end) diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 05cf3231ea..5f8fafef07 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -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 execute, request, eq = helpers.execute, helpers.request, helpers.eq +local feed_command, request, eq = helpers.feed_command, helpers.request, helpers.eq if helpers.pending_win32(pending) then return end @@ -41,18 +41,18 @@ describe('manual syntax highlight', function() end) it("works with buffer switch and 'hidden'", function() - execute('e tmp1.vim') - execute('e Xtest-functional-ui-highlight.tmp.vim') - execute('filetype on') - execute('syntax manual') - execute('set ft=vim') - execute('set syntax=ON') + feed_command('e tmp1.vim') + feed_command('e Xtest-functional-ui-highlight.tmp.vim') + feed_command('filetype on') + feed_command('syntax manual') + feed_command('set ft=vim') + feed_command('set syntax=ON') feed('iecho 1<esc>0') - execute('set hidden') - execute('w') - execute('bn') - execute('bp') + feed_command('set hidden') + feed_command('w') + feed_command('bn') + feed_command('bp') screen:expect([[ {1:^echo} 1 | {0:~ }| @@ -63,18 +63,18 @@ describe('manual syntax highlight', function() end) it("works with buffer switch and 'nohidden'", function() - execute('e tmp1.vim') - execute('e Xtest-functional-ui-highlight.tmp.vim') - execute('filetype on') - execute('syntax manual') - execute('set ft=vim') - execute('set syntax=ON') + feed_command('e tmp1.vim') + feed_command('e Xtest-functional-ui-highlight.tmp.vim') + feed_command('filetype on') + feed_command('syntax manual') + feed_command('set ft=vim') + feed_command('set syntax=ON') feed('iecho 1<esc>0') - execute('set nohidden') - execute('w') - execute('bn') - execute('bp') + feed_command('set nohidden') + feed_command('w') + feed_command('bn') + feed_command('bp') screen:expect([[ {1:^echo} 1 | {0:~ }| @@ -107,7 +107,7 @@ describe('Default highlight groups', function() [1] = {reverse = true, bold = true}, -- StatusLine [2] = {reverse = true} -- StatusLineNC }) - execute('sp', 'vsp', 'vsp') + feed_command('sp', 'vsp', 'vsp') screen:expect([[ ^ {2:|} {2:|} | {0:~ }{2:|}{0:~ }{2:|}{0:~ }| @@ -235,7 +235,7 @@ describe('Default highlight groups', function() it('can be cleared and linked to other highlight groups', function() screen:try_resize(53, 4) - execute('highlight clear ModeMsg') + feed_command('highlight clear ModeMsg') feed('i') screen:expect([[ ^ | @@ -245,8 +245,8 @@ describe('Default highlight groups', function() ]], {[0] = {bold=true, foreground=Screen.colors.Blue}, [1] = {bold=true}}) feed('<esc>') - execute('highlight CustomHLGroup guifg=red guibg=green') - execute('highlight link ModeMsg CustomHLGroup') + feed_command('highlight CustomHLGroup guifg=red guibg=green') + feed_command('highlight link ModeMsg CustomHLGroup') feed('i') screen:expect([[ ^ | @@ -259,8 +259,8 @@ describe('Default highlight groups', function() it('can be cleared by assigning NONE', function() screen:try_resize(53, 4) - execute('syn keyword TmpKeyword neovim') - execute('hi link TmpKeyword ErrorMsg') + feed_command('syn keyword TmpKeyword neovim') + feed_command('hi link TmpKeyword ErrorMsg') insert('neovim') screen:expect([[ {1:neovi^m} | @@ -271,7 +271,7 @@ describe('Default highlight groups', function() [0] = {bold=true, foreground=Screen.colors.Blue}, [1] = {foreground = Screen.colors.White, background = Screen.colors.Red} }) - execute("hi ErrorMsg term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE" + feed_command("hi ErrorMsg term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE" .. " gui=NONE guifg=NONE guibg=NONE guisp=NONE") screen:expect([[ neovi^m | @@ -283,8 +283,8 @@ describe('Default highlight groups', function() it('Whitespace highlight', function() screen:try_resize(53, 4) - execute('highlight NonText gui=NONE guifg=#FF0000') - execute('set listchars=space:.,tab:>-,trail:*,eol:¬ list') + feed_command('highlight NonText gui=NONE guifg=#FF0000') + feed_command('set listchars=space:.,tab:>-,trail:*,eol:¬ list') insert(' ne \t o\tv im ') screen:expect([[ ne{0:.>----.}o{0:>-----}v{0:..}im{0:*^*¬} | @@ -295,7 +295,7 @@ describe('Default highlight groups', function() [0] = {foreground=Screen.colors.Red}, [1] = {foreground=Screen.colors.Blue}, }) - execute('highlight Whitespace gui=NONE guifg=#0000FF') + feed_command('highlight Whitespace gui=NONE guifg=#0000FF') screen:expect([[ ne{1:.>----.}o{1:>-----}v{1:..}im{1:*^*}{0:¬} | {0:~ }| @@ -318,19 +318,19 @@ describe('guisp (special/undercurl)', function() end) it('can be set and is applied like foreground or background', function() - execute('syntax on') - execute('syn keyword TmpKeyword neovim') - execute('syn keyword TmpKeyword1 special') - execute('syn keyword TmpKeyword2 specialwithbg') - execute('syn keyword TmpKeyword3 specialwithfg') - execute('hi! Awesome guifg=red guibg=yellow guisp=red') - execute('hi! Awesome1 guisp=red') - execute('hi! Awesome2 guibg=yellow guisp=red') - execute('hi! Awesome3 guifg=red guisp=red') - execute('hi link TmpKeyword Awesome') - execute('hi link TmpKeyword1 Awesome1') - execute('hi link TmpKeyword2 Awesome2') - execute('hi link TmpKeyword3 Awesome3') + feed_command('syntax on') + feed_command('syn keyword TmpKeyword neovim') + feed_command('syn keyword TmpKeyword1 special') + feed_command('syn keyword TmpKeyword2 specialwithbg') + feed_command('syn keyword TmpKeyword3 specialwithfg') + feed_command('hi! Awesome guifg=red guibg=yellow guisp=red') + feed_command('hi! Awesome1 guisp=red') + feed_command('hi! Awesome2 guibg=yellow guisp=red') + feed_command('hi! Awesome3 guifg=red guisp=red') + feed_command('hi link TmpKeyword Awesome') + feed_command('hi link TmpKeyword1 Awesome1') + feed_command('hi link TmpKeyword2 Awesome2') + feed_command('hi link TmpKeyword3 Awesome3') insert([[ neovim awesome neovim @@ -382,8 +382,8 @@ describe("'listchars' highlight", function() [0] = {bold=true, foreground=Screen.colors.Blue}, [1] = {background=Screen.colors.Grey90} }) - execute('highlight clear ModeMsg') - execute('set cursorline') + feed_command('highlight clear ModeMsg') + feed_command('set cursorline') feed('i') screen:expect([[ {1:^ }| @@ -408,7 +408,7 @@ describe("'listchars' highlight", function() {0:~ }| | ]]) - execute('set nocursorline') + feed_command('set nocursorline') screen:expect([[ abcdefg | kkasd^f | @@ -432,8 +432,8 @@ describe("'listchars' highlight", function() ^f | | ]]) - execute('set cursorline') - execute('set cursorcolumn') + feed_command('set cursorline') + feed_command('set cursorcolumn') feed('kkiabcdefghijk<esc>hh') screen:expect([[ kkasd {1: } | @@ -472,11 +472,11 @@ describe("'listchars' highlight", function() foreground=Screen.colors.Red, }, }) - execute('highlight clear ModeMsg') - execute('highlight Whitespace guifg=#FF0000') - execute('set cursorline') - execute('set tabstop=8') - execute('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list') + feed_command('highlight clear ModeMsg') + feed_command('highlight Whitespace guifg=#FF0000') + feed_command('set cursorline') + feed_command('set tabstop=8') + feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list') feed('i\t abcd <cr>\t abcd <cr><esc>k') screen:expect([[ {5:>-------.}abcd{5:*}{4:¬} | @@ -493,7 +493,7 @@ describe("'listchars' highlight", function() {4:~ }| | ]]) - execute('set nocursorline') + feed_command('set nocursorline') screen:expect([[ {5:^>-------.}abcd{5:*}{4:¬} | {5:>-------.}abcd{5:*}{4:¬} | @@ -501,7 +501,7 @@ describe("'listchars' highlight", function() {4:~ }| :set nocursorline | ]]) - execute('set nowrap') + feed_command('set nowrap') feed('ALorem ipsum dolor sit amet<ESC>0') screen:expect([[ {5:^>-------.}abcd{5:.}Lorem{4:>}| @@ -510,7 +510,7 @@ describe("'listchars' highlight", function() {4:~ }| | ]]) - execute('set cursorline') + feed_command('set cursorline') screen:expect([[ {2:^>-------.}{1:abcd}{2:.}{1:Lorem}{4:>}| {5:>-------.}abcd{5:*}{4:¬} | @@ -568,12 +568,12 @@ describe("'listchars' highlight", function() bold=true, }, }) - execute('highlight clear ModeMsg') - execute('highlight Whitespace guifg=#FF0000') - execute('set cursorline') - execute('set tabstop=8') - execute('set nowrap') - execute('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list') + feed_command('highlight clear ModeMsg') + feed_command('highlight Whitespace guifg=#FF0000') + feed_command('set cursorline') + feed_command('set tabstop=8') + feed_command('set nowrap') + feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list') feed('i\t abcd <cr>\t abcd Lorem ipsum dolor sit amet<cr><esc>kkk0') screen:expect([[ {2:^>-------.}{1:abcd}{2:*}{3:¬}{1: }| @@ -615,10 +615,10 @@ describe("'listchars' highlight", function() [2] = {foreground=Screen.colors.Red}, [3] = {foreground=Screen.colors.Green1}, }) - execute('highlight clear ModeMsg') - execute('highlight Whitespace guifg=#FF0000') - execute('highlight Error guifg=#00FF00') - execute('set nowrap') + feed_command('highlight clear ModeMsg') + feed_command('highlight Whitespace guifg=#FF0000') + feed_command('highlight Error guifg=#00FF00') + feed_command('set nowrap') feed('ia \t bc \t <esc>') screen:expect([[ a bc ^ | @@ -627,7 +627,7 @@ describe("'listchars' highlight", function() {0:~ }| | ]]) - execute('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list') + feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list') screen:expect([[ a{2:.>-----.}bc{2:*>---*^*}{0:¬} | {0:~ }| @@ -635,7 +635,7 @@ describe("'listchars' highlight", function() {0:~ }| | ]]) - execute('match Error /\\s\\+$/') + feed_command('match Error /\\s\\+$/') screen:expect([[ a{2:.>-----.}bc{3:*>---*^*}{0:¬} | {0:~ }| diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index 3b31da0397..b7a33cb64d 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -4,7 +4,7 @@ local clear = helpers.clear local curbufmeths = helpers.curbufmeths local eq = helpers.eq local eval = helpers.eval -local execute = helpers.execute +local feed_command = helpers.feed_command local expect = helpers.expect local feed = helpers.feed local insert = helpers.insert @@ -21,9 +21,9 @@ local default_text = [[ local function common_setup(screen, inccommand, text) if screen then - execute("syntax on") - execute("set nohlsearch") - execute("hi Substitute guifg=red guibg=yellow") + feed_command("syntax on") + feed_command("set nohlsearch") + feed_command("hi Substitute guifg=red guibg=yellow") screen:attach() screen:set_default_attr_ids({ [1] = {foreground = Screen.colors.Fuchsia}, @@ -46,7 +46,7 @@ local function common_setup(screen, inccommand, text) }) end - execute("set inccommand=" .. (inccommand and inccommand or "")) + feed_command("set inccommand=" .. (inccommand and inccommand or "")) if text then insert(text) @@ -91,8 +91,8 @@ describe(":substitute, 'inccommand' preserves", function() local screen = Screen.new(30,10) common_setup(screen, "split", "ABC") - execute("%s/AB/BA/") - execute("ls") + feed_command("%s/AB/BA/") + feed_command("ls") screen:expect([[ {15:~ }| @@ -111,25 +111,25 @@ describe(":substitute, 'inccommand' preserves", function() for _, case in pairs{"", "split", "nosplit"} do it("various delimiters (inccommand="..case..")", function() insert(default_text) - execute("set inccommand=" .. case) + feed_command("set inccommand=" .. case) local delims = { '/', '#', ';', '%', ',', '@', '!', ''} for _,delim in pairs(delims) do - execute("%s"..delim.."lines"..delim.."LINES"..delim.."g") + feed_command("%s"..delim.."lines"..delim.."LINES"..delim.."g") expect([[ Inc substitution on two LINES ]]) - execute("undo") + feed_command("undo") end end) end for _, case in pairs{"", "split", "nosplit"} do it("'undolevels' (inccommand="..case..")", function() - execute("set undolevels=139") - execute("setlocal undolevels=34") - execute("set inccommand=" .. case) + feed_command("set undolevels=139") + feed_command("setlocal undolevels=34") + feed_command("set inccommand=" .. case) insert("as") feed(":%s/as/glork/<enter>") eq(meths.get_option('undolevels'), 139) @@ -139,8 +139,8 @@ describe(":substitute, 'inccommand' preserves", function() for _, case in ipairs({"", "split", "nosplit"}) do it("empty undotree() (inccommand="..case..")", function() - execute("set undolevels=1000") - execute("set inccommand=" .. case) + feed_command("set undolevels=1000") + feed_command("set inccommand=" .. case) local expected_undotree = eval("undotree()") -- Start typing an incomplete :substitute command. @@ -157,8 +157,8 @@ describe(":substitute, 'inccommand' preserves", function() for _, case in ipairs({"", "split", "nosplit"}) do it("undotree() with branches (inccommand="..case..")", function() - execute("set undolevels=1000") - execute("set inccommand=" .. case) + feed_command("set undolevels=1000") + feed_command("set inccommand=" .. case) -- Make some changes. feed([[isome text 1<C-\><C-N>]]) feed([[osome text 2<C-\><C-N>]]) @@ -192,7 +192,7 @@ describe(":substitute, 'inccommand' preserves", function() for _, case in pairs{"", "split", "nosplit"} do it("b:changedtick (inccommand="..case..")", function() - execute("set inccommand=" .. case) + feed_command("set inccommand=" .. case) feed([[isome text 1<C-\><C-N>]]) feed([[osome text 2<C-\><C-N>]]) local expected_tick = eval("b:changedtick") @@ -271,18 +271,18 @@ describe(":substitute, 'inccommand' preserves undo", function() local function test_sub(substring, split, redoable) clear() - execute("set inccommand=" .. split) + feed_command("set inccommand=" .. split) insert("1") feed("o2<esc>") - execute("undo") + feed_command("undo") feed("o3<esc>") if redoable then feed("o4<esc>") - execute("undo") + feed_command("undo") end feed(substring.. "<enter>") - execute("undo") + feed_command("undo") feed("g-") expect([[ @@ -297,15 +297,15 @@ describe(":substitute, 'inccommand' preserves undo", function() local function test_notsub(substring, split, redoable) clear() - execute("set inccommand=" .. split) + feed_command("set inccommand=" .. split) insert("1") feed("o2<esc>") - execute("undo") + feed_command("undo") feed("o3<esc>") if redoable then feed("o4<esc>") - execute("undo") + feed_command("undo") end feed(substring .. "<esc>") @@ -331,7 +331,7 @@ describe(":substitute, 'inccommand' preserves undo", function() local function test_threetree(substring, split) clear() - execute("set inccommand=" .. split) + feed_command("set inccommand=" .. split) insert("1") feed("o2<esc>") @@ -424,22 +424,22 @@ describe(":substitute, 'inccommand' preserves undo", function() for _, case in pairs(cases) do clear() common_setup(nil, case, default_text) - execute("set undolevels=0") + feed_command("set undolevels=0") feed("1G0") insert("X") feed(":%s/tw/MO/<esc>") - execute("undo") + feed_command("undo") expect(default_text) - execute("undo") + feed_command("undo") expect(default_text:gsub("Inc", "XInc")) - execute("undo") + feed_command("undo") - execute("%s/tw/MO/g") + feed_command("%s/tw/MO/g") expect(default_text:gsub("tw", "MO")) - execute("undo") + feed_command("undo") expect(default_text) - execute("undo") + feed_command("undo") expect(default_text:gsub("tw", "MO")) end end) @@ -450,7 +450,7 @@ describe(":substitute, 'inccommand' preserves undo", function() for _, case in pairs(cases) do clear() common_setup(screen, case, default_text) - execute("set undolevels=1") + feed_command("set undolevels=1") feed("1G0") insert("X") @@ -508,7 +508,7 @@ describe(":substitute, 'inccommand' preserves undo", function() for _, case in pairs(cases) do clear() common_setup(screen, case, default_text) - execute("set undolevels=2") + feed_command("set undolevels=2") feed("2GAx<esc>") feed("Ay<esc>") @@ -601,7 +601,7 @@ describe(":substitute, 'inccommand' preserves undo", function() clear() common_setup(screen, case, default_text) - execute("set undolevels=-1") + feed_command("set undolevels=-1") feed(":%s/tw/MO/g<enter>") -- using execute("undo") here will result in a "Press ENTER" prompt feed("u") @@ -637,7 +637,7 @@ describe(":substitute, 'inccommand' preserves undo", function() clear() common_setup(screen, case, default_text) - execute("set undolevels=-1") + feed_command("set undolevels=-1") feed("1G") feed("IL<esc>") feed(":%s/tw/MO/g<esc>") @@ -676,7 +676,7 @@ describe(":substitute, inccommand=split", function() end) it("preserves 'modified' buffer flag", function() - execute("set nomodified") + feed_command("set nomodified") feed(":%s/tw") screen:expect([[ Inc substitution on | @@ -825,7 +825,7 @@ describe(":substitute, inccommand=split", function() end) it("'hlsearch' is active, 'cursorline' is not", function() - execute("set hlsearch cursorline") + feed_command("set hlsearch cursorline") feed("gg") -- Assert that 'cursorline' is active. @@ -917,7 +917,7 @@ describe(":substitute, inccommand=split", function() feed("gg") feed("2yy") feed("2000p") - execute("1,1000s/tw/BB/g") + feed_command("1,1000s/tw/BB/g") feed(":%s/tw/X") screen:expect([[ @@ -983,9 +983,9 @@ describe(":substitute, inccommand=split", function() -- Assert that 'inccommand' is ENABLED initially. eq("split", eval("&inccommand")) -- Set 'redrawtime' to minimal value, to ensure timeout is triggered. - execute("set redrawtime=1 nowrap") + feed_command("set redrawtime=1 nowrap") -- Load a big file. - execute("silent edit! test/functional/fixtures/bigfile.txt") + feed_command("silent edit! test/functional/fixtures/bigfile.txt") -- Start :substitute with a slow pattern. feed([[:%s/B.*N/x]]) wait() @@ -1018,7 +1018,7 @@ describe(":substitute, inccommand=split", function() it("clears preview if non-previewable command is edited #5585", function() -- Put a non-previewable command in history. - execute("echo 'foo'") + feed_command("echo 'foo'") -- Start an incomplete :substitute command. feed(":1,2s/t/X") @@ -1079,7 +1079,7 @@ describe("inccommand=nosplit", function() end) it("works with :smagic, :snomagic", function() - execute("set hlsearch") + feed_command("set hlsearch") insert("Line *.3.* here") feed(":%smagic/3.*/X") -- start :smagic command @@ -1114,7 +1114,7 @@ describe("inccommand=nosplit", function() end) it('never shows preview buffer', function() - execute("set hlsearch") + feed_command("set hlsearch") feed(":%s/tw") screen:expect([[ @@ -1175,7 +1175,7 @@ describe("inccommand=nosplit", function() it("clears preview if non-previewable command is edited", function() -- Put a non-previewable command in history. - execute("echo 'foo'") + feed_command("echo 'foo'") -- Start an incomplete :substitute command. feed(":1,2s/t/X") @@ -1224,7 +1224,7 @@ describe(":substitute, 'inccommand' with a failing expression", function() it('in the pattern does nothing', function() for _, case in pairs(cases) do refresh(case) - execute("set inccommand=" .. case) + feed_command("set inccommand=" .. case) feed(":silent! %s/tw\\(/LARD/<enter>") expect(default_text) end @@ -1236,10 +1236,10 @@ describe(":substitute, 'inccommand' with a failing expression", function() local replacements = { "\\='LARD", "\\=xx_novar__xx" } for _, repl in pairs(replacements) do - execute("set inccommand=" .. case) + feed_command("set inccommand=" .. case) feed(":silent! %s/tw/" .. repl .. "/<enter>") expect(default_text:gsub("tw", "")) - execute("undo") + feed_command("undo") end end end) @@ -1295,10 +1295,10 @@ describe("'inccommand' and :cnoremap", function() for i = 1, string.len(command) do local c = string.sub(command, i, i) - execute("cnoremap ".. c .. " " .. c) + feed_command("cnoremap ".. c .. " " .. c) end - execute(command) + feed_command(command) expect([[ Inc substitution on two LINES @@ -1309,7 +1309,7 @@ describe("'inccommand' and :cnoremap", function() it('work when mappings move the cursor', function() for _, case in pairs(cases) do refresh(case) - execute("cnoremap ,S LINES/<left><left><left><left><left><left>") + feed_command("cnoremap ,S LINES/<left><left><left><left><left><left>") feed(":%s/lines/,Sor three <enter>") expect([[ @@ -1317,21 +1317,21 @@ describe("'inccommand' and :cnoremap", function() two or three LINES ]]) - execute("cnoremap ;S /X/<left><left><left>") + feed_command("cnoremap ;S /X/<left><left><left>") feed(":%s/;SI<enter>") expect([[ Xnc substitution on two or three LXNES ]]) - execute("cnoremap ,T //Y/<left><left><left>") + feed_command("cnoremap ,T //Y/<left><left><left>") feed(":%s,TX<enter>") expect([[ Ync substitution on two or three LYNES ]]) - execute("cnoremap ;T s//Z/<left><left><left>") + feed_command("cnoremap ;T s//Z/<left><left><left>") feed(":%;TY<enter>") expect([[ Znc substitution on @@ -1343,7 +1343,7 @@ describe("'inccommand' and :cnoremap", function() it('does not work with a failing mapping', function() for _, case in pairs(cases) do refresh(case) - execute("cnoremap <expr> x execute('bwipeout!')[-1].'x'") + feed_command("cnoremap <expr> x execute('bwipeout!')[-1].'x'") feed(":%s/tw/tox<enter>") @@ -1356,7 +1356,7 @@ describe("'inccommand' and :cnoremap", function() it('work when temporarily moving the cursor', function() for _, case in pairs(cases) do refresh(case) - execute("cnoremap <expr> x cursor(1, 1)[-1].'x'") + feed_command("cnoremap <expr> x cursor(1, 1)[-1].'x'") feed(":%s/tw/tox/g<enter>") expect(default_text:gsub("tw", "tox")) @@ -1366,7 +1366,7 @@ describe("'inccommand' and :cnoremap", function() it("work when a mapping disables 'inccommand'", function() for _, case in pairs(cases) do refresh(case) - execute("cnoremap <expr> x execute('set inccommand=')[-1]") + feed_command("cnoremap <expr> x execute('set inccommand=')[-1]") feed(":%s/tw/toxa/g<enter>") expect(default_text:gsub("tw", "toa")) @@ -1440,7 +1440,7 @@ describe("'inccommand' autocommands", function() local function register_autocmd(event) meths.set_var(event .. "_fired", {}) - execute("autocmd " .. event .. " * call add(g:" .. event .. "_fired, expand('<abuf>'))") + feed_command("autocmd " .. event .. " * call add(g:" .. event .. "_fired, expand('<abuf>'))") end it('are not fired when splitting', function() @@ -1493,8 +1493,8 @@ describe("'inccommand' split windows", function() refresh() feed("gg") - execute("vsplit") - execute("split") + feed_command("vsplit") + feed_command("split") feed(":%s/tw") screen:expect([[ Inc substitution on {10:|}Inc substitution on| @@ -1530,9 +1530,9 @@ describe("'inccommand' split windows", function() ]]) feed("<esc>") - execute("only") - execute("split") - execute("vsplit") + feed_command("only") + feed_command("split") + feed_command("vsplit") feed(":%s/tw") screen:expect([[ @@ -1581,7 +1581,7 @@ describe("'inccommand' split windows", function() it("are not affected by various settings", function() for _, setting in pairs(settings) do refresh() - execute("set " .. setting) + feed_command("set " .. setting) feed(":%s/tw") diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua index cec19250d2..29d974b709 100644 --- a/test/functional/ui/input_spec.lua +++ b/test/functional/ui/input_spec.lua @@ -1,5 +1,5 @@ local helpers = require('test.functional.helpers')(after_each) -local clear, execute, nvim = helpers.clear, helpers.execute, helpers.nvim +local clear, feed_command, nvim = helpers.clear, helpers.feed_command, helpers.nvim local feed, next_message, eq = helpers.feed, helpers.next_message, helpers.eq local expect = helpers.expect local Screen = require('test.functional.ui.screen') @@ -12,7 +12,7 @@ describe('mappings', function() local add_mapping = function(mapping, send) local cmd = "nnoremap "..mapping.." :call rpcnotify("..cid..", 'mapped', '" ..send:gsub('<', '<lt>').."')<cr>" - execute(cmd) + feed_command(cmd) end local check_mapping = function(mapping, expected) @@ -57,7 +57,7 @@ describe('feeding large chunks of input with <Paste>', function() clear() screen = Screen.new() screen:attach() - execute('set ruler') + feed_command('set ruler') end) it('ok', function() diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index ecbd5642d1..35af34015d 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -1,7 +1,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear, feed, meths = helpers.clear, helpers.feed, helpers.meths -local insert, execute = helpers.insert, helpers.execute +local insert, feed_command = helpers.insert, helpers.feed_command local eq, funcs = helpers.eq, helpers.funcs if helpers.pending_win32(pending) then return end @@ -123,9 +123,9 @@ describe('ui/mouse/input', function() end) it('in tabline on filler space moves tab to the end', function() - execute('%delete') + feed_command('%delete') insert('this is foo') - execute('silent file foo | tabnew | file bar') + feed_command('silent file foo | tabnew | file bar') insert('this is bar') screen:expect([[ {tab: + foo }{sel: + bar }{fill: }{tab:X}| @@ -160,9 +160,9 @@ describe('ui/mouse/input', function() return end - execute('%delete') + feed_command('%delete') insert('this is foo') - execute('silent file foo | tabnew | file bar') + feed_command('silent file foo | tabnew | file bar') insert('this is bar') screen:expect([[ {tab: + foo }{sel: + bar }{fill: }{tab:X}| @@ -190,9 +190,9 @@ describe('ui/mouse/input', function() end) it('in tabline to the right moves tab right', function() - execute('%delete') + feed_command('%delete') insert('this is foo') - execute('silent file foo | tabnew | file bar') + feed_command('silent file foo | tabnew | file bar') insert('this is bar') screen:expect([[ {tab: + foo }{sel: + bar }{fill: }{tab:X}| @@ -220,9 +220,9 @@ describe('ui/mouse/input', function() end) it('out of tabline under filler space moves tab to the end', function() - execute('%delete') + feed_command('%delete') insert('this is foo') - execute('silent file foo | tabnew | file bar') + feed_command('silent file foo | tabnew | file bar') insert('this is bar') screen:expect([[ {tab: + foo }{sel: + bar }{fill: }{tab:X}| @@ -265,9 +265,9 @@ describe('ui/mouse/input', function() return end - execute('%delete') + feed_command('%delete') insert('this is foo') - execute('silent file foo | tabnew | file bar') + feed_command('silent file foo | tabnew | file bar') insert('this is bar') screen:expect([[ {tab: + foo }{sel: + bar }{fill: }{tab:X}| @@ -303,9 +303,9 @@ describe('ui/mouse/input', function() end) it('out of tabline to the right moves tab right', function() - execute('%delete') + feed_command('%delete') insert('this is foo') - execute('silent file foo | tabnew | file bar') + feed_command('silent file foo | tabnew | file bar') insert('this is bar') screen:expect([[ {tab: + foo }{sel: + bar }{fill: }{tab:X}| @@ -352,9 +352,9 @@ describe('ui/mouse/input', function() end) it('left click in default tabline (position 4) switches to tab', function() - execute('%delete') + feed_command('%delete') insert('this is foo') - execute('silent file foo | tabnew | file bar') + feed_command('silent file foo | tabnew | file bar') insert('this is bar') screen:expect([[ {tab: + foo }{sel: + bar }{fill: }{tab:X}| @@ -375,9 +375,9 @@ describe('ui/mouse/input', function() it('left click in default tabline (position 24) closes tab', function() meths.set_option('hidden', true) - execute('%delete') + feed_command('%delete') insert('this is foo') - execute('silent file foo | tabnew | file bar') + feed_command('silent file foo | tabnew | file bar') insert('this is bar') screen:expect([[ {tab: + foo }{sel: + bar }{fill: }{tab:X}| @@ -398,9 +398,9 @@ describe('ui/mouse/input', function() it('double click in default tabline (position 4) opens new tab', function() meths.set_option('hidden', true) - execute('%delete') + feed_command('%delete') insert('this is foo') - execute('silent file foo | tabnew | file bar') + feed_command('silent file foo | tabnew | file bar') insert('this is bar') screen:expect([[ {tab: + foo }{sel: + bar }{fill: }{tab:X}| @@ -421,13 +421,13 @@ describe('ui/mouse/input', function() describe('%@ label', function() before_each(function() - execute([[ + feed_command([[ function Test(...) let g:reply = a:000 return copy(a:000) " Check for memory leaks: return should be freed endfunction ]]) - execute([[ + feed_command([[ function Test2(...) return call('Test', a:000 + [2]) endfunction @@ -533,9 +533,9 @@ describe('ui/mouse/input', function() fill = { reverse=true }, vis = { background=Screen.colors.LightGrey } }) - execute('silent file foo | tabnew | file bar') + feed_command('silent file foo | tabnew | file bar') insert('this is bar') - execute('tabprevious') -- go to first tab + feed_command('tabprevious') -- go to first tab screen:expect([[ {sel: + foo }{tab: + bar }{fill: }{tab:X}| mouse | @@ -641,7 +641,7 @@ describe('ui/mouse/input', function() mouse scrolling ]]) screen:try_resize(53, 14) - execute('sp', 'vsp') + feed_command('sp', 'vsp') screen:expect([[ lines {4:|}lines | to {4:|}to | @@ -754,12 +754,12 @@ describe('ui/mouse/input', function() }) feed('ggdG') - execute('set concealcursor=n') - execute('set nowrap') - execute('syntax match NonText "\\<amet\\>" conceal') - execute('syntax match NonText "\\cs\\|g." conceal cchar=X') - execute('syntax match NonText "\\%(lo\\|cl\\)." conceal') - execute('syntax match NonText "Lo" conceal cchar=Y') + feed_command('set concealcursor=n') + feed_command('set nowrap') + feed_command('syntax match NonText "\\<amet\\>" conceal') + feed_command('syntax match NonText "\\cs\\|g." conceal cchar=X') + feed_command('syntax match NonText "\\%(lo\\|cl\\)." conceal') + feed_command('syntax match NonText "Lo" conceal cchar=Y') insert([[ Lorem ipsum dolor sit amet, consetetur sadipscing elitr. @@ -770,7 +770,7 @@ describe('ui/mouse/input', function() end) it('(level 1) click on non-wrapped lines', function() - execute('let &conceallevel=1', 'echo') + feed_command('let &conceallevel=1', 'echo') feed('<esc><LeftMouse><0,0>') screen:expect([[ @@ -818,7 +818,7 @@ describe('ui/mouse/input', function() end) -- level 1 - non wrapped it('(level 1) click on wrapped lines', function() - execute('let &conceallevel=1', 'let &wrap=1', 'echo') + feed_command('let &conceallevel=1', 'let &wrap=1', 'echo') feed('<esc><LeftMouse><0,0>') screen:expect([[ @@ -867,7 +867,7 @@ describe('ui/mouse/input', function() it('(level 2) click on non-wrapped lines', function() - execute('let &conceallevel=2', 'echo') + feed_command('let &conceallevel=2', 'echo') feed('<esc><LeftMouse><0,0>') screen:expect([[ @@ -915,7 +915,7 @@ describe('ui/mouse/input', function() end) -- level 2 - non wrapped it('(level 2) click on wrapped lines', function() - execute('let &conceallevel=2', 'let &wrap=1', 'echo') + feed_command('let &conceallevel=2', 'let &wrap=1', 'echo') feed('<esc><LeftMouse><0,0>') screen:expect([[ @@ -964,7 +964,7 @@ describe('ui/mouse/input', function() it('(level 3) click on non-wrapped lines', function() - execute('let &conceallevel=3', 'echo') + feed_command('let &conceallevel=3', 'echo') feed('<esc><LeftMouse><0,0>') screen:expect([[ @@ -1012,7 +1012,7 @@ describe('ui/mouse/input', function() end) -- level 3 - non wrapped it('(level 3) click on wrapped lines', function() - execute('let &conceallevel=3', 'let &wrap=1', 'echo') + feed_command('let &conceallevel=3', 'let &wrap=1', 'echo') feed('<esc><LeftMouse><0,0>') screen:expect([[ diff --git a/test/functional/ui/quickfix_spec.lua b/test/functional/ui/quickfix_spec.lua index 29b28fe9f0..b0d89ee3b6 100644 --- a/test/functional/ui/quickfix_spec.lua +++ b/test/functional/ui/quickfix_spec.lua @@ -1,7 +1,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear, feed, meths = helpers.clear, helpers.feed, helpers.meths -local insert, execute = helpers.insert, helpers.execute +local insert, command = helpers.insert, helpers.command describe('quickfix selection highlight', function() @@ -28,8 +28,8 @@ describe('quickfix selection highlight', function() }) meths.set_option('errorformat', '%m %l') - execute('syntax on') - execute('highlight Search guibg=Green') + command('syntax on') + command('highlight Search guibg=Green') insert([[ Line 1 @@ -39,7 +39,7 @@ describe('quickfix selection highlight', function() Line 5 ]]) - execute('cad') + command('cad') feed('gg') screen:expect([[ @@ -52,12 +52,12 @@ describe('quickfix selection highlight', function() {1:~ }| {1:~ }| {1:~ }| - :cad | + | ]]) end) it('using default Search highlight group', function() - execute('copen') + command('copen') screen:expect([[ Line 1 | @@ -69,10 +69,10 @@ describe('quickfix selection highlight', function() |{3:5}| Line | || | {4:[Quickfix List] }| - :copen | + | ]]) - execute('cnext') + command('cnext') screen:expect([[ Line 1 | @@ -84,14 +84,14 @@ describe('quickfix selection highlight', function() |{3:5}| Line | || | {4:[Quickfix List] }| - :cnext | + | ]]) end) it('using QuickFixLine highlight group', function() - execute('highlight QuickFixLine guibg=Red') + command('highlight QuickFixLine guibg=Red') - execute('copen') + command('copen') screen:expect([[ Line 1 | @@ -103,10 +103,10 @@ describe('quickfix selection highlight', function() |{3:5}| Line | || | {4:[Quickfix List] }| - :copen | + | ]]) - execute('cnext') + command('cnext') screen:expect([[ Line 1 | @@ -118,16 +118,16 @@ describe('quickfix selection highlight', function() |{3:5}| Line | || | {4:[Quickfix List] }| - :cnext | + | ]]) end) it('combines with CursorLine', function() - execute('set cursorline') - execute('highlight QuickFixLine guifg=Red') - execute('highlight CursorLine guibg=Fuchsia') + command('set cursorline') + command('highlight QuickFixLine guifg=Red') + command('highlight CursorLine guibg=Fuchsia') - execute('copen') + command('copen') screen:expect([[ {9:Line 1 }| @@ -139,7 +139,7 @@ describe('quickfix selection highlight', function() |{3:5}| Line | || | {4:[Quickfix List] }| - :copen | + | ]]) feed('j') @@ -154,16 +154,16 @@ describe('quickfix selection highlight', function() |{3:5}| Line | || | {4:[Quickfix List] }| - :copen | + | ]]) end) it('QuickFixLine background takes precedence over CursorLine', function() - execute('set cursorline') - execute('highlight QuickFixLine guibg=Red') - execute('highlight CursorLine guibg=Fuchsia') + command('set cursorline') + command('highlight QuickFixLine guibg=Red') + command('highlight CursorLine guibg=Fuchsia') - execute('copen') + command('copen') screen:expect([[ {9:Line 1 }| @@ -175,7 +175,7 @@ describe('quickfix selection highlight', function() |{3:5}| Line | || | {4:[Quickfix List] }| - :copen | + | ]]) feed('j') @@ -190,7 +190,7 @@ describe('quickfix selection highlight', function() |{3:5}| Line | || | {4:[Quickfix List] }| - :copen | + | ]]) end) end) diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua index 21953ba294..8182190b5f 100644 --- a/test/functional/ui/screen_basic_spec.lua +++ b/test/functional/ui/screen_basic_spec.lua @@ -1,7 +1,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local spawn, set_session, clear = helpers.spawn, helpers.set_session, helpers.clear -local feed, execute = helpers.feed, helpers.execute +local feed, command = helpers.feed, helpers.command local insert = helpers.insert local eq = helpers.eq local eval = helpers.eval @@ -75,7 +75,7 @@ describe('Screen', function() local function check() eq(true, screen.suspended) end - execute('suspend') + command('suspend') screen:expect(check) screen.suspended = false feed('<c-z>') @@ -91,7 +91,7 @@ describe('Screen', function() eq(false, screen.visual_bell) end) screen.bell = false - execute('set visualbell') + command('set visualbell') feed('<left>') screen:expect(function() eq(true, screen.visual_bell) @@ -103,8 +103,8 @@ describe('Screen', function() describe(':set title', function() it('is forwarded to the UI', function() local expected = 'test-title' - execute('set titlestring='..expected) - execute('set title') + command('set titlestring='..expected) + command('set title') screen:expect(function() eq(expected, screen.title) end) @@ -112,7 +112,7 @@ describe('Screen', function() it('has correct default title with unnamed file', function() local expected = '[No Name] - NVIM' - execute('set title') + command('set title') screen:expect(function() eq(expected, screen.title) end) @@ -120,8 +120,8 @@ describe('Screen', function() it('has correct default title with named file', function() local expected = 'myfile (/mydir) - NVIM' - execute('set title') - execute('file /mydir/myfile') + command('set title') + command('file /mydir/myfile') screen:expect(function() eq(expected, screen.title) end) @@ -131,8 +131,8 @@ describe('Screen', function() describe(':set icon', function() it('is forwarded to the UI', function() local expected = 'test-icon' - execute('set iconstring='..expected) - execute('set icon') + command('set iconstring='..expected) + command('set icon') screen:expect(function() eq(expected, screen.icon) end) @@ -142,7 +142,7 @@ describe('Screen', function() describe('window', function() describe('split', function() it('horizontal', function() - execute('sp') + command('sp') screen:expect([[ ^ | {0:~ }| @@ -157,13 +157,13 @@ describe('Screen', function() {0:~ }| {0:~ }| {3:[No Name] }| - :sp | + | ]]) end) it('horizontal and resize', function() - execute('sp') - execute('resize 8') + command('sp') + command('resize 8') screen:expect([[ ^ | {0:~ }| @@ -178,12 +178,14 @@ describe('Screen', function() {0:~ }| {0:~ }| {3:[No Name] }| - :resize 8 | + | ]]) end) it('horizontal and vertical', function() - execute('sp', 'vsp', 'vsp') + command('sp') + command('vsp') + command('vsp') screen:expect([[ ^ {3:|} {3:|} | {0:~ }{3:|}{0:~ }{3:|}{0:~ }| @@ -223,7 +225,9 @@ describe('Screen', function() describe('tabnew', function() it('creates a new buffer', function() - execute('sp', 'vsp', 'vsp') + command('sp') + command('vsp') + command('vsp') insert('hello') screen:expect([[ hell^o {3:|}hello {3:|}hello | @@ -241,7 +245,7 @@ describe('Screen', function() {3:[No Name] [+] }| | ]]) - execute('tabnew') + command('tabnew') insert('hello2') feed('h') screen:expect([[ @@ -260,7 +264,7 @@ describe('Screen', function() {0:~ }| | ]]) - execute('tabprevious') + command('tabprevious') screen:expect([[ {2: }{6:4}{2:+ [No Name] }{4: + [No Name] }{3: }{4:X}| hell^o {3:|}hello {3:|}hello | @@ -305,9 +309,9 @@ describe('Screen', function() describe('normal mode', function() -- https://code.google.com/p/vim/issues/detail?id=339 it("setting 'ruler' doesn't reset the preferred column", function() - execute('set virtualedit=') + command('set virtualedit=') feed('i0123456<cr>789<esc>kllj') - execute('set ruler') + command('set ruler') feed('k') screen:expect([[ 0123^456 | @@ -323,7 +327,7 @@ describe('Screen', function() {0:~ }| {0:~ }| {0:~ }| - :set ruler 1,5 All | + 1,5 All | ]]) end) end) @@ -388,7 +392,9 @@ describe('Screen', function() split windows ]]) - execute('sp', 'vsp', 'vsp') + command('sp') + command('vsp') + command('vsp') screen:expect([[ and {3:|}and {3:|}and | clearing {3:|}clearing {3:|}clearing | diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index 3914648e8f..11b18d015f 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -1,7 +1,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local execute = helpers.execute +local feed_command = helpers.feed_command if helpers.pending_win32(pending) then return end @@ -22,7 +22,7 @@ describe('search highlighting', function() end) it('is disabled by ":set nohlsearch"', function() - execute('set nohlsearch') + feed_command('set nohlsearch') insert("some text\nmore text") feed("gg/text<cr>") screen:expect([[ @@ -79,7 +79,7 @@ describe('search highlighting', function() /\<text\> | ]]) - execute("nohlsearch") + feed_command("nohlsearch") screen:expect([[ some text | more textstuff | @@ -92,8 +92,8 @@ describe('search highlighting', function() end) it('works with incsearch', function() - execute('set hlsearch') - execute('set incsearch') + feed_command('set hlsearch') + feed_command('set incsearch') insert([[ the first line in a little file @@ -156,8 +156,8 @@ describe('search highlighting', function() end) it('works with incsearch and offset', function() - execute('set hlsearch') - execute('set incsearch') + feed_command('set hlsearch') + feed_command('set incsearch') insert([[ not the match you're looking for the match is here]]) @@ -198,7 +198,7 @@ describe('search highlighting', function() end) it('works with multiline regexps', function() - execute('set hlsearch') + feed_command('set hlsearch') feed('4oa repeated line<esc>') feed('/line\\na<cr>') screen:expect([[ @@ -234,19 +234,19 @@ describe('search highlighting', function() [6] = {italic = true, background = colors.Magenta}, [7] = {bold = true, background = colors.Yellow}, } ) - execute('set hlsearch') + feed_command('set hlsearch') insert([[ very special text ]]) - execute("syntax on") - execute("highlight MyGroup guibg=Green gui=bold") - execute("highlight MyGroup2 guibg=Magenta gui=italic") - execute("call matchadd('MyGroup', 'special')") - execute("call matchadd('MyGroup2', 'text', 0)") + feed_command("syntax on") + feed_command("highlight MyGroup guibg=Green gui=bold") + feed_command("highlight MyGroup2 guibg=Magenta gui=italic") + feed_command("call matchadd('MyGroup', 'special')") + feed_command("call matchadd('MyGroup2', 'text', 0)") -- searchhl and matchadd matches are exclusive, only the higest priority -- is used (and matches with lower priorities are not combined) - execute("/ial te") + feed_command("/ial te") screen:expect([[ very {5:spec^ial}{2: te}{6:xt} | | @@ -257,7 +257,7 @@ describe('search highlighting', function() {4:search hit BOTTOM, continuing at TOP} | ]]) - execute("call clearmatches()") + feed_command("call clearmatches()") screen:expect([[ very spec{2:^ial te}xt | | @@ -270,7 +270,7 @@ describe('search highlighting', function() -- searchhl has priority over syntax, but in this case -- nonconflicting attributes are combined - execute("syntax keyword MyGroup special") + feed_command("syntax keyword MyGroup special") screen:expect([[ very {5:spec}{7:^ial}{2: te}xt | | diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua index d02fc83809..e5c96f2ec0 100644 --- a/test/functional/ui/sign_spec.lua +++ b/test/functional/ui/sign_spec.lua @@ -1,6 +1,6 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute +local clear, feed, command = helpers.clear, helpers.feed, helpers.command if helpers.pending_win32(pending) then return end @@ -25,11 +25,11 @@ describe('Signs', function() describe(':sign place', function() it('shadows previously placed signs', function() feed('ia<cr>b<cr>c<cr><esc>') - execute('sign define piet text=>> texthl=Search') - execute('sign define pietx text=>! texthl=Search') - execute('sign place 1 line=1 name=piet buffer=1') - execute('sign place 2 line=3 name=piet buffer=1') - execute('sign place 3 line=1 name=pietx buffer=1') + command('sign define piet text=>> texthl=Search') + command('sign define pietx text=>! texthl=Search') + command('sign place 1 line=1 name=piet buffer=1') + command('sign place 2 line=3 name=piet buffer=1') + command('sign place 3 line=1 name=pietx buffer=1') screen:expect([[ {1:>!}a | {2: }b | @@ -44,7 +44,7 @@ describe('Signs', function() {2: }{0:~ }| {2: }{0:~ }| {2: }{0:~ }| - :sign place 3 line=1 name=pietx buffer=1 | + | ]]) end) end) diff --git a/test/functional/ui/syntax_conceal_spec.lua b/test/functional/ui/syntax_conceal_spec.lua index ee3e4fa32a..28a104360d 100644 --- a/test/functional/ui/syntax_conceal_spec.lua +++ b/test/functional/ui/syntax_conceal_spec.lua @@ -1,6 +1,6 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute +local clear, feed, command = helpers.clear, helpers.feed, helpers.command local insert = helpers.insert if helpers.pending_win32(pending) then return end @@ -25,7 +25,7 @@ describe('Screen', function() describe("match and conceal", function() before_each(function() - execute("let &conceallevel=1") + command("let &conceallevel=1") end) describe("multiple", function() @@ -38,7 +38,7 @@ describe('Screen', function() && && ]]) - execute("syn match dAmpersand '[&][&]' conceal cchar=∧") + command("syn match dAmpersand '[&][&]' conceal cchar=∧") end) it("double characters.", function() @@ -52,7 +52,7 @@ describe('Screen', function() ^ | {0:~ }| {0:~ }| - :syn match dAmpersand '[&][&]' conceal cchar=∧ | + | ]]) end) @@ -68,7 +68,7 @@ describe('Screen', function() | {0:~ }| {0:~ }| - :syn match dAmpersand '[&][&]' conceal cchar=∧ | + | ]]) end) @@ -84,7 +84,7 @@ describe('Screen', function() | {0:~ }| {0:~ }| - :syn match dAmpersand '[&][&]' conceal cchar=∧ | + | ]]) end) @@ -100,7 +100,7 @@ describe('Screen', function() | {0:~ }| {0:~ }| - :syn match dAmpersand '[&][&]' conceal cchar=∧ | + | ]]) end) @@ -116,15 +116,15 @@ describe('Screen', function() ^ | {0:~ }| {0:~ }| - :syn match dAmpersand '[&][&]' conceal cchar=∧ | + | ]]) end) end) -- multiple it("keyword instances in initially in the document.", function() feed("2ilambda<cr><ESC>") - execute("let &conceallevel=1") - execute("syn keyword kLambda lambda conceal cchar=λ") + command("let &conceallevel=1") + command("syn keyword kLambda lambda conceal cchar=λ") screen:expect([[ {1:λ} | {1:λ} | @@ -135,7 +135,7 @@ describe('Screen', function() {0:~ }| {0:~ }| {0:~ }| - :syn keyword kLambda lambda conceal cchar=λ | + | ]]) end) -- Keyword @@ -144,11 +144,11 @@ describe('Screen', function() before_each(function() feed("2") insert("<r> a region of text </r>\n") - execute("let &conceallevel=1") + command("let &conceallevel=1") end) it('initially and conceal it.', function() - execute("syn region rText start='<r>' end='</r>' conceal cchar=R") + command("syn region rText start='<r>' end='</r>' conceal cchar=R") screen:expect([[ {1:R} | {1:R} | @@ -166,7 +166,7 @@ describe('Screen', function() it('initially and conceal its start tag and end tag.', function() -- concealends has a known bug (todo.txt) where the first match won't -- be replaced with cchar. - execute("syn region rText matchgroup=rMatch start='<r>' end='</r>' concealends cchar=-") + command("syn region rText matchgroup=rMatch start='<r>' end='</r>' concealends cchar=-") screen:expect([[ {1: } a region of text {1:-} | {1: } a region of text {1:-} | @@ -182,7 +182,7 @@ describe('Screen', function() end) it('that are nested and conceal the nested region\'s start and end tags.', function() - execute("syn region rText contains=rText matchgroup=rMatch start='<r>' end='</r>' concealends cchar=-") + command("syn region rText contains=rText matchgroup=rMatch start='<r>' end='</r>' concealends cchar=-") insert("<r> A region with <r> a nested <r> nested region.</r> </r> </r>\n") screen:expect([[ {1: } a region of text {1:-} | @@ -201,10 +201,10 @@ describe('Screen', function() describe("a region of text", function() before_each(function() - execute("syntax conceal on") + command("syntax conceal on") feed("2") insert("<r> a region of text </r>\n") - execute("syn region rText start='<r>' end='</r>' cchar=-") + command("syn region rText start='<r>' end='</r>' cchar=-") end) it("and turn on implicit concealing", function() @@ -218,15 +218,15 @@ describe('Screen', function() {0:~ }| {0:~ }| {0:~ }| - :syn region rText start='<r>' end='</r>' cchar=- | + | ]]) end) it("and then turn on, then off, and then back on implicit concealing.", function() - execute("syntax conceal off") + command("syntax conceal off") feed("2") insert("<i> italian text </i>\n") - execute("syn region iText start='<i>' end='</i>' cchar=*") + command("syn region iText start='<i>' end='</i>' cchar=*") screen:expect([[ {1:-} | {1:-} | @@ -237,10 +237,10 @@ describe('Screen', function() {0:~ }| {0:~ }| {0:~ }| - :syn region iText start='<i>' end='</i>' cchar=* | + | ]]) - execute("syntax conceal on") - execute("syn region iText start='<i>' end='</i>' cchar=*") + command("syntax conceal on") + command("syn region iText start='<i>' end='</i>' cchar=*") screen:expect([[ {1:-} | {1:-} | @@ -251,7 +251,7 @@ describe('Screen', function() {0:~ }| {0:~ }| {0:~ }| - :syn region iText start='<i>' end='</i>' cchar=* | + | ]]) end) end) -- a region of text (implicit concealing) @@ -262,13 +262,13 @@ describe('Screen', function() insert("// No Conceal\n") insert('"Conceal without a cchar"\n') insert("+ With cchar\n\n") - execute("syn match noConceal '^//.*$'") - execute("syn match concealNoCchar '\".\\{-}\"$' conceal") - execute("syn match concealWCchar '^+.\\{-}$' conceal cchar=C") + command("syn match noConceal '^//.*$'") + command("syn match concealNoCchar '\".\\{-}\"$' conceal") + command("syn match concealWCchar '^+.\\{-}$' conceal cchar=C") end) it("0. No concealing.", function() - execute("let &conceallevel=0") + command("let &conceallevel=0") screen:expect([[ // No Conceal | "Conceal without a cchar" | @@ -279,12 +279,12 @@ describe('Screen', function() {0:~ }| {0:~ }| {0:~ }| - :let &conceallevel=0 | + | ]]) end) it("1. Conceal using cchar or reference listchars.", function() - execute("let &conceallevel=1") + command("let &conceallevel=1") screen:expect([[ // No Conceal | {1: } | @@ -295,12 +295,12 @@ describe('Screen', function() {0:~ }| {0:~ }| {0:~ }| - :let &conceallevel=1 | + | ]]) end) it("2. Hidden unless cchar is set.", function() - execute("let &conceallevel=2") + command("let &conceallevel=2") screen:expect([[ // No Conceal | | @@ -311,12 +311,12 @@ describe('Screen', function() {0:~ }| {0:~ }| {0:~ }| - :let &conceallevel=2 | + | ]]) end) it("3. Hide all concealed text.", function() - execute("let &conceallevel=3") + command("let &conceallevel=3") screen:expect([[ // No Conceal | | @@ -327,7 +327,7 @@ describe('Screen', function() {0:~ }| {0:~ }| {0:~ }| - :let &conceallevel=3 | + | ]]) end) end) -- conceallevel diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index 6a6dc99c3d..6639bf272d 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -1,6 +1,6 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') -local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute +local clear, feed, command = helpers.clear, helpers.feed, helpers.command local funcs = helpers.funcs if helpers.pending_win32(pending) then return end @@ -20,8 +20,8 @@ describe("'wildmode'", function() describe("'wildmenu'", function() it(':sign <tab> shows wildmenu completions', function() - execute('set wildmode=full') - execute('set wildmenu') + command('set wildmode=full') + command('set wildmenu') feed(':sign <tab>') screen:expect([[ | @@ -50,10 +50,10 @@ describe('command line completion', function() it('lists directories with empty PATH', function() local tmp = funcs.tempname() - execute('e '.. tmp) - execute('cd %:h') - execute("call mkdir('Xtest-functional-viml-compl-dir')") - execute('let $PATH=""') + command('e '.. tmp) + command('cd %:h') + command("call mkdir('Xtest-functional-viml-compl-dir')") + command('let $PATH=""') feed(':!<tab><bs>') screen:expect([[ | |