0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00
vim/src/testdir/test_file_size.vim

30 lines
825 B
VimL
Raw Normal View History

" Inserts 2 million lines with consecutive integers starting from 1
" (essentially, the output of GNU's seq 1 2000000), writes them to Xtest
" and writes its cksum to test.out.
"
" We need 2 million lines to trigger a call to mf_hash_grow(). If it would mess
" up the lines the checksum would differ.
"
" cksum is part of POSIX and so should be available on most Unixes.
" If it isn't available then the test will be skipped.
func Test_File_Size()
if !executable('cksum')
return
endif
set belloff=all fileformat=unix undolevels=-1
new
for i in range(1, 2000000, 100)
call append(i, range(i, i + 99))
endfor
1delete
w! Xtest
let l = systemlist('cksum Xtest')
call assert_equal('3678979763 14888896 Xtest', l[0])
enew!
call delete('Xtest')
set belloff& fileformat& undolevels&
endfunc