aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/input_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
commitff7ed8f586589d620a806c3758fac4a47a8e7e15 (patch)
tree729bbcb92231538fa61dab6c3d890b025484b7f5 /test/functional/ui/input_spec.lua
parent376914f419eb08fdf4c1a63a77e1f035898a0f10 (diff)
parent28c04948a1c887a1cc0cb64de79fa32631700466 (diff)
downloadrneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.gz
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.bz2
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/ui/input_spec.lua')
-rw-r--r--test/functional/ui/input_spec.lua87
1 files changed, 37 insertions, 50 deletions
diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua
index b2899bf82d..f377939458 100644
--- a/test/functional/ui/input_spec.lua
+++ b/test/functional/ui/input_spec.lua
@@ -1,16 +1,18 @@
-local helpers = require('test.functional.helpers')(after_each)
-local clear, feed_command = helpers.clear, helpers.feed_command
-local feed, next_msg, eq = helpers.feed, helpers.next_msg, helpers.eq
-local command = helpers.command
-local expect = helpers.expect
-local curbuf_contents = helpers.curbuf_contents
-local api = helpers.api
-local exec_lua = helpers.exec_lua
-local write_file = helpers.write_file
-local fn = helpers.fn
-local eval = helpers.eval
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
+local clear, feed_command = n.clear, n.feed_command
+local feed, next_msg, eq = n.feed, n.next_msg, t.eq
+local command = n.command
+local expect = n.expect
+local curbuf_contents = n.curbuf_contents
+local api = n.api
+local exec_lua = n.exec_lua
+local write_file = t.write_file
+local fn = n.fn
+local eval = n.eval
+
before_each(clear)
describe('mappings', function()
@@ -280,21 +282,16 @@ end)
it('typing a simplifiable key at hit-enter prompt triggers mapping vim-patch:8.2.0839', function()
local screen = Screen.new(60, 8)
- screen:set_default_attr_ids({
- [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
- [2] = { bold = true, reverse = true }, -- MsgSeparator
- [3] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
- })
screen:attach()
command([[nnoremap <C-6> <Cmd>echo 'hit ctrl-6'<CR>]])
feed_command('ls')
screen:expect([[
|
{1:~ }|*3
- {2: }|
+ {3: }|
:ls |
1 %a "[No Name]" line 1 |
- {3:Press ENTER or type command to continue}^ |
+ {6:Press ENTER or type command to continue}^ |
]])
feed('<C-6>')
screen:expect([[
@@ -331,12 +328,6 @@ describe('input non-printable chars', function()
it("doesn't crash when echoing them back", function()
write_file('Xtest-overwrite', [[foobar]])
local screen = Screen.new(60, 8)
- screen:set_default_attr_ids {
- [1] = { bold = true, foreground = Screen.colors.Blue1 },
- [2] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
- [3] = { bold = true, foreground = Screen.colors.SeaGreen4 },
- [4] = { bold = true, reverse = true },
- }
screen:attach()
command('set shortmess-=F')
@@ -347,52 +338,52 @@ describe('input non-printable chars', function()
"Xtest-overwrite" [noeol] 1L, 6B |
]])
- -- The timestamp is in second resolution, wait two seconds to be sure.
- screen:sleep(2000)
+ -- Wait for some time so that the timestamp changes.
+ vim.uv.sleep(10)
write_file('Xtest-overwrite', [[smurf]])
feed_command('w')
screen:expect([[
foobar |
{1:~ }|*3
- {4: }|
+ {3: }|
"Xtest-overwrite" |
- {2:WARNING: The file has been changed since reading it!!!} |
- {3:Do you really want to write to it (y/n)?}^ |
+ {9:WARNING: The file has been changed since reading it!!!} |
+ {6:Do you really want to write to it (y/n)?}^ |
]])
feed('u')
screen:expect([[
foobar |
{1:~ }|*2
- {4: }|
+ {3: }|
"Xtest-overwrite" |
- {2:WARNING: The file has been changed since reading it!!!} |
- {3:Do you really want to write to it (y/n)?}u |
- {3:Do you really want to write to it (y/n)?}^ |
+ {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)?}^ |
]])
feed('\005')
screen:expect([[
foobar |
{1:~ }|
- {4: }|
+ {3: }|
"Xtest-overwrite" |
- {2:WARNING: The file has been changed since reading it!!!} |
- {3:Do you really want to write to it (y/n)?}u |
- {3:Do you really want to write to it (y/n)?} |
- {3:Do you really want to write to it (y/n)?}^ |
+ {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)?}^ |
]])
feed('n')
screen:expect([[
foobar |
- {4: }|
+ {3: }|
"Xtest-overwrite" |
- {2:WARNING: The file has been changed since reading it!!!} |
- {3:Do you really want to write to it (y/n)?}u |
- {3:Do you really want to write to it (y/n)?} |
- {3:Do you really want to write to it (y/n)?}n |
- {3:Press ENTER or type command to continue}^ |
+ {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)?}n |
+ {6:Press ENTER or type command to continue}^ |
]])
feed('<cr>')
@@ -437,10 +428,6 @@ describe('display is updated', function()
local screen
before_each(function()
screen = Screen.new(60, 8)
- screen:set_default_attr_ids({
- [1] = { bold = true, foreground = Screen.colors.Blue1 }, -- NonText
- [2] = { bold = true }, -- ModeMsg
- })
screen:attach()
end)
@@ -452,7 +439,7 @@ describe('display is updated', function()
abc |
^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]])
end)
@@ -464,7 +451,7 @@ describe('display is updated', function()
abc |
^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]])
end)
end)