diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-09-24 22:03:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-24 22:03:54 +0800 |
commit | ed0d6536e34af2a2a74894e52da5734c9c8d6e17 (patch) | |
tree | 22e28be36bbfd0c4d5401e5f28e01368e14fbf87 /test/functional/ex_cmds | |
parent | 9637b7dae417f336ca72cfcb201cb37247d794a8 (diff) | |
download | rneovim-ed0d6536e34af2a2a74894e52da5734c9c8d6e17.tar.gz rneovim-ed0d6536e34af2a2a74894e52da5734c9c8d6e17.tar.bz2 rneovim-ed0d6536e34af2a2a74894e52da5734c9c8d6e17.zip |
test: only trim trailing spaces in swapfile tests (#25341)
Diffstat (limited to 'test/functional/ex_cmds')
-rw-r--r-- | test/functional/ex_cmds/swapfile_preserve_recover_spec.lua | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua index 76c0e77e76..3e0f6d1fcc 100644 --- a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua +++ b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua @@ -17,14 +17,13 @@ local pesc = helpers.pesc local os_kill = helpers.os_kill local set_session = helpers.set_session local spawn = helpers.spawn -local nvim_async = helpers.nvim_async +local async_meths = helpers.async_meths local expect_msg_seq = helpers.expect_msg_seq local pcall_err = helpers.pcall_err local mkdir = helpers.mkdir local poke_eventloop = helpers.poke_eventloop local meths = helpers.meths local retry = helpers.retry -local trim = helpers.trim local write_file = helpers.write_file describe(':recover', function() @@ -113,17 +112,17 @@ describe("preserve and (R)ecover with custom 'directory'", function() it('killing TUI process without :preserve #22096', function() helpers.skip(helpers.is_os('win')) - local screen = Screen.new() - screen:attach() + local screen0 = Screen.new() + screen0:attach() local child_server = new_pipename() funcs.termopen({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--listen', child_server}) - screen:expect({any = pesc('[No Name]')}) -- Wait for the child process to start. + screen0:expect({any = pesc('[No Name]')}) -- Wait for the child process to start. local child_session = helpers.connect(child_server) set_session(child_session) local swappath1 = setup_swapname() set_session(nvim0) command('call chanclose(&channel)') -- Kill the child process. - screen:expect({any = pesc('[Process exited 1]')}) -- Wait for the child process to stop. + screen0:expect({any = pesc('[Process exited 1]')}) -- Wait for the child process to stop. test_recover(swappath1) end) @@ -204,7 +203,7 @@ describe('swapfile detection', function() screen2:expect(expected_no_dialog) -- With API call and shortmess+=F - nvim_async('command', 'edit %') + async_meths.command('edit %') screen2:expect{any=[[Found a swap file by the name ".*]] ..[[Xtest_swapdialog_dir[/\].*]]..testfile..[[%.swp"]]} feed('e') -- Chose "Edit" at the swap dialog. @@ -415,13 +414,13 @@ describe('quitting swapfile dialog on startup stops TUI properly', function() '--cmd', init_dir, '--cmd', init_set, testfile}) retry(nil, nil, function() - eq('[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:', trim(funcs.getline('$'))) + eq('[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:', + eval("getline('$')->trim(' ', 2)")) end) meths.chan_send(chan, 'q') retry(nil, nil, function() - eq({'', '[Process exited 1]', ''}, { - trim(funcs.getline(1)), trim(funcs.getline(2)), trim(funcs.getline('$')), - }) + eq({'', '[Process exited 1]', ''}, + eval("[1, 2, '$']->map({_, lnum -> getline(lnum)->trim(' ', 2)})")) end) end) @@ -430,13 +429,13 @@ describe('quitting swapfile dialog on startup stops TUI properly', function() '--cmd', init_dir, '--cmd', init_set, '-p', otherfile, testfile}) retry(nil, nil, function() - eq('[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:', trim(funcs.getline('$'))) + eq('[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:', + eval("getline('$')->trim(' ', 2)")) end) meths.chan_send(chan, 'a') retry(nil, nil, function() - eq({'', '[Process exited 1]', ''}, { - trim(funcs.getline(1)), trim(funcs.getline(2)), trim(funcs.getline('$')), - }) + eq({'', '[Process exited 1]', ''}, + eval("[1, 2, '$']->map({_, lnum -> getline(lnum)->trim(' ', 2)})")) end) end) @@ -450,17 +449,18 @@ describe('quitting swapfile dialog on startup stops TUI properly', function() '--cmd', init_dir, '--cmd', init_set, '--cmd', 'set tags='..otherfile, '-tsecond'}) retry(nil, nil, function() - eq('[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:', trim(funcs.getline('$'))) + eq('[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:', + eval("getline('$')->trim(' ', 2)")) end) meths.chan_send(chan, 'q') retry(nil, nil, function() - eq('Press ENTER or type command to continue', trim(funcs.getline('$'))) + eq('Press ENTER or type command to continue', + eval("getline('$')->trim(' ', 2)")) end) meths.chan_send(chan, '\r') retry(nil, nil, function() - eq({'', '[Process exited 1]', ''}, { - trim(funcs.getline(1)), trim(funcs.getline(2)), trim(funcs.getline('$')), - }) + eq({'', '[Process exited 1]', ''}, + eval("[1, 2, '$']->map({_, lnum -> getline(lnum)->trim(' ', 2)})")) end) end) end) |