aboutsummaryrefslogtreecommitdiff
path: root/test/functional/terminal
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/terminal')
-rw-r--r--test/functional/terminal/buffer_spec.lua8
-rw-r--r--test/functional/terminal/ex_terminal_spec.lua2
-rw-r--r--test/functional/terminal/scrollback_spec.lua26
-rw-r--r--test/functional/terminal/tui_spec.lua35
-rw-r--r--test/functional/terminal/window_split_tab_spec.lua22
5 files changed, 58 insertions, 35 deletions
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua
index c290031fbe..4d6b125f9f 100644
--- a/test/functional/terminal/buffer_spec.lua
+++ b/test/functional/terminal/buffer_spec.lua
@@ -207,18 +207,18 @@ describe('terminal buffer', function()
feed_command('terminal')
feed('<c-\\><c-n>')
feed_command('confirm bdelete')
- screen:expect('Close "term://', nil, true, nil, true)
+ screen:expect{any='Close "term://', attr_ignore=true}
end)
it('with &confirm', function()
feed_command('terminal')
feed('<c-\\><c-n>')
feed_command('bdelete')
- screen:expect('E89', nil, true, nil, true)
+ screen:expect{any='E89', attr_ignore=true}
feed('<cr>')
eq('terminal', eval('&buftype'))
feed_command('set confirm | bdelete')
- screen:expect('Close "term://', nil, true, nil, true)
+ screen:expect{any='Close "term://', attr_ignore=true}
feed('y')
neq('terminal', eval('&buftype'))
end)
@@ -242,7 +242,7 @@ describe('No heap-buffer-overflow when using', function()
feed('$')
-- Let termopen() modify the buffer
feed_command('call termopen("echo")')
- wait()
+ eq(2, eval('1+1')) -- check nvim still running
feed_command('bdelete!')
end)
end)
diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua
index f98add41a0..dbee9bdb49 100644
--- a/test/functional/terminal/ex_terminal_spec.lua
+++ b/test/functional/terminal/ex_terminal_spec.lua
@@ -54,7 +54,7 @@ describe(':terminal', function()
else
feed_command([[terminal printf '\e[6n'; sleep 0.5 ]])
end
- screen:expect('%^%[%[1;1R', nil, nil, nil, true)
+ screen:expect{any='%^%[%[1;1R'}
end)
it("in normal-mode :split does not move cursor", function()
diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua
index c665e64a80..1c97441213 100644
--- a/test/functional/terminal/scrollback_spec.lua
+++ b/test/functional/terminal/scrollback_spec.lua
@@ -396,19 +396,18 @@ describe("'scrollback' option", function()
it('set to 0 behaves as 1', function()
local screen
if iswin() then
- screen = thelpers.screen_setup(nil,
- "['powershell.exe', '-NoLogo', '-NoProfile', '-NoExit', '-Command', 'function global:prompt {return "..'"$"'.."}']", 30)
+ screen = thelpers.screen_setup(nil, "['cmd.exe']", 30)
else
screen = thelpers.screen_setup(nil, "['sh']", 30)
end
curbufmeths.set_option('scrollback', 0)
if iswin() then
- feed_data('for($i=1;$i -le 30;$i++){Write-Host \"line$i\"}\r')
+ feed_data('for /L %I in (1,1,30) do @(echo line%I)\r')
else
feed_data('for i in $(seq 1 30); do echo "line$i"; done\n')
end
- screen:expect('line30 ', nil, nil, nil, true)
+ screen:expect{any='line30 '}
retry(nil, nil, function() expect_lines(7) end)
screen:detach()
@@ -417,8 +416,8 @@ describe("'scrollback' option", function()
it('deletes lines (only) if necessary', function()
local screen
if iswin() then
- screen = thelpers.screen_setup(nil,
- "['powershell.exe', '-NoLogo', '-NoProfile', '-NoExit', '-Command', 'function global:prompt {return "..'"$"'.."}']", 30)
+ command([[let $PROMPT='$$']])
+ screen = thelpers.screen_setup(nil, "['cmd.exe']", 30)
else
screen = thelpers.screen_setup(nil, "['sh']", 30)
end
@@ -426,16 +425,15 @@ describe("'scrollback' option", function()
curbufmeths.set_option('scrollback', 200)
-- Wait for prompt.
- screen:expect('$', nil, nil, nil, true)
+ screen:expect{any='%$'}
- wait()
if iswin() then
- feed_data('for($i=1;$i -le 30;$i++){Write-Host \"line$i\"}\r')
+ feed_data('for /L %I in (1,1,30) do @(echo line%I)\r')
else
feed_data('for i in $(seq 1 30); do echo "line$i"; done\n')
end
- screen:expect('line30 ', nil, nil, nil, true)
+ screen:expect{any='line30 '}
retry(nil, nil, function() expect_lines(33, 2) end)
curbufmeths.set_option('scrollback', 10)
@@ -447,17 +445,17 @@ describe("'scrollback' option", function()
-- 'scrollback' option is synchronized with the internal sb_buffer.
command('sleep 100m')
if iswin() then
- feed_data('for($i=1;$i -le 40;$i++){Write-Host \"line$i\"}\r')
+ feed_data('for /L %I in (1,1,40) do @(echo line%I)\r')
else
feed_data('for i in $(seq 1 40); do echo "line$i"; done\n')
end
- screen:expect('line40 ', nil, nil, nil, true)
+ screen:expect{any='line40 '}
retry(nil, nil, function() expect_lines(58) end)
-- Verify off-screen state
- eq('line35', eval("getline(line('w0') - 1)"))
- eq('line26', eval("getline(line('w0') - 10)"))
+ eq((iswin() and 'line36' or 'line35'), eval("getline(line('w0') - 1)"))
+ eq((iswin() and 'line27' or 'line26'), eval("getline(line('w0') - 10)"))
screen:detach()
end)
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index 5603224975..365bd2a0be 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -17,7 +17,6 @@ local nvim_prog = helpers.nvim_prog
local nvim_set = helpers.nvim_set
local ok = helpers.ok
local read_file = helpers.read_file
-local wait = helpers.wait
if helpers.pending_win32(pending) then return end
@@ -207,7 +206,7 @@ describe('tui', function()
screen:set_default_attr_ids({
[1] = {reverse = true},
[2] = {foreground = 13, special = Screen.colors.Grey0},
- [3] = {special = Screen.colors.Grey0, bold = true, reverse = true},
+ [3] = {bold = true, reverse = true, special = Screen.colors.Grey0},
[4] = {bold = true},
[5] = {special = Screen.colors.Grey0, reverse = true, foreground = 4},
[6] = {foreground = 4, special = Screen.colors.Grey0},
@@ -257,11 +256,11 @@ describe('tui', function()
it('shows up in nvim_list_uis', function()
feed_data(':echo map(nvim_list_uis(), {k,v -> sort(items(v))})\013')
screen:expect([=[
- {5: }|
- [[['ext_cmdline', v:false], ['ext_popupmenu', v:fa|
- lse], ['ext_tabline', v:false], ['ext_wildmenu', v|
- :false], ['height', 6], ['rgb', v:false], ['width'|
- , 50]]] |
+ [[['ext_cmdline', v:false], ['ext_hlstate', v:fals|
+ e], ['ext_linegrid', v:true], ['ext_popupmenu', v:|
+ false], ['ext_tabline', v:false], ['ext_wildmenu',|
+ v:false], ['height', 6], ['rgb', v:false], ['widt|
+ h', 50]]] |
{10:Press ENTER or type command to continue}{1: } |
{3:-- TERMINAL --} |
]=])
@@ -371,7 +370,7 @@ describe('tui FocusGained/FocusLost', function()
{3:-- TERMINAL --} |
]])
feed_data('\027[O')
- screen:expect([[
+ screen:expect{grid=[[
|
{4:~ }|
{4:~ }|
@@ -379,7 +378,7 @@ describe('tui FocusGained/FocusLost', function()
{5:[No Name] }|
:{1: } |
{3:-- TERMINAL --} |
- ]])
+ ]], unchanged=true}
end)
it('in cmdline-mode', function()
@@ -400,7 +399,7 @@ describe('tui FocusGained/FocusLost', function()
-- Exit cmdline-mode. Redraws from timers/events are blocked during
-- cmdline-mode, so the buffer won't be updated until we exit cmdline-mode.
feed_data('\n')
- screen:expect('lost'..(' '):rep(46)..'\ngained', nil, nil, nil, true)
+ screen:expect{any='lost'..(' '):rep(46)..'\ngained'}
end)
end)
@@ -473,14 +472,24 @@ describe("tui 't_Co' (terminal colors)", function()
nvim_prog,
nvim_set))
- feed_data(":echo &t_Co\n")
- wait()
local tline
if maxcolors == 8 or maxcolors == 16 then
tline = "~ "
else
tline = "{4:~ }"
end
+
+ screen:expect(string.format([[
+ {1: } |
+ %s|
+ %s|
+ %s|
+ %s|
+ |
+ {3:-- TERMINAL --} |
+ ]], tline, tline, tline, tline))
+
+ feed_data(":echo &t_Co\n")
screen:expect(string.format([[
{1: } |
%s|
@@ -740,7 +749,7 @@ describe("tui 'term' option", function()
screen.timeout = 250 -- We want screen:expect() to fail quickly.
retry(nil, 2 * full_timeout, function() -- Wait for TUI thread to set 'term'.
feed_data(":echo 'term='.(&term)\n")
- screen:expect('term='..term_expected, nil, nil, nil, true)
+ screen:expect{any='term='..term_expected}
end)
end
diff --git a/test/functional/terminal/window_split_tab_spec.lua b/test/functional/terminal/window_split_tab_spec.lua
index 714c2476ce..fecffe3295 100644
--- a/test/functional/terminal/window_split_tab_spec.lua
+++ b/test/functional/terminal/window_split_tab_spec.lua
@@ -6,6 +6,8 @@ local feed_command = helpers.feed_command
local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
+local iswin = helpers.iswin
+local retry = helpers.retry
describe('terminal', function()
local screen
@@ -66,8 +68,22 @@ describe('terminal', function()
end)
it('forwards resize request to the program', function()
- feed([[<C-\><C-N>:]]) -- Go to cmdline-mode, so cursor is at bottom.
- screen:try_resize(screen._width - 3, screen._height - 2)
+ feed([[<C-\><C-N>G:]]) -- Go to cmdline-mode, so cursor is at bottom.
+ local w1, h1 = screen._width - 3, screen._height - 2
+ local w2, h2 = w1 - 6, h1 - 3
+
+ if iswin() then
+ -- win: SIGWINCH is unreliable, use a weaker test. #7506
+ retry(3, 30000, function()
+ screen:try_resize(w1, h1)
+ screen:expect{any='rows: 7, cols: 47'}
+ screen:try_resize(w2, h2)
+ screen:expect{any='rows: 4, cols: 41'}
+ end)
+ return
+ end
+
+ screen:try_resize(w1, h1)
screen:expect([[
tty ready |
rows: 7, cols: 47 |
@@ -78,7 +94,7 @@ describe('terminal', function()
|
:^ |
]])
- screen:try_resize(screen._width - 6, screen._height - 3)
+ screen:try_resize(w2, h2)
screen:expect([[
tty ready |
rows: 7, cols: 47 |