aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/input_spec.lua
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2018-03-28 21:52:06 -0400
committerJames McCoy <jamessan@jamessan.com>2018-03-28 21:54:39 -0400
commit79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1 (patch)
tree4e0589d75801f3ff6a9678f84f5009102766661e /test/functional/ui/input_spec.lua
parent4403864da3c48412595d439f36458d1e6ccfc49f (diff)
parent3f3de9b1a95d273463a87516365510dbffcaf3d2 (diff)
downloadrneovim-79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1.tar.gz
rneovim-79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1.tar.bz2
rneovim-79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1.zip
Merge branch 'master' into yagebu/option-fixes
Diffstat (limited to 'test/functional/ui/input_spec.lua')
-rw-r--r--test/functional/ui/input_spec.lua96
1 files changed, 92 insertions, 4 deletions
diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua
index 29d974b709..8e62a37ef1 100644
--- a/test/functional/ui/input_spec.lua
+++ b/test/functional/ui/input_spec.lua
@@ -1,11 +1,10 @@
local helpers = require('test.functional.helpers')(after_each)
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 feed, next_msg, eq = helpers.feed, helpers.next_msg, helpers.eq
local expect = helpers.expect
+local write_file = helpers.write_file
local Screen = require('test.functional.ui.screen')
-if helpers.pending_win32(pending) then return end
-
describe('mappings', function()
local cid
@@ -17,7 +16,7 @@ describe('mappings', function()
local check_mapping = function(mapping, expected)
feed(mapping)
- eq({'notification', 'mapped', {expected}}, next_message())
+ eq({'notification', 'mapped', {expected}}, next_msg())
end
before_each(function()
@@ -126,3 +125,92 @@ describe('input utf sequences that contain CSI/K_SPECIAL', function()
expect('…')
end)
end)
+
+describe('input non-printable chars', function()
+ it("doesn't crash when echoing them back", function()
+ write_file("Xtest-overwrite", [[foobar]])
+ clear()
+ 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}
+ })
+ screen:attach()
+
+ feed_command("e Xtest-overwrite")
+ screen:expect([[
+ ^foobar |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ "Xtest-overwrite" [noeol] 1L, 6C |
+ ]])
+
+ -- The timestamp is in second resolution, wait two seconds to be sure.
+ screen:sleep(2000)
+ write_file("Xtest-overwrite", [[smurf]])
+ feed_command("w")
+ screen:expect([[
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ "Xtest-overwrite" |
+ {2:WARNING: The file has been changed since reading it!!!} |
+ {3:Do you really want to write to it (y/n)?}^ |
+ ]])
+
+ feed("u")
+ screen:expect([[
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ "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)?}^ |
+ ]])
+
+ feed("\005")
+ screen:expect([[
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ "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)?}^ |
+ ]])
+
+ feed("n")
+ screen:expect([[
+ {1:~ }|
+ {1:~ }|
+ "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}^ |
+ ]])
+
+ feed("<cr>")
+ screen:expect([[
+ ^foobar |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end)
+end)