Merge #40813 test: local failures, "succeeded immediately"

This commit is contained in:
Justin M. Keyes
2026-07-18 10:48:43 -04:00
committed by GitHub
2 changed files with 41 additions and 19 deletions
+10 -1
View File
@@ -98,7 +98,9 @@ local function git_get_hash(rev, repo_name)
end
local function git_get_short_hash(rev, repo_name)
return git_cmd({ 'rev-list', '-1', '--abbrev-commit', rev }, repo_name)
-- Pin `--abbrev`. Git's default abbrev differs across environments, which would shift the
-- hard-coded column alignment and LSP link positions in the confirmation-buffer tests.
return git_cmd({ 'rev-list', '-1', '--abbrev=7', '--abbrev-commit', rev }, repo_name)
end
-- Common test repos ----------------------------------------------------------
@@ -1172,6 +1174,13 @@ describe('vim.pack', function()
})
n.clear()
-- Pin git's short-hash length so the confirmation buffer's `%h` columns are deterministic.
exec_lua([[
vim.env.GIT_CONFIG_COUNT = '1'
vim.env.GIT_CONFIG_KEY_0 = 'core.abbrev'
vim.env.GIT_CONFIG_VALUE_0 = '7'
]])
-- Mock remote repo update
-- - Force push
repo_write_file('fetch', 'lua/fetch.lua', 'return "fetch new"')
+31 -18
View File
@@ -269,7 +269,10 @@ describe('TUI :detach', function()
local _, uis_attached = child_session:request('nvim_list_uis')
eq(2, #uis_attached)
tt.feed_data(':%detach\013')
-- Send the command in two steps, to avoid "Screen test succeeded immediately" warning.
tt.feed_data(':%detach')
screen:expect({ any = vim.pesc(':%detach^') })
tt.feed_data('\013')
screen:expect([[
Hello from detach^! |
{100:~ }|*3
@@ -457,7 +460,14 @@ describe('TUI :restart', function()
-- ZR preserves screen state
tt.feed_data('ZR')
starttime, server_session = assert_restarted(starttime, server_session, server_pipe)
screen:expect({ any = 'foo' })
-- Match the full restored screen, to avoid "Screen test succeeded immediately" warning.
screen:expect([[
^foo |
~ |*3
{2:Xtest-restart-file 1,1 All}|
|
{5:-- TERMINAL --} |
]])
-- [1-8]ZR does not preserve screen state
tt.feed_data('1ZR')
@@ -467,6 +477,9 @@ describe('TUI :restart', function()
tt.feed_data('ifoo\027')
tt.feed_data('ZR')
screen:expect({ any = 'E37:' })
-- Dismiss hit-enter so the next "E37" assertion below doesn't match this one immediately.
tt.feed_data('\013')
screen:expect({ any = vim.pesc('[No Name]') })
tt.feed_data('1ZR')
screen:expect({ any = 'E37:' })
@@ -625,6 +638,8 @@ describe('TUI :restart', function()
{5:-- TERMINAL --} |
]])
tt.feed_data('\013')
-- Return to a distinct state so the next screen:expect() doesn't "succeed immediately".
screen:expect({ any = vim.pesc('[No Name]') })
end
tt.feed_data('ithis will be removed\027')
@@ -669,7 +684,10 @@ describe('TUI :restart', function()
[':restart'] = 'restart',
[':restart!'] = 'restart!',
}) do
tt.feed_data(cmd .. '\013')
tt.feed_data(cmd)
-- Assert the command-line echo so the E37 assertion below doesn't "succeed immediately".
screen:expect({ any = vim.pesc(cmd) })
tt.feed_data('\013')
screen:expect({ any = vim.pesc('Vim(qall):E37: No write since last change') })
assert_exitreason(('QuitPre:%s\nExitPre:%s\n'):format(exitreason, exitreason))
end
@@ -2700,7 +2718,8 @@ describe('TUI', function()
it('in nvim_list_uis(), sets nvim_set_client_info()', function()
-- $TERM in :terminal.
local exp_term = (is_os('bsd') or is_os('win')) and 'xterm' or 'xterm-256color'
local exp_term = (is_os('bsd') or is_os('win') or fn.has('terminfo') == 0) and 'xterm'
or 'xterm-256color'
local ui_chan = 1
local expected = {
{
@@ -3845,8 +3864,11 @@ end)
describe("TUI 't_Co' (terminal colors)", function()
local screen --[[@type test.functional.ui.screen]]
local function assert_term_colors(term, colorterm, maxcolors)
local function assert_term_colors(term, colorterm, maxcolors, builtin_maxcolors)
clear({ env = { TERM = term }, args = {} })
if builtin_maxcolors and (is_os('freebsd') or is_os('win') or fn.has('terminfo') == 0) then
maxcolors = builtin_maxcolors
end
screen = tt.setup_child_nvim({
'--clean',
'--cmd',
@@ -3955,24 +3977,15 @@ describe("TUI 't_Co' (terminal colors)", function()
-- screen:
--
-- FreeBSD and Windows fall back to the built-in screen-256colour entry.
-- Linux and MacOS have a screen entry in external terminfo with 8 colours,
-- which is raised to 16 by COLORTERM.
-- FreeBSD/Windows (any build without terminfo) fall back to built-in "screen-256colour".
-- Linux/MacOS have a screen entry in external terminfo with 8 colours, raised to 16 by COLORTERM.
it('TERM=screen no COLORTERM uses 8/256 colors', function()
if is_os('freebsd') or is_os('win') then
assert_term_colors('screen', nil, 256)
else
assert_term_colors('screen', nil, 8)
end
assert_term_colors('screen', nil, 8, 256)
end)
it('TERM=screen COLORTERM=screen uses 16/256 colors', function()
if is_os('freebsd') or is_os('win') then
assert_term_colors('screen', 'screen', 256)
else
assert_term_colors('screen', 'screen', 16)
end
assert_term_colors('screen', 'screen', 16, 256)
end)
it('TERM=screen COLORTERM=screen-256color uses 256 colors', function()