mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.2981: recovery test is not run on big-endian systems
Problem: Recovery test is not run on big-endian systems.
Solution: Make it work on big-endian systems. (James McCoy, closes vim/vim#8368)
6654ca702c
Co-authored-by: James McCoy <jamessan@jamessan.com>
This commit is contained in:
parent
f12a45c45e
commit
fa17dc1e1b
@ -203,14 +203,14 @@ func Test_recover_corrupted_swap_file()
|
||||
let b = readblob(sn)
|
||||
let save_b = copy(b)
|
||||
bw!
|
||||
" Run these tests only on little-endian systems. These tests fail on a
|
||||
" big-endian system (IBM S390x system).
|
||||
if b[1008:1011] == 0z33323130
|
||||
\ && b[4096:4097] == 0z7470
|
||||
\ && b[8192:8193] == 0z6164
|
||||
|
||||
" Not all fields are written in a system-independent manner. Detect whether
|
||||
" the test is running on a little or big-endian system, so the correct
|
||||
" corruption values can be set.
|
||||
let little_endian = b[1008:1015] == 0z33323130.00000000
|
||||
|
||||
" clear the B0_MAGIC_LONG field
|
||||
let b[1008:1011] = 0z00000000
|
||||
let b[1008:1015] = 0z0000000000000000
|
||||
call writefile(b, sn)
|
||||
let msg = execute('recover Xfile1')
|
||||
call assert_match('the file has been damaged', msg)
|
||||
@ -248,7 +248,7 @@ func Test_recover_corrupted_swap_file()
|
||||
|
||||
" set the block number in a pointer entry to a negative number
|
||||
let b = copy(save_b)
|
||||
let b[4104:4111] = 0z00000000.00000080
|
||||
let b[4104:4111] = little_endian ? 0z00000000.00000080 : 0z80000000.00000000
|
||||
call writefile(b, sn)
|
||||
call assert_fails('recover Xfile1', 'E312:')
|
||||
call assert_equal('Xfile1', @%)
|
||||
@ -266,7 +266,7 @@ func Test_recover_corrupted_swap_file()
|
||||
|
||||
" set the number of lines in the data block to zero
|
||||
let b = copy(save_b)
|
||||
let b[8208:8211] = 0z00000000
|
||||
let b[8208:8215] = 0z00000000.00000000
|
||||
call writefile(b, sn)
|
||||
call assert_fails('recover Xfile1', 'E312:')
|
||||
call assert_equal('Xfile1', @%)
|
||||
@ -285,7 +285,7 @@ func Test_recover_corrupted_swap_file()
|
||||
|
||||
" use an incorrect text end (db_txt_end) for the data block
|
||||
let b = copy(save_b)
|
||||
let b[8204:8207] = 0z80000000
|
||||
let b[8204:8207] = little_endian ? 0z80000000 : 0z00000080
|
||||
call writefile(b, sn)
|
||||
call assert_fails('recover Xfile1', 'E312:')
|
||||
call assert_equal('Xfile1', @%)
|
||||
@ -299,7 +299,6 @@ func Test_recover_corrupted_swap_file()
|
||||
call assert_fails('recover Xfile1', 'E312:')
|
||||
call assert_equal('Xfile1', @%)
|
||||
call assert_equal(['???MANY LINES MISSING'], getline(1, '$'))
|
||||
endif
|
||||
|
||||
bw!
|
||||
call delete(sn)
|
||||
|
Loading…
Reference in New Issue
Block a user