Mercurial > vim
comparison src/testdir/test_expr.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 | 0b35a7ffceb2 |
children | 94f05de75e9f |
comparison
equal
deleted
inserted
replaced
20155:f413c0207fd1 | 20156:49694eceaa55 |
---|---|
1 " Tests for expressions. | 1 " Tests for expressions. |
2 | |
3 source check.vim | |
2 | 4 |
3 func Test_equal() | 5 func Test_equal() |
4 let base = {} | 6 let base = {} |
5 func base.method() | 7 func base.method() |
6 return 1 | 8 return 1 |
18 call assert_false([base.method] == [base.other]) | 20 call assert_false([base.method] == [base.other]) |
19 call assert_false(base.method == instance.other) | 21 call assert_false(base.method == instance.other) |
20 call assert_false([base.method] == [instance.other]) | 22 call assert_false([base.method] == [instance.other]) |
21 | 23 |
22 call assert_fails('echo base.method > instance.method') | 24 call assert_fails('echo base.method > instance.method') |
25 call assert_equal(0, test_null_function() == function('min')) | |
26 call assert_equal(1, test_null_function() == test_null_function()) | |
23 endfunc | 27 endfunc |
24 | 28 |
25 func Test_version() | 29 func Test_version() |
26 call assert_true(has('patch-7.4.001')) | 30 call assert_true(has('patch-7.4.001')) |
27 call assert_true(has('patch-7.4.01')) | 31 call assert_true(has('patch-7.4.01')) |
581 call assert_fails("let v = 10 + []", 'E745:') | 585 call assert_fails("let v = 10 + []", 'E745:') |
582 call assert_fails("let v = 10 / []", 'E745:') | 586 call assert_fails("let v = 10 / []", 'E745:') |
583 call assert_fails("let v = -{}", 'E728:') | 587 call assert_fails("let v = -{}", 'E728:') |
584 endfunc | 588 endfunc |
585 | 589 |
590 " Test for float value comparison | |
591 func Test_float_compare() | |
592 CheckFeature float | |
593 call assert_true(1.2 == 1.2) | |
594 call assert_true(1.0 != 1.2) | |
595 call assert_true(1.2 > 1.0) | |
596 call assert_true(1.2 >= 1.2) | |
597 call assert_true(1.0 < 1.2) | |
598 call assert_true(1.2 <= 1.2) | |
599 call assert_true(+0.0 == -0.0) | |
600 " two NaNs (not a number) are not equal | |
601 call assert_true(sqrt(-4.01) != (0.0 / 0.0)) | |
602 " two inf (infinity) are equal | |
603 call assert_true((1.0 / 0) == (2.0 / 0)) | |
604 " two -inf (infinity) are equal | |
605 call assert_true(-(1.0 / 0) == -(2.0 / 0)) | |
606 " +infinity != -infinity | |
607 call assert_true((1.0 / 0) != -(2.0 / 0)) | |
608 endfunc | |
609 | |
586 " vim: shiftwidth=2 sts=2 expandtab | 610 " vim: shiftwidth=2 sts=2 expandtab |