vim-patch:8.2.2016: swap file test is a little flaky

Problem:    Swap file test is a little flaky.
Solution:   Don't set a byte to a fixed value, increment it.

c6ca9f3a29

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2022-11-17 18:20:54 +08:00
parent abe1dd308e
commit f97d88a58a

View File

@@ -435,7 +435,7 @@ func Test_swap_auto_delete()
" swap file should be automatically deleted. " swap file should be automatically deleted.
bwipe! bwipe!
" change the process ID to avoid the "still running" warning " change the process ID to avoid the "still running" warning
let swapfile_bytes[24] = 0x99 let swapfile_bytes[24] = swapfile_bytes[24] + 1
call writefile(swapfile_bytes, swapfile_name) call writefile(swapfile_bytes, swapfile_name)
edit Xtest.scr edit Xtest.scr
" will end up using the same swap file after deleting the existing one " will end up using the same swap file after deleting the existing one
@@ -451,7 +451,7 @@ func Test_swap_auto_delete()
augroup END augroup END
" change the host name " change the host name
let swapfile_bytes[28 + 40] = 0x89 let swapfile_bytes[28 + 40] = swapfile_bytes[28 + 40] + 2
call writefile(swapfile_bytes, swapfile_name) call writefile(swapfile_bytes, swapfile_name)
edit Xtest.scr edit Xtest.scr
call assert_equal(1, filereadable(swapfile_name)) call assert_equal(1, filereadable(swapfile_name))