Mercurial > vim
comparison src/testdir/test_swap.vim @ 31349:22d11340ee68 v9.0.1008
patch 9.0.1008: test for swapfilelist() fails on MS-Windows
Commit: https://github.com/vim/vim/commit/6cf3151f0e3839332c89367b7384c395a1185927
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Dec 5 15:01:05 2022 +0000
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 05 Dec 2022 16:15:04 +0100 |
parents | 56a2af8c0980 |
children |
comparison
equal
deleted
inserted
replaced
31348:fa722fa1b6e6 | 31349:22d11340ee68 |
---|---|
109 call setline(1, ['one', 'two', 'three']) | 109 call setline(1, ['one', 'two', 'three']) |
110 w | 110 w |
111 let fname = s:swapname() | 111 let fname = s:swapname() |
112 call assert_match('Xswapinfo', fname) | 112 call assert_match('Xswapinfo', fname) |
113 | 113 |
114 " Check the tail appears in the list from swapfilelist(). The path depends | |
115 " on the system. | |
116 let tail = fnamemodify(fname, ":t")->fnameescape() | |
114 let nr = 0 | 117 let nr = 0 |
115 for name in swapfilelist() | 118 for name in swapfilelist() |
116 if name =~ '[\\/]' .. fname .. '$' | 119 if name =~ tail .. '$' |
117 let nr += 1 | 120 let nr += 1 |
118 endif | 121 endif |
119 endfor | 122 endfor |
120 call assert_equal(1, nr) | 123 call assert_equal(1, nr, 'not found in ' .. string(swapfilelist())) |
121 | 124 |
122 let info = fname->swapinfo() | 125 let info = fname->swapinfo() |
123 | |
124 let ver = printf('VIM %d.%d', v:version / 100, v:version % 100) | 126 let ver = printf('VIM %d.%d', v:version / 100, v:version % 100) |
125 call assert_equal(ver, info.version) | 127 call assert_equal(ver, info.version) |
126 | 128 |
127 call assert_match('\w', info.user) | 129 call assert_match('\w', info.user) |
128 " host name is truncated to 39 bytes in the swap file | 130 " host name is truncated to 39 bytes in the swap file |