patch 9.0.1008: test for swapfilelist() fails on MS-Windows
Problem: Test for swapfilelist() fails on MS-Windows.
Solution: Only check the tail of the path. Mark a test as flaky.
diff --git a/src/testdir/test_swap.vim b/src/testdir/test_swap.vim
index c776ca5..7532655 100644
--- a/src/testdir/test_swap.vim
+++ b/src/testdir/test_swap.vim
@@ -111,16 +111,18 @@
let fname = s:swapname()
call assert_match('Xswapinfo', fname)
+ " Check the tail appears in the list from swapfilelist(). The path depends
+ " on the system.
+ let tail = fnamemodify(fname, ":t")->fnameescape()
let nr = 0
for name in swapfilelist()
- if name =~ '[\\/]' .. fname .. '$'
+ if name =~ tail .. '$'
let nr += 1
endif
endfor
- call assert_equal(1, nr)
+ call assert_equal(1, nr, 'not found in ' .. string(swapfilelist()))
let info = fname->swapinfo()
-
let ver = printf('VIM %d.%d', v:version / 100, v:version % 100)
call assert_equal(ver, info.version)