aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/api/vim_spec.lua6
-rw-r--r--test/functional/eval/execute_spec.lua10
-rw-r--r--test/functional/ex_cmds/bang_filter_spec.lua44
-rw-r--r--test/functional/fixtures/shell_data.txtbin0 -> 50 bytes
-rw-r--r--test/functional/ui/bufhl_spec.lua15
-rw-r--r--test/functional/ui/output_spec.lua4
6 files changed, 48 insertions, 31 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index a92acd36b1..0a0cb2e91c 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -15,6 +15,7 @@ local command = helpers.command
local intchar2lua = global_helpers.intchar2lua
local format_string = global_helpers.format_string
local mergedicts_copy = global_helpers.mergedicts_copy
+local uname = global_helpers.uname
describe('api', function()
before_each(clear)
@@ -99,8 +100,9 @@ describe('api', function()
[[echo nvim_command_output('echo "nested1\nnested2"') | ls]]))
end)
- it('does not return shell |:!| output', function()
- eq(':!echo "foo"\r\n', nvim('command_output', [[!echo "foo"]]))
+ it('returns shell |:!| output', function()
+ local win_lf = (uname() == 'Windows' and '\r') or ''
+ eq(':!echo foo\r\n\nfoo'..win_lf..'\n', nvim('command_output', [[!echo foo]]))
end)
it("parse error: fails (specific error), does NOT update v:errmsg", function()
diff --git a/test/functional/eval/execute_spec.lua b/test/functional/eval/execute_spec.lua
index 91966ed3dd..c866359520 100644
--- a/test/functional/eval/execute_spec.lua
+++ b/test/functional/eval/execute_spec.lua
@@ -1,4 +1,5 @@
local helpers = require('test.functional.helpers')(after_each)
+local global_helpers = require('test.helpers')
local eq = helpers.eq
local eval = helpers.eval
local clear = helpers.clear
@@ -9,6 +10,7 @@ local funcs = helpers.funcs
local Screen = require('test.functional.ui.screen')
local command = helpers.command
local feed = helpers.feed
+local uname = global_helpers.uname
describe('execute()', function()
before_each(clear)
@@ -118,9 +120,11 @@ describe('execute()', function()
feed('<CR>')
end)
- -- This matches Vim behavior.
- it('does not capture shell-command output', function()
- eq('\n:!echo "foo"\13\n', funcs.execute('!echo "foo"'))
+ -- This deviates from vim behavior, but is consistent
+ -- with how nvim currently displays the output.
+ it('does capture shell-command output', function()
+ local win_lf = (uname() == 'Windows' and '\13') or ''
+ eq('\n:!echo foo\r\n\nfoo'..win_lf..'\n', funcs.execute('!echo foo'))
end)
describe('{silent} argument', function()
diff --git a/test/functional/ex_cmds/bang_filter_spec.lua b/test/functional/ex_cmds/bang_filter_spec.lua
index aaec983b73..636d732161 100644
--- a/test/functional/ex_cmds/bang_filter_spec.lua
+++ b/test/functional/ex_cmds/bang_filter_spec.lua
@@ -3,13 +3,14 @@
local helpers = require('test.functional.helpers')(after_each)
local feed, command, clear = helpers.feed, helpers.command, helpers.clear
local mkdir, write_file, rmdir = helpers.mkdir, helpers.write_file, helpers.rmdir
+local feed_command = helpers.feed_command
if helpers.pending_win32(pending) then return end
local Screen = require('test.functional.ui.screen')
-describe('issues', function()
+describe(':! command', function()
local screen
before_each(function()
@@ -19,7 +20,12 @@ describe('issues', function()
write_file('bang_filter_spec/f1', 'f1')
write_file('bang_filter_spec/f2', 'f2')
write_file('bang_filter_spec/f3', 'f3')
- screen = Screen.new()
+ 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)
@@ -27,25 +33,37 @@ describe('issues', function()
rmdir('bang_filter_spec')
end)
- it('#3269 Last line of shell output is not truncated', function()
+ it("doesn't truncate Last line of shell output #3269", function()
command([[nnoremap <silent>\l :!ls bang_filter_spec<cr>]])
feed([[\l]])
screen:expect([[
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
:!ls bang_filter_spec |
- |
f1 |
f2 |
f3 |
- Press ENTER or type command to continue^ |
+ |
+ {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:expect([[
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :!cat test/functional/fixtures/shell_data.txt |
+ {2:^@^A^B^C^D^E^F^G^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}^ |
+ ]])
+ end)
+
end)
diff --git a/test/functional/fixtures/shell_data.txt b/test/functional/fixtures/shell_data.txt
new file mode 100644
index 0000000000..ef3506c5b1
--- /dev/null
+++ b/test/functional/fixtures/shell_data.txt
Binary files differ
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua
index 091c45596d..5b38921e50 100644
--- a/test/functional/ui/bufhl_spec.lua
+++ b/test/functional/ui/bufhl_spec.lua
@@ -2,11 +2,11 @@ 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 command, request, neq = helpers.command, helpers.request, helpers.neq
+local command, neq = helpers.command, helpers.neq
+local curbufmeths = helpers.curbufmeths
describe('Buffer highlighting', function()
local screen
- local curbuf
before_each(function()
clear()
@@ -25,21 +25,14 @@ describe('Buffer highlighting', function()
[9] = {foreground = Screen.colors.SlateBlue, underline = true},
[10] = {foreground = Screen.colors.Red}
})
- curbuf = request('nvim_get_current_buf')
end)
after_each(function()
screen:detach()
end)
- local function add_hl(...)
- return request('nvim_buf_add_highlight', curbuf, ...)
- end
-
- local function clear_hl(...)
- return request('nvim_buf_clear_highlight', curbuf, ...)
- end
-
+ local add_hl = curbufmeths.add_highlight
+ local clear_hl = curbufmeths.clear_highlight
it('works', function()
insert([[
diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua
index c6d564e8dc..da3f474e08 100644
--- a/test/functional/ui/output_spec.lua
+++ b/test/functional/ui/output_spec.lua
@@ -33,8 +33,8 @@ describe("shell command :!", function()
{4:~ }|
{4:~ }|
{4:~ }|
+ {4:~ }|
:!printf foo; sleep 200 |
- |
foo |
{3:-- TERMINAL --} |
]])
@@ -56,11 +56,11 @@ describe("shell command :!", function()
-- Final chunk of output should always be displayed, never skipped.
-- (Throttling is non-deterministic, this test is merely a sanity check.)
screen:expect([[
- XXXXXXXXXX 2996 |
XXXXXXXXXX 2997 |
XXXXXXXXXX 2998 |
XXXXXXXXXX 2999 |
XXXXXXXXXX 3000 |
+ |
{10:Press ENTER or type command to continue}{1: } |
{3:-- TERMINAL --} |
]])