neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 4a997a1732fdb7a1c99cadf780b789f1ac84d990
parent be1fbe38b31b6046d396407c4efbf238941c6b08
Author: Justin M. Keyes <justinkz@gmail.com>
Date:   Wed, 26 Feb 2025 22:51:48 +0100

test: unreliable swapfile_preserve_recover_spec

Problem:
Test sometimes fails on bsd (cirrus ci):

    test/functional/ex_cmds/swapfile_preserve_recover_spec.lua:589: retry() attempts: 464
    test/functional/ex_cmds/swapfile_preserve_recover_spec.lua:590: Expected objects to be the same.
    Passed in:
    (table: 0x0d5f1aa44070) {
      [1] = ''
     *[2] = ''
      [3] = '[Process exited 1]' }
    Expected:
    (table: 0x0d5ea3eb8718) {
      [1] = ''
     *[2] = '[Process exited 1]'
      [3] = '' }
    stack traceback:
      test/testutil.lua:104: in function 'retry'
      test/functional/ex_cmds/swapfile_preserve_recover_spec.lua:589: in function <test/functional/ex_cmds/swapfile_preserve_recover_spec.lua:556>

Solution:
Filter out empty items to avoid irrelevant redraw-timing assumptions.

Diffstat:
Mtest/functional/ex_cmds/swapfile_preserve_recover_spec.lua | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua b/test/functional/ex_cmds/swapfile_preserve_recover_spec.lua @@ -152,6 +152,9 @@ describe('swapfile detection', function() it('redrawing during prompt does not break treesitter', function() local testfile = 'Xtest_swapredraw.lua' + finally(function() + os.remove(testfile) + end) write_file( testfile, [[ @@ -589,7 +592,9 @@ describe('quitting swapfile dialog on startup stops TUI properly', function() retry(nil, nil, function() eq( { '[Process exited 1]' }, - eval("[1, 2, '$']->map({_, lnum -> getline(lnum)->trim(' ', 2)})->filter({_, s -> !empty(trim(s))})") + eval( + "[1, 2, '$']->map({_, lnum -> getline(lnum)->trim(' ', 2)})->filter({_, s -> !empty(trim(s))})" + ) ) end) end)