diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-01-01 22:28:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-01 07:28:52 -0700 |
commit | a5eadbaf3c6323761f307aa905ff92a75f29c1e2 (patch) | |
tree | b09c4f2988e3e6282609116f86fcc466e7a26556 | |
parent | 5dbc64dcedf388d3d694fda4efb3c916d8641b86 (diff) | |
download | rneovim-a5eadbaf3c6323761f307aa905ff92a75f29c1e2.tar.gz rneovim-a5eadbaf3c6323761f307aa905ff92a75f29c1e2.tar.bz2 rneovim-a5eadbaf3c6323761f307aa905ff92a75f29c1e2.zip |
test: make some tests more stable (#16860)
-rw-r--r-- | test/functional/terminal/buffer_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 36 |
2 files changed, 12 insertions, 26 deletions
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index f25cfa2039..1ff451434d 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -350,7 +350,7 @@ describe('on_lines does not emit out-of-bounds line indexes when', function() end) it('creating a terminal buffer #16394', function() - feed_command([[autocmd TermOpen * ++once call v:lua.register_callback(expand("<abuf>"))]]) + feed_command('autocmd TermOpen * ++once call v:lua.register_callback(str2nr(expand("<abuf>")))') feed_command('terminal') sleep(500) eq('', exec_lua([[return _G.cb_error]])) diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index bf57b135cb..faf44fa01d 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -20,7 +20,6 @@ local nvim_prog = helpers.nvim_prog local nvim_set = helpers.nvim_set local ok = helpers.ok local read_file = helpers.read_file -local exec_lua = helpers.exec_lua if helpers.pending_win32(pending) then return end @@ -581,34 +580,21 @@ describe('TUI', function() end) it("paste: 'nomodifiable' buffer", function() - local has_luajit = exec_lua('return jit ~= nil') child_session:request('nvim_command', 'set nomodifiable') child_session:request('nvim_exec_lua', [[ - -- Stack traces for this test are non-deterministic, so disable them - _G.debug.traceback = function(msg) return msg end + -- Truncate the error message to hide the line number + _G.debug.traceback = function(msg) return msg:sub(-49) end ]], {}) feed_data('\027[200~fail 1\nfail 2\n\027[201~') - if has_luajit then - screen:expect{grid=[[ - | - {4:~ }| - {5: }| - {8:paste: Error executing lua: vim.lua:0: Vim:E21: Ca}| - {8:nnot make changes, 'modifiable' is off} | - {10:Press ENTER or type command to continue}{1: } | - {3:-- TERMINAL --} | - ]]} - else - screen:expect{grid=[[ - | - {4:~ }| - {5: }| - {8:paste: Error executing lua: Vim:E21: Cannot make c}| - {8:hanges, 'modifiable' is off} | - {10:Press ENTER or type command to continue}{1: } | - {3:-- TERMINAL --} | - ]]} - end + screen:expect{grid=[[ + | + {4:~ }| + {5: }| + {8:paste: Error executing lua: Vim:E21: Cannot make c}| + {8:hanges, 'modifiable' is off} | + {10:Press ENTER or type command to continue}{1: } | + {3:-- TERMINAL --} | + ]]} feed_data('\n') -- <Enter> child_session:request('nvim_command', 'set modifiable') feed_data('\027[200~success 1\nsuccess 2\n\027[201~') |