diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2022-01-10 10:31:16 +0000 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2022-02-05 14:01:00 +0000 |
commit | 4f7a8991a93ddb1b6ab7cd8a8f21b5197c4612bb (patch) | |
tree | 959e4370100ebcc55c023ecc424dedb245b5b0ab /src/nvim/testdir | |
parent | cc7ccf6d31d14457070055be07884edaf2eb165f (diff) | |
download | rneovim-4f7a8991a93ddb1b6ab7cd8a8f21b5197c4612bb.tar.gz rneovim-4f7a8991a93ddb1b6ab7cd8a8f21b5197c4612bb.tar.bz2 rneovim-4f7a8991a93ddb1b6ab7cd8a8f21b5197c4612bb.zip |
vim-patch:8.2.0233: crash when using garbagecollect() in between rand()
Problem: Crash when using garbagecollect() in between rand().
Solution: Redesign the rand() and srand() implementation. (Yasuhiro
Matsumoto, closes vim/vim#5587, closes vim/vim#5588)
https://github.com/vim/vim/commit/4f645c54efe33d7a11e314676e503118761f08a7
Omit test_srand_seed.
Unmacroify SHUFFLE_XOSHIRO128STARSTAR and SPLITMIX32 while we're at it (leave
ROTL alone as it's fairly innocent).
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r-- | src/nvim/testdir/test_random.vim | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/nvim/testdir/test_random.vim b/src/nvim/testdir/test_random.vim index f953b93d51..6d3f7dcfd9 100644 --- a/src/nvim/testdir/test_random.vim +++ b/src/nvim/testdir/test_random.vim @@ -12,7 +12,7 @@ func Test_Rand() " Nvim does not support test_settime " call test_settime(12341234) let s = srand() - if filereadable('/dev/urandom') + if !has('win32') && filereadable('/dev/urandom') " using /dev/urandom call assert_notequal(s, srand()) " else @@ -22,9 +22,11 @@ func Test_Rand() " call assert_notequal(s, srand()) endif - call srand() - let v = rand() - call assert_notequal(v, rand()) + " Nvim does not support test_srand_seed + " call test_srand_seed(123456789) + " call assert_equal(4284103975, rand()) + " call assert_equal(1001954530, rand()) + " call test_srand_seed() if has('float') call assert_fails('echo srand(1.2)', 'E805:') @@ -40,4 +42,10 @@ func Test_Rand() " call test_settime(0) endfunc +func Test_issue_5587() + call rand() + call garbagecollect() + call rand() +endfunc + " vim: shiftwidth=2 sts=2 expandtab |