comparison src/testdir/test_listdict.vim @ 22794:42bb78d46354 v8.2.1945

patch 8.2.1945: crash when passing NULL function to reduce() Commit: https://github.com/vim/vim/commit/0d90e728fe089ff1bb34d6a17f5591a96b57f734 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 3 18:20:19 2020 +0100 patch 8.2.1945: crash when passing NULL function to reduce() Problem: Crash when passing NULL function to reduce(). Solution: Check for NULL pointer and give an error. (Dominique Pell?, closes #7243)
author Bram Moolenaar <Bram@vim.org>
date Tue, 03 Nov 2020 18:30:04 +0100
parents 837756417c5e
children 690b84a6a7ce
comparison
equal deleted inserted replaced
22793:39efae87751b 22794:42bb78d46354
738 unlet g:lut 738 unlet g:lut
739 delfunc EvilRemove 739 delfunc EvilRemove
740 740
741 call assert_equal(42, reduce(test_null_list(), function('add'), 42)) 741 call assert_equal(42, reduce(test_null_list(), function('add'), 42))
742 call assert_equal(42, reduce(test_null_blob(), function('add'), 42)) 742 call assert_equal(42, reduce(test_null_blob(), function('add'), 42))
743
744 " should not crash
745 call assert_fails('echo reduce([1], test_null_function())', 'E1132:')
743 endfunc 746 endfunc
744 747
745 " splitting a string to a List using split() 748 " splitting a string to a List using split()
746 func Test_str_split() 749 func Test_str_split()
747 call assert_equal(['aa', 'bb'], split(' aa bb ')) 750 call assert_equal(['aa', 'bb'], split(' aa bb '))