diff src/testdir/test_partial.vim @ 20156:49694eceaa55 v8.2.0633

patch 8.2.0633: crash when using null partial in filter() Commit: https://github.com/vim/vim/commit/9d8d0b5c644ea53364d04403740b3f23e57c1497 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Apr 24 22:47:31 2020 +0200 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 https://github.com/vim/vim/issues/5976)
author Bram Moolenaar <Bram@vim.org>
date Fri, 24 Apr 2020 23:00:04 +0200
parents 546bdeef35f1
children 94f05de75e9f
line wrap: on
line diff
--- a/src/testdir/test_partial.vim
+++ b/src/testdir/test_partial.vim
@@ -63,6 +63,7 @@ endfunc
 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 @@ func Test_ref_job_partial_dict()
     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 @@ func Test_compare_partials()
   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