aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2018-02-10 22:30:49 +0100
committerGitHub <noreply@github.com>2018-02-10 22:30:49 +0100
commit34b99bc06b1e836f3a9bdfc25d55ff0661049007 (patch)
treed5dd1064427ae89c48b2ce1f37bcdbd40553132b /test/functional/ui
parenta6052c7307414045fbe2f55cd0c6a5017eb9f68e (diff)
parentc03a847884c017a78e099beaa1b252e5f940c8e0 (diff)
downloadrneovim-34b99bc06b1e836f3a9bdfc25d55ff0661049007.tar.gz
rneovim-34b99bc06b1e836f3a9bdfc25d55ff0661049007.tar.bz2
rneovim-34b99bc06b1e836f3a9bdfc25d55ff0661049007.zip
Merge pull request #7979 from bfredl/shellbell
Shell: support bell and buffer incomplete UTF-8 sequences
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/output_spec.lua121
1 files changed, 108 insertions, 13 deletions
diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua
index c42c0b26c6..4246020fab 100644
--- a/test/functional/ui/output_spec.lua
+++ b/test/functional/ui/output_spec.lua
@@ -1,19 +1,24 @@
local Screen = require('test.functional.ui.screen')
-local session = require('test.functional.helpers')(after_each)
+local helpers = require('test.functional.helpers')(after_each)
local child_session = require('test.functional.terminal.helpers')
-local eq = session.eq
-local eval = session.eval
-local feed = session.feed
-local iswin = session.iswin
+local mkdir, write_file, rmdir = helpers.mkdir, helpers.write_file, helpers.rmdir
+local eq = helpers.eq
+local eval = helpers.eval
+local feed = helpers.feed
+local feed_command = helpers.feed_command
+local iswin = helpers.iswin
+local clear = helpers.clear
+local command = helpers.command
+local nvim_dir = helpers.nvim_dir
describe("shell command :!", function()
- if session.pending_win32(pending) then return end
+ if helpers.pending_win32(pending) then return end
local screen
before_each(function()
- session.clear()
- screen = child_session.screen_setup(0, '["'..session.nvim_prog..
- '", "-u", "NONE", "-i", "NONE", "--cmd", "'..session.nvim_set..'"]')
+ clear()
+ screen = child_session.screen_setup(0, '["'..helpers.nvim_prog..
+ '", "-u", "NONE", "-i", "NONE", "--cmd", "'..helpers.nvim_set..'"]')
screen:expect([[
{1: } |
{4:~ }|
@@ -46,7 +51,7 @@ describe("shell command :!", function()
end)
it("throttles shell-command output greater than ~10KB", function()
- if os.getenv("TRAVIS") and session.os_name() == "osx" then
+ if os.getenv("TRAVIS") and helpers.os_name() == "osx" then
pending("[Unreliable on Travis macOS.]", function() end)
return
end
@@ -74,7 +79,7 @@ end)
describe("shell command :!", function()
before_each(function()
- session.clear()
+ clear()
end)
it("cat a binary file #4142", function()
@@ -104,13 +109,16 @@ describe("shell command :!", function()
]])
feed([[<CR>]])
-- Print BELL control code. #4338
+ screen.bell = false
feed([[:!printf '\x07\x07\x07\x07text'<CR>]])
screen:expect([[
~ |
:!printf '\x07\x07\x07\x07text' |
- ^G^G^G^Gtext |
+ text |
Press ENTER or type command to continue^ |
- ]])
+ ]], nil, nil, function()
+ eq(true, screen.bell)
+ end)
feed([[<CR>]])
-- Print BS control code.
feed([[:echo system('printf ''\x08\n''')<CR>]])
@@ -131,4 +139,91 @@ describe("shell command :!", function()
]])
feed([[<CR>]])
end)
+
+ describe('', function()
+ local screen
+ before_each(function()
+ rmdir('bang_filter_spec')
+ mkdir('bang_filter_spec')
+ write_file('bang_filter_spec/f1', 'f1')
+ write_file('bang_filter_spec/f2', 'f2')
+ write_file('bang_filter_spec/f3', 'f3')
+ screen = Screen.new(53,10)
+ screen:set_default_attr_ids({
+ [1] = {bold = true, foreground = Screen.colors.Blue1},
+ [2] = {foreground = Screen.colors.Blue1},
+ [3] = {bold = true, foreground = Screen.colors.SeaGreen4},
+ })
+ screen:attach()
+ end)
+
+ after_each(function()
+ rmdir('bang_filter_spec')
+ end)
+
+ it("doesn't truncate Last line of shell output #3269", function()
+ command(helpers.iswin()
+ and [[nnoremap <silent>\l :!dir /b bang_filter_spec<cr>]]
+ or [[nnoremap <silent>\l :!ls bang_filter_spec<cr>]])
+ local result = (helpers.iswin()
+ and [[:!dir /b bang_filter_spec]]
+ or [[:!ls bang_filter_spec ]])
+ feed([[\l]])
+ screen:expect([[
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]..result..[[ |
+ f1 |
+ f2 |
+ f3 |
+ |
+ {3:Press ENTER or type command to continue}^ |
+ ]])
+ end)
+
+ it('handles binary and multibyte data', function()
+ feed_command('!cat test/functional/fixtures/shell_data.txt')
+ screen.bell = false
+ screen:expect([[
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :!cat test/functional/fixtures/shell_data.txt |
+ {2:^@^A^B^C^D^E^F^H} |
+ {2:^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_} |
+ ö 한글 {2:<a5><c3>} |
+ t {2:<ff>} |
+ |
+ {3:Press ENTER or type command to continue}^ |
+ ]], nil, nil, function()
+ eq(true, screen.bell)
+ end)
+ end)
+
+ it('handles multibyte sequences split over buffer boundaries', function()
+ command('cd '..nvim_dir)
+ local cmd
+ if iswin() then
+ cmd = '!shell-test UTF-8 '
+ else
+ cmd = '!./shell-test UTF-8'
+ end
+ feed_command(cmd)
+ -- Note: only the first example of split composed char works
+ screen:expect([[
+ {1:~ }|
+ {1:~ }|
+ :]]..cmd..[[ |
+ å |
+ ref: å̲ |
+ 1: å̲ |
+ 2: å ̲ |
+ 3: å ̲ |
+ |
+ {3:Press ENTER or type command to continue}^ |
+ ]])
+ end)
+ end)
end)