Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
20155:f413c0207fd1 | 20156:49694eceaa55 |
---|---|
61 endfunc | 61 endfunc |
62 | 62 |
63 func Test_partial_dict() | 63 func Test_partial_dict() |
64 let dict = {'name': 'hello'} | 64 let dict = {'name': 'hello'} |
65 let Cb = function('MyDictFunc', ["foo", "bar"], dict) | 65 let Cb = function('MyDictFunc', ["foo", "bar"], dict) |
66 call test_garbagecollect_now() | |
66 call assert_equal("hello/foo/bar", Cb()) | 67 call assert_equal("hello/foo/bar", Cb()) |
67 call assert_fails('Cb("xxx")', 'E492:') | 68 call assert_fails('Cb("xxx")', 'E492:') |
68 | 69 |
69 let Cb = function('MyDictFunc', ["foo"], dict) | 70 let Cb = function('MyDictFunc', ["foo"], dict) |
70 call assert_equal("hello/foo/xxx", Cb("xxx")) | 71 call assert_equal("hello/foo/xxx", Cb("xxx")) |
280 func Test_ref_job_partial_dict() | 281 func Test_ref_job_partial_dict() |
281 if has('job') | 282 if has('job') |
282 let g:ref_job = job_start('echo') | 283 let g:ref_job = job_start('echo') |
283 let d = {'a': 'b'} | 284 let d = {'a': 'b'} |
284 call job_setoptions(g:ref_job, {'exit_cb': function('Ignored2', [], d)}) | 285 call job_setoptions(g:ref_job, {'exit_cb': function('Ignored2', [], d)}) |
286 call test_garbagecollect_now() | |
285 endif | 287 endif |
286 endfunc | 288 endfunc |
287 | 289 |
288 func Test_auto_partial_rebind() | 290 func Test_auto_partial_rebind() |
289 let dict1 = {'name': 'dict1'} | 291 let dict1 = {'name': 'dict1'} |
389 | 391 |
390 " isnot, option 2 | 392 " isnot, option 2 |
391 call assert_true(F1 isnot# F2) " Different functions | 393 call assert_true(F1 isnot# F2) " Different functions |
392 call assert_true(F1 isnot# F1d1) " Partial /= non-partial | 394 call assert_true(F1 isnot# F1d1) " Partial /= non-partial |
393 call assert_true(d1.f1 isnot# d1.f1) " handle_subscript creates new partial each time | 395 call assert_true(d1.f1 isnot# d1.f1) " handle_subscript creates new partial each time |
396 | |
397 " compare two null partials | |
398 let N1 = test_null_partial() | |
399 let N2 = N1 | |
400 call assert_true(N1 is N2) | |
401 call assert_true(N1 == N2) | |
402 | |
403 " compare a partial and a null partial | |
404 call assert_false(N1 == F1) | |
405 call assert_false(F1 is N1) | |
394 endfunc | 406 endfunc |
395 | 407 |
396 " vim: shiftwidth=2 sts=2 expandtab | 408 " vim: shiftwidth=2 sts=2 expandtab |