mirror of
https://github.com/neovim/neovim.git
synced 2026-04-02 13:49:27 +00:00
test(tui_spec): unskip a few more tests on Windows (#38618)
This commit is contained in:
@@ -136,18 +136,16 @@ describe('TUI :detach', function()
|
||||
'--cmd',
|
||||
nvim_set .. ' laststatus=2 background=dark',
|
||||
}, job_opts)
|
||||
tt.override_screen_expect_for_conpty(screen)
|
||||
|
||||
tt.feed_data('iHello, World')
|
||||
tt.screen_expect(
|
||||
screen,
|
||||
[[
|
||||
screen:expect([[
|
||||
Hello, World^ |
|
||||
{100:~ }|*3
|
||||
{3:[No Name] [+] }|
|
||||
{5:-- INSERT --} |
|
||||
{5:-- TERMINAL --} |
|
||||
]]
|
||||
)
|
||||
]])
|
||||
|
||||
local child_session = n.connect(child_server)
|
||||
finally(function()
|
||||
@@ -196,16 +194,13 @@ describe('TUI :detach', function()
|
||||
child_server,
|
||||
}, job_opts)
|
||||
|
||||
tt.screen_expect(
|
||||
screen_reattached,
|
||||
[[
|
||||
screen_reattached:expect([[
|
||||
We did it, pooky^. |
|
||||
{100:~ }|*3
|
||||
{3:[No Name] [+] }|
|
||||
|
|
||||
{5:-- TERMINAL --} |
|
||||
]]
|
||||
)
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -236,10 +231,6 @@ describe('TUI :restart', function()
|
||||
-- 'echo getpid()',
|
||||
}, { env = env_notermguicolors })
|
||||
|
||||
local function screen_expect(s)
|
||||
tt.screen_expect(screen, s)
|
||||
end
|
||||
|
||||
-- The value of has("gui_running") should be 0 before and after :restart.
|
||||
local function assert_no_gui_running()
|
||||
tt.feed_data(':echo "GUI Running: " .. has("gui_running")\013')
|
||||
@@ -288,13 +279,13 @@ describe('TUI :restart', function()
|
||||
tt.feed_data(':set nomodified\013')
|
||||
-- Command is run on new server.
|
||||
tt.feed_data(":restart put ='Hello1'\013")
|
||||
screen_expect(s1)
|
||||
screen:expect(s1)
|
||||
assert_new_pid()
|
||||
assert_no_gui_running()
|
||||
|
||||
-- Complex command following +cmd.
|
||||
tt.feed_data(":restart +qall! put ='Hello2' | put ='World2'\013")
|
||||
screen_expect([[
|
||||
screen:expect([[
|
||||
|
|
||||
Hello2 |
|
||||
^World2 |
|
||||
@@ -309,13 +300,13 @@ describe('TUI :restart', function()
|
||||
-- Check ":restart" on an unmodified buffer.
|
||||
tt.feed_data(':set nomodified\013')
|
||||
tt.feed_data(':restart\013')
|
||||
screen_expect(s0)
|
||||
screen:expect(s0)
|
||||
assert_new_pid()
|
||||
assert_no_gui_running()
|
||||
|
||||
-- Check ":restart +qall!" on an unmodified buffer.
|
||||
tt.feed_data(':restart +qall!\013')
|
||||
screen_expect(s0)
|
||||
screen:expect(s0)
|
||||
assert_new_pid()
|
||||
assert_no_gui_running()
|
||||
|
||||
@@ -324,13 +315,7 @@ describe('TUI :restart', function()
|
||||
screen:expect({ any = vim.pesc('+cmd did not quit the server') })
|
||||
|
||||
tt.feed_data('ithis will be removed\027')
|
||||
screen_expect([[
|
||||
this will be remove^d |
|
||||
{100:~ }|*3
|
||||
{3:[No Name] [+] }|
|
||||
|
|
||||
{5:-- TERMINAL --} |
|
||||
]])
|
||||
screen:expect({ any = vim.pesc('this will be remove^d') })
|
||||
|
||||
-- Check ":confirm restart" on a modified buffer.
|
||||
tt.feed_data(':confirm restart\013')
|
||||
@@ -368,18 +353,18 @@ describe('TUI :restart', function()
|
||||
-- Check ":restart +qall!" on a modified buffer.
|
||||
tt.feed_data('ithis will be removed\027')
|
||||
tt.feed_data(':restart +qall!\013')
|
||||
screen_expect(s0)
|
||||
screen:expect(s0)
|
||||
assert_new_pid()
|
||||
assert_no_gui_running()
|
||||
|
||||
-- No --listen conflict when server exit is delayed.
|
||||
feed_data(':lua vim.schedule(function() vim.wait(100) end); vim.cmd.restart()\n')
|
||||
screen_expect(s0)
|
||||
screen:expect(s0)
|
||||
assert_new_pid()
|
||||
assert_no_gui_running()
|
||||
|
||||
screen:try_resize(60, 6)
|
||||
screen_expect([[
|
||||
screen:expect([[
|
||||
^ |
|
||||
{100:~ }|*2
|
||||
{3:[No Name] }|
|
||||
@@ -389,7 +374,7 @@ describe('TUI :restart', function()
|
||||
|
||||
--- Check that ":restart" uses the updated size after terminal resize.
|
||||
tt.feed_data(':restart echo "restarted"\013')
|
||||
screen_expect([[
|
||||
screen:expect([[
|
||||
^ |
|
||||
{100:~ }|*2
|
||||
{3:[No Name] }|
|
||||
@@ -750,7 +735,7 @@ describe('TUI', function()
|
||||
end)
|
||||
|
||||
it('accepts resize while pager is active', function()
|
||||
t.skip(is_os('win'), 'FIXME: some spaces have wrong attrs on Windows')
|
||||
tt.override_screen_expect_for_conpty(screen)
|
||||
child_session:request(
|
||||
'nvim_exec2',
|
||||
[[
|
||||
@@ -2035,7 +2020,7 @@ describe('TUI', function()
|
||||
end)
|
||||
|
||||
it("paste: 'nomodifiable' buffer", function()
|
||||
t.skip(is_os('win'), 'FIXME: some spaces have wrong attrs on Windows')
|
||||
tt.override_screen_expect_for_conpty(screen)
|
||||
child_exec_lua([[
|
||||
vim.bo.modifiable = false
|
||||
-- Truncate the error message to hide the line number
|
||||
@@ -2246,7 +2231,7 @@ describe('TUI', function()
|
||||
end)
|
||||
|
||||
it('allows termguicolors to be set at runtime', function()
|
||||
t.skip(is_os('win'), 'FIXME: some spaces have wrong attrs on Windows')
|
||||
tt.override_screen_expect_for_conpty(screen)
|
||||
screen:set_option('rgb', true)
|
||||
feed_data(':hi SpecialKey ctermfg=3 guifg=SeaGreen\n')
|
||||
feed_data('i')
|
||||
@@ -2436,7 +2421,7 @@ describe('TUI', function()
|
||||
end)
|
||||
|
||||
it('allows grid to assume wider ambiwidth chars than host terminal', function()
|
||||
t.skip(is_os('win'), 'FIXME: some spaces have wrong attrs on Windows')
|
||||
tt.override_screen_expect_for_conpty(screen)
|
||||
child_session:request(
|
||||
'nvim_buf_set_lines',
|
||||
0,
|
||||
@@ -2481,7 +2466,7 @@ describe('TUI', function()
|
||||
end)
|
||||
|
||||
it('allows grid to assume wider non-ambiwidth chars than host terminal', function()
|
||||
t.skip(is_os('win'), 'FIXME: some spaces have wrong attrs on Windows')
|
||||
tt.override_screen_expect_for_conpty(screen)
|
||||
child_session:request(
|
||||
'nvim_buf_set_lines',
|
||||
0,
|
||||
@@ -3418,7 +3403,7 @@ describe('TUI FocusGained/FocusLost', function()
|
||||
end)
|
||||
|
||||
it('in hit-enter prompt', function()
|
||||
t.skip(is_os('win'), 'FIXME: some spaces have wrong attrs on Windows')
|
||||
tt.override_screen_expect_for_conpty(screen)
|
||||
feed_data(":echom 'msg1'|echom 'msg2'|echom 'msg3'|echom 'msg4'|echom 'msg5'\n")
|
||||
screen:expect([[
|
||||
msg1 |
|
||||
|
||||
@@ -214,13 +214,18 @@ end
|
||||
--- Remove this function when that's fixed.
|
||||
---
|
||||
--- @param screen test.functional.ui.screen
|
||||
--- @param s string
|
||||
function M.screen_expect(screen, s)
|
||||
if t.is_os('win') then
|
||||
s = s:gsub(' *%} +%|\n', '{MATCH: *}}{MATCH: *}|\n')
|
||||
s = s:gsub('%}%^ +%|\n', '{MATCH:[ ^]*}}{MATCH:[ ^]*}|\n')
|
||||
function M.override_screen_expect_for_conpty(screen)
|
||||
if not t.is_os('win') then
|
||||
return
|
||||
end
|
||||
local orig_screen_expect = screen.expect
|
||||
function screen.expect(self, expected, attr_ids, ...)
|
||||
if type(expected) == 'string' then
|
||||
expected = expected:gsub(' *%} +%|\n', '{MATCH: *}}{MATCH: *}|\n')
|
||||
expected = expected:gsub('%}%^ +%|\n', '{MATCH:[ ^]*}}{MATCH:[ ^]*}|\n')
|
||||
end
|
||||
orig_screen_expect(self, expected, attr_ids, ...)
|
||||
end
|
||||
screen:expect(s)
|
||||
end
|
||||
|
||||
--- Asserts that the exit code of chan eventually matches the expected exit code
|
||||
|
||||
Reference in New Issue
Block a user