diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ex_cmds/swapfile_preserve_recover_spec.lua | 5 | ||||
-rw-r--r-- | test/functional/lua/ui_event_spec.lua | 42 | ||||
-rw-r--r-- | test/functional/ui/cmdline_spec.lua | 29 | ||||
-rw-r--r-- | test/functional/ui/input_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/ui/messages_spec.lua | 157 | ||||
-rw-r--r-- | test/functional/vimscript/null_spec.lua | 2 | ||||
-rw-r--r-- | test/old/testdir/test_spell.vim | 12 | ||||
-rw-r--r-- | test/old/testdir/test_tagjump.vim | 4 |
8 files changed, 118 insertions, 137 deletions
diff --git a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua index 7234985009..08f7663075 100644 --- a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua +++ b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua @@ -220,6 +220,7 @@ describe('swapfile detection', function() .. [[%.swp"]], } feed('e') -- Chose "Edit" at the swap dialog. + screen2:expect({ any = pesc('E5555: API call: Vim(edit):E325: ATTENTION') }) feed('<c-c>') screen2:expect(expected_no_dialog) @@ -536,10 +537,6 @@ describe('quitting swapfile dialog on startup stops TUI properly', function() end) api.nvim_chan_send(chan, 'q') retry(nil, nil, function() - eq('Press ENTER or type command to continue', eval("getline('$')->trim(' ', 2)")) - end) - api.nvim_chan_send(chan, '\r') - retry(nil, nil, function() eq( { '', '[Process exited 1]', '' }, eval("[1, 2, '$']->map({_, lnum -> getline(lnum)->trim(' ', 2)})") diff --git a/test/functional/lua/ui_event_spec.lua b/test/functional/lua/ui_event_spec.lua index 7e890e8ae0..27640d6066 100644 --- a/test/functional/lua/ui_event_spec.lua +++ b/test/functional/lua/ui_event_spec.lua @@ -270,48 +270,6 @@ describe('vim.ui_attach', function() }, }, }) - -- No fast context for prompt message kinds - feed(':%s/Function/Replacement/c<cr>') - screen:expect({ - grid = [[ - ^E122: {10:Function} Foo already exists, add !| - to replace it | - replace with Replacement (y/n/a/q/l/^E/^| - Y)? | - {1:~ }| - ]], - cmdline = { { abort = false } }, - messages = { - { - content = { { 'replace with Replacement (y/n/a/q/l/^E/^Y)?', 6, 18 } }, - history = true, - kind = 'confirm_sub', - }, - }, - }) - feed('<esc>:call inputlist(["Select:", "One", "Two"])<cr>') - screen:expect({ - grid = [[ - E122: {10:Function} Foo already exists, add !| - to replace it | - Type number and <Enter> or click with th| - e mouse (q or empty cancels): | - {1:^~ }| - ]], - cmdline = { { abort = false } }, - messages = { - { - content = { { 'Select:\nOne\nTwo\n' } }, - history = false, - kind = 'list_cmd', - }, - { - content = { { 'Type number and <Enter> or click with the mouse (q or empty cancels): ' } }, - history = false, - kind = 'number_prompt', - }, - }, - }) end) end) diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 63764a9b6c..1f7d5525f3 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -1485,31 +1485,28 @@ describe('cmdheight=0', function() it('when substitute text', function() command('set cmdheight=0 noruler laststatus=3') feed('ifoo<ESC>') - screen:expect { - grid = [[ + screen:try_resize(screen._width, 6) + screen:expect([[ fo^o | - {1:~ }|*3 + {1:~ }|*4 {3:[No Name] [+] }| - ]], - } + ]]) feed(':%s/foo/bar/gc<CR>') - screen:expect { - grid = [[ + screen:expect([[ {2:foo} | - {1:~ }|*3 - {6:replace wi...q/l/^E/^Y)?}^ | - ]], - } + {3: }| + |*2 + {6:replace with bar (y/n/a/q}| + {6:/l/^E/^Y)?}^ | + ]]) feed('y') - screen:expect { - grid = [[ + screen:expect([[ ^bar | - {1:~ }|*3 + {1:~ }|*4 {3:[No Name] [+] }| - ]], - } + ]]) assert_alive() end) diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua index 90e0b3e380..98312c42c9 100644 --- a/test/functional/ui/input_spec.lua +++ b/test/functional/ui/input_spec.lua @@ -368,7 +368,7 @@ describe('input non-printable chars', function() "Xtest-overwrite" | {9:WARNING: The file has been changed since reading it!!!} | {6:Do you really want to write to it (y/n)?}u | - {6:Do you really want to write to it (y/n)?} | + {6:Do you really want to write to it (y/n)?}{18:^E} | {6:Do you really want to write to it (y/n)?}^ | ]]) @@ -379,7 +379,7 @@ describe('input non-printable chars', function() "Xtest-overwrite" | {9:WARNING: The file has been changed since reading it!!!} | {6:Do you really want to write to it (y/n)?}u | - {6:Do you really want to write to it (y/n)?} | + {6:Do you really want to write to it (y/n)?}{18:^E} | {6:Do you really want to write to it (y/n)?}n | {6:Press ENTER or type command to continue}^ | ]]) diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index 8acf8495c6..56b2c61fb8 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -42,55 +42,75 @@ describe('ui/ext_messages', function() it('msg_clear follows msg_show kind of confirm', function() feed('iline 1<esc>') feed(':call confirm("test")<cr>') - screen:expect { + screen:expect({ grid = [[ - line ^1 | - {1:~ }|*4 - ]], - cmdline = { { abort = false } }, + line ^1 | + {1:~ }|*4 + ]], + cmdline = { + { + content = { { '' } }, + hl_id = 10, + pos = 0, + prompt = '[O]k: ', + }, + }, messages = { { - content = { { '\ntest\n[O]k: ', 6, 10 } }, + content = { { '\ntest\n', 6, 10 } }, history = false, kind = 'confirm', }, }, - } - + }) feed('<cr>') - screen:expect { + screen:expect({ grid = [[ - line ^1 | - {1:~ }|*4 - ]], - } + line ^1 | + {1:~ }|*4 + ]], + cmdline = { { abort = false } }, + }) end) it('msg_show kinds', function() feed('iline 1\nline 2<esc>') - -- kind=confirm + -- confirm is now cmdline prompt feed(':echo confirm("test")<cr>') - screen:expect { + screen:expect({ grid = [[ - line 1 | - line ^2 | - {1:~ }|*3 - ]], - cmdline = { { abort = false } }, + line 1 | + line ^2 | + {1:~ }|*3 + ]], + cmdline = { + { + content = { { '' } }, + hl_id = 10, + pos = 0, + prompt = '[O]k: ', + }, + }, messages = { { - content = { { '\ntest\n[O]k: ', 6, 10 } }, + content = { { '\ntest\n', 6, 10 } }, history = false, kind = 'confirm', }, }, - } - feed('<cr><cr>') - screen:expect { + }) + feed('<cr>') + screen:expect({ + grid = [[ + line 1 | + line ^2 | + {1:~ }|*3 + ]], + cmdline = { { abort = false } }, messages = { { - content = { { '\ntest\n[O]k: ', 6, 10 } }, + content = { { '\ntest\n', 6, 10 } }, history = false, kind = 'confirm', }, @@ -105,38 +125,39 @@ describe('ui/ext_messages', function() kind = 'return_prompt', }, }, - } - feed('<cr><cr>') + }) + feed('<cr>') - -- kind=confirm_sub + -- :substitute confirm is now cmdline prompt feed(':%s/i/X/gc<cr>') - screen:expect { + screen:expect({ grid = [[ - l{2:i}ne 1 | - l{10:i}ne ^2 | - {1:~ }|*3 - ]], - cmdline = { { abort = false } }, - messages = { + l{2:^i}ne 1 | + l{10:i}ne 2 | + {1:~ }|*3 + ]], + cmdline = { { - content = { { 'replace with X (y/n/a/q/l/^E/^Y)?', 6, 18 } }, - history = true, - kind = 'confirm_sub', + content = { { '' } }, + hl_id = 18, + pos = 0, + prompt = 'replace with X (y/n/a/q/l/^E/^Y)?', }, }, - } + }) feed('nq') -- kind=wmsg (editing readonly file) command('write ' .. fname) command('set readonly nohls') feed('G$x') - screen:expect { + screen:expect({ grid = [[ line 1 | - line ^2 | + line^ | {1:~ }|*3 ]], + cmdline = { { abort = false } }, messages = { { content = { { 'W10: Warning: Changing a readonly file', 19, 26 } }, @@ -144,7 +165,7 @@ describe('ui/ext_messages', function() kind = 'wmsg', }, }, - } + }) -- kind=wmsg ('wrapscan' after search reaches EOF) feed('uG$/i<cr>') @@ -1122,57 +1143,57 @@ stack traceback: feed('z=') screen:expect({ grid = [[ - {100:helllo} | - {1:~ }|*3 - {1:^~ }| + {100:^helllo} | + {1:~ }|*4 ]], + cmdline = { + { + content = { { '' } }, + hl_id = 0, + pos = 0, + prompt = 'Type number and <Enter> or click with the mouse (q or empty cancels):', + }, + }, messages = { { content = { { 'Change "helllo" to:\n 1 "Hello"\n 2 "Hallo"\n 3 "Hullo"\n' } }, history = false, kind = 'list_cmd', }, - { - content = { { 'Type number and <Enter> or click with the mouse (q or empty cancels): ' } }, - history = false, - kind = 'number_prompt', - }, }, }) feed('1') screen:expect({ grid = [[ - {100:helllo} | - {1:~ }|*3 - {1:^~ }| + {100:^helllo} | + {1:~ }|*4 ]], + cmdline = { + { + content = { { '1' } }, + hl_id = 0, + pos = 1, + prompt = 'Type number and <Enter> or click with the mouse (q or empty cancels):', + }, + }, messages = { { content = { { 'Change "helllo" to:\n 1 "Hello"\n 2 "Hallo"\n 3 "Hullo"\n' } }, history = false, kind = 'list_cmd', }, - { - content = { { 'Type number and <Enter> or click with the mouse (q or empty cancels): ' } }, - history = false, - kind = 'number_prompt', - }, - { - content = { { '1' } }, - history = false, - kind = '', - }, }, }) feed('<cr>') - screen:expect { + screen:expect({ grid = [[ - ^Hello | - {1:~ }|*4 - ]], - } + ^Hello | + {1:~ }|*4 + ]], + cmdline = { { abort = false } }, + }) end) it('supports nvim_echo messages with multiple attrs', function() diff --git a/test/functional/vimscript/null_spec.lua b/test/functional/vimscript/null_spec.lua index 9a27239a6d..afd50f7cf9 100644 --- a/test/functional/vimscript/null_spec.lua +++ b/test/functional/vimscript/null_spec.lua @@ -116,7 +116,7 @@ describe('NULL', function() null_expr_test( 'is accepted as an empty list by inputlist()', '[feedkeys("\\n"), inputlist(L)]', - 'Type number and <Enter> or click with the mouse (q or empty cancels): ', + '', { 0, 0 } ) null_expr_test( diff --git a/test/old/testdir/test_spell.vim b/test/old/testdir/test_spell.vim index bdd8a673fd..a5ae653369 100644 --- a/test/old/testdir/test_spell.vim +++ b/test/old/testdir/test_spell.vim @@ -471,7 +471,9 @@ func Test_spellsuggest_option_number() \ .. "Change \"baord\" to:\n" \ .. " 1 \"board\"\n" \ .. " 2 \"bard\"\n" - \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a) + "\ Nvim: Prompt message is sent to cmdline prompt. + "\ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a) + \ , a) set spell spellsuggest=0 call assert_equal("\nSorry, no suggestions", execute('norm $z=')) @@ -509,7 +511,9 @@ func Test_spellsuggest_option_expr() \ .. " 1 \"BARD\"\n" \ .. " 2 \"BOARD\"\n" \ .. " 3 \"BROAD\"\n" - \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a) + "\ Nvim: Prompt message is sent to cmdline prompt. + "\ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a) + \ , a) " With verbose, z= should show the score i.e. word length with " our SpellSuggest() function. @@ -521,7 +525,9 @@ func Test_spellsuggest_option_expr() \ .. " 1 \"BARD\" (4 - 0)\n" \ .. " 2 \"BOARD\" (5 - 0)\n" \ .. " 3 \"BROAD\" (5 - 0)\n" - \ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a) + "\ Nvim: Prompt message is sent to cmdline prompt. + "\ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a) + \ , a) set spell& spellsuggest& verbose& bwipe! diff --git a/test/old/testdir/test_tagjump.vim b/test/old/testdir/test_tagjump.vim index 470c5c43b4..efc5e4cebe 100644 --- a/test/old/testdir/test_tagjump.vim +++ b/test/old/testdir/test_tagjump.vim @@ -1231,8 +1231,10 @@ func Test_tselect_listing() 2 FS v first Xfoo typeref:typename:char 2 -Type number and <Enter> (q or empty cancels): [DATA] +" Type number and <Enter> (q or empty cancels): +" Nvim: Prompt message is sent to cmdline prompt. + call assert_equal(expected, l) call delete('Xtags') |