patch 8.2.0633: crash when using null partial in filter()
Problem: Crash when using null partial in filter().
Solution: Fix crash. Add more tests. (Yegappan Lakshmanan, closes #5976)
diff --git a/src/testdir/test_partial.vim b/src/testdir/test_partial.vim
index 1e682d5..5b273db 100644
--- a/src/testdir/test_partial.vim
+++ b/src/testdir/test_partial.vim
@@ -63,6 +63,7 @@
func Test_partial_dict()
let dict = {'name': 'hello'}
let Cb = function('MyDictFunc', ["foo", "bar"], dict)
+ call test_garbagecollect_now()
call assert_equal("hello/foo/bar", Cb())
call assert_fails('Cb("xxx")', 'E492:')
@@ -282,6 +283,7 @@
let g:ref_job = job_start('echo')
let d = {'a': 'b'}
call job_setoptions(g:ref_job, {'exit_cb': function('Ignored2', [], d)})
+ call test_garbagecollect_now()
endif
endfunc
@@ -391,6 +393,16 @@
call assert_true(F1 isnot# F2) " Different functions
call assert_true(F1 isnot# F1d1) " Partial /= non-partial
call assert_true(d1.f1 isnot# d1.f1) " handle_subscript creates new partial each time
+
+ " compare two null partials
+ let N1 = test_null_partial()
+ let N2 = N1
+ call assert_true(N1 is N2)
+ call assert_true(N1 == N2)
+
+ " compare a partial and a null partial
+ call assert_false(N1 == F1)
+ call assert_false(F1 is N1)
endfunc
" vim: shiftwidth=2 sts=2 expandtab