diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-05-24 19:18:11 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-05-24 19:18:11 +0000 |
commit | ff7ed8f586589d620a806c3758fac4a47a8e7e15 (patch) | |
tree | 729bbcb92231538fa61dab6c3d890b025484b7f5 /test/functional/ui/embed_spec.lua | |
parent | 376914f419eb08fdf4c1a63a77e1f035898a0f10 (diff) | |
parent | 28c04948a1c887a1cc0cb64de79fa32631700466 (diff) | |
download | rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.gz rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.bz2 rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.zip |
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/ui/embed_spec.lua')
-rw-r--r-- | test/functional/ui/embed_spec.lua | 72 |
1 files changed, 43 insertions, 29 deletions
diff --git a/test/functional/ui/embed_spec.lua b/test/functional/ui/embed_spec.lua index 0445476780..e1abd43e20 100644 --- a/test/functional/ui/embed_spec.lua +++ b/test/functional/ui/embed_spec.lua @@ -1,18 +1,23 @@ -local uv = vim.uv - -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') +local uv = vim.uv -local api = helpers.api -local feed = helpers.feed -local eq = helpers.eq -local neq = helpers.neq -local clear = helpers.clear -local ok = helpers.ok -local fn = helpers.fn -local nvim_prog = helpers.nvim_prog -local retry = helpers.retry -local write_file = helpers.write_file +local api = n.api +local feed = n.feed +local eq = t.eq +local neq = t.neq +local clear = n.clear +local ok = t.ok +local fn = n.fn +local nvim_prog = n.nvim_prog +local retry = t.retry +local write_file = t.write_file +local assert_log = t.assert_log +local check_close = n.check_close +local is_os = t.is_os + +local testlog = 'Xtest-embed-log' local function test_embed(ext_linegrid) local screen @@ -53,7 +58,7 @@ local function test_embed(ext_linegrid) end) it("doesn't erase output when setting color scheme", function() - if helpers.is_os('openbsd') then + if t.is_os('openbsd') then pending('FIXME #10804') end startup('--cmd', 'echoerr "foo"', '--cmd', 'color default', '--cmd', 'echoerr "bar"') @@ -93,13 +98,18 @@ describe('--embed UI on startup (ext_linegrid=false)', function() end) describe('--embed UI', function() + after_each(function() + check_close() + os.remove(testlog) + end) + it('can pass stdin', function() local pipe = assert(uv.pipe()) local writer = assert(uv.new_pipe(false)) writer:open(pipe.write) - clear { args_rm = { '--headless' }, io_extra = pipe.read } + clear { args_rm = { '--headless' }, io_extra = pipe.read, env = { NVIM_LOG_FILE = testlog } } -- attach immediately after startup, for early UI local screen = Screen.new(40, 8) @@ -131,6 +141,10 @@ describe('--embed UI', function() {1:~ }|*4 {2:-- INSERT --} | ]] + + if not is_os('win') then + assert_log('Failed to get flags on descriptor 3: Bad file descriptor', testlog, 100) + end end) it('can pass stdin to -q - #17523', function() @@ -219,7 +233,7 @@ describe('--embed UI', function() } eq({ [16777215] = true }, seen) - -- NB: by accident how functional/helpers.lua currently handles the default color scheme, the + -- NB: by accident how functional/testutil.lua currently handles the default color scheme, the -- above is sufficient to test the behavior. But in case that workaround is removed, we need -- a test with an explicit override like below, so do it to remain safe. startup('--cmd', 'hi NORMAL guibg=#FF00FF') @@ -239,44 +253,44 @@ describe('--embed UI', function() screen:expect { condition = function() - eq(helpers.paths.test_source_path, screen.pwd) + eq(t.paths.test_source_path, screen.pwd) end, } -- Change global cwd - helpers.command(string.format('cd %s/src/nvim', helpers.paths.test_source_path)) + n.command(string.format('cd %s/src/nvim', t.paths.test_source_path)) screen:expect { condition = function() - eq(string.format('%s/src/nvim', helpers.paths.test_source_path), screen.pwd) + eq(string.format('%s/src/nvim', t.paths.test_source_path), screen.pwd) end, } -- Split the window and change the cwd in the split - helpers.command('new') - helpers.command(string.format('lcd %s/test', helpers.paths.test_source_path)) + n.command('new') + n.command(string.format('lcd %s/test', t.paths.test_source_path)) screen:expect { condition = function() - eq(string.format('%s/test', helpers.paths.test_source_path), screen.pwd) + eq(string.format('%s/test', t.paths.test_source_path), screen.pwd) end, } -- Move to the original window - helpers.command('wincmd p') + n.command('wincmd p') screen:expect { condition = function() - eq(string.format('%s/src/nvim', helpers.paths.test_source_path), screen.pwd) + eq(string.format('%s/src/nvim', t.paths.test_source_path), screen.pwd) end, } -- Change global cwd again - helpers.command(string.format('cd %s', helpers.paths.test_source_path)) + n.command(string.format('cd %s', t.paths.test_source_path)) screen:expect { condition = function() - eq(helpers.paths.test_source_path, screen.pwd) + eq(t.paths.test_source_path, screen.pwd) end, } end) @@ -284,9 +298,9 @@ end) describe('--embed --listen UI', function() it('waits for connection on listening address', function() - helpers.skip(helpers.is_os('win')) + t.skip(t.is_os('win')) clear() - local child_server = assert(helpers.new_pipename()) + local child_server = assert(n.new_pipename()) fn.jobstart({ nvim_prog, '--embed', @@ -300,7 +314,7 @@ describe('--embed --listen UI', function() neq(nil, uv.fs_stat(child_server)) end) - local child_session = helpers.connect(child_server) + local child_session = n.connect(child_server) local info_ok, api_info = child_session:request('nvim_get_api_info') ok(info_ok) |