diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-14 11:00:17 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-04-14 18:04:09 +0800 |
commit | d6e2804ab4f8810293dbcd748bfb938d9e0c3d52 (patch) | |
tree | ee140b0eee513de0aad0cf6cbd55d56f4799dd7f /test | |
parent | 7caf0eafd83b5a92f2ff219b3a64ffae4174b9af (diff) | |
download | rneovim-d6e2804ab4f8810293dbcd748bfb938d9e0c3d52.tar.gz rneovim-d6e2804ab4f8810293dbcd748bfb938d9e0c3d52.tar.bz2 rneovim-d6e2804ab4f8810293dbcd748bfb938d9e0c3d52.zip |
vim-patch:8.2.1794: no falsy Coalescing operator
Problem: No falsy Coalescing operator.
Solution: Add the "??" operator. Fix mistake with function argument count.
https://github.com/vim/vim/commit/92f26c256e06277ff2ec4ce7adea1eb58c85abe0
Cherry-pick tv2bool() into eval/typval.c.
Cherry-pick *??* tag from Vim runtime.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/test_expr.vim | 22 | ||||
-rw-r--r-- | test/old/testdir/test_help_tagjump.vim | 4 |
2 files changed, 23 insertions, 3 deletions
diff --git a/test/old/testdir/test_expr.vim b/test/old/testdir/test_expr.vim index 292a504df9..66a59f2c44 100644 --- a/test/old/testdir/test_expr.vim +++ b/test/old/testdir/test_expr.vim @@ -39,6 +39,28 @@ func Test_version() call assert_false(has('patch-9.9.1')) endfunc +func Test_op_falsy() + call assert_equal(v:true, v:true ?? 456) + call assert_equal(123, 123 ?? 456) + call assert_equal('yes', 'yes' ?? 456) + call assert_equal(0z00, 0z00 ?? 456) + call assert_equal([1], [1] ?? 456) + call assert_equal(#{one: 1}, #{one: 1} ?? 456) + if has('float') + call assert_equal(0.1, 0.1 ?? 456) + endif + + call assert_equal(456, v:false ?? 456) + call assert_equal(456, 0 ?? 456) + call assert_equal(456, '' ?? 456) + call assert_equal(456, 0z ?? 456) + call assert_equal(456, [] ?? 456) + call assert_equal(456, {} ?? 456) + if has('float') + call assert_equal(456, 0.0 ?? 456) + endif +endfunc + func Test_dict() let d = {'': 'empty', 'a': 'a', 0: 'zero'} call assert_equal('empty', d['']) diff --git a/test/old/testdir/test_help_tagjump.vim b/test/old/testdir/test_help_tagjump.vim index eae1a241e3..8a58d2f13c 100644 --- a/test/old/testdir/test_help_tagjump.vim +++ b/test/old/testdir/test_help_tagjump.vim @@ -35,9 +35,7 @@ func Test_help_tagjump() help ?? call assert_equal("help", &filetype) - " *??* tag needs patch 8.2.1794 - " call assert_true(getline('.') =~ '\*??\*') - call assert_true(getline('.') =~ '\*g??\*') + call assert_true(getline('.') =~ '\*??\*') helpclose help :? |