comparison src/testdir/test_swap.vim @ 22938:760526e5cd29 v8.2.2016

patch 8.2.2016: swap file test is a little flaky Commit: https://github.com/vim/vim/commit/c6ca9f3a29bfd6f5269749036f79f63ce6289692 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 19 18:57:23 2020 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Thu, 19 Nov 2020 19:00:07 +0100
parents 83c2c489cb1b
children 815f3a6b05ca
comparison
equal deleted inserted replaced
22937:77a956145f6a 22938:760526e5cd29
415 415
416 " Forget about the file, recreate the swap file, then edit it again. The 416 " Forget about the file, recreate the swap file, then edit it again. The
417 " swap file should be automatically deleted. 417 " swap file should be automatically deleted.
418 bwipe! 418 bwipe!
419 " change the process ID to avoid the "still running" warning 419 " change the process ID to avoid the "still running" warning
420 let swapfile_bytes[24] = 0x99 420 let swapfile_bytes[24] = swapfile_bytes[24] + 1
421 call writefile(swapfile_bytes, swapfile_name) 421 call writefile(swapfile_bytes, swapfile_name)
422 edit Xtest.scr 422 edit Xtest.scr
423 " will end up using the same swap file after deleting the existing one 423 " will end up using the same swap file after deleting the existing one
424 call assert_equal(swapfile_name, swapname('%')) 424 call assert_equal(swapfile_name, swapname('%'))
425 bwipe! 425 bwipe!
431 autocmd! 431 autocmd!
432 autocmd SwapExists * let v:swapchoice = 'e' 432 autocmd SwapExists * let v:swapchoice = 'e'
433 augroup END 433 augroup END
434 434
435 " change the host name 435 " change the host name
436 let swapfile_bytes[28 + 40] = 0x89 436 let swapfile_bytes[28 + 40] = swapfile_bytes[28 + 40] + 2
437 call writefile(swapfile_bytes, swapfile_name) 437 call writefile(swapfile_bytes, swapfile_name)
438 edit Xtest.scr 438 edit Xtest.scr
439 call assert_equal(1, filereadable(swapfile_name)) 439 call assert_equal(1, filereadable(swapfile_name))
440 " will use another same swap file name 440 " will use another same swap file name
441 call assert_notequal(swapfile_name, swapname('%')) 441 call assert_notequal(swapfile_name, swapname('%'))