diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-02-24 15:03:28 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-02-24 15:36:08 +0800 |
commit | 904d0995837a2569ae640f5253da3dd4569fec6f (patch) | |
tree | cf18e60265b26ed416e71c64b0370c3cb436e73e /src/nvim/testdir | |
parent | 47bc297d81cf7dab5a28608657ddab3c09f794d0 (diff) | |
download | rneovim-904d0995837a2569ae640f5253da3dd4569fec6f.tar.gz rneovim-904d0995837a2569ae640f5253da3dd4569fec6f.tar.bz2 rneovim-904d0995837a2569ae640f5253da3dd4569fec6f.zip |
vim-patch:8.2.2449: Vim9: flatten() always changes the list type
Problem: Vim9: flatten() always changes the list type.
Solution: Disallow using flatten() and add flattennew().
https://github.com/vim/vim/commit/3b690069730805a147d45d92eaca4dc838272d1d
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r-- | src/nvim/testdir/test_flatten.vim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_flatten.vim b/src/nvim/testdir/test_flatten.vim index 99086611e1..d8abc1ad68 100644 --- a/src/nvim/testdir/test_flatten.vim +++ b/src/nvim/testdir/test_flatten.vim @@ -79,3 +79,14 @@ func Test_flatten() call assert_equal([1, 2, 1, 2], flatten(l:x, 2)) call assert_equal([2, l:x], l:y) endfunc + +func Test_flattennew() + let l = [1, [2, [3, 4]], 5] + call assert_equal([1, 2, 3, 4, 5], flattennew(l)) + call assert_equal([1, [2, [3, 4]], 5], l) + + call assert_equal([1, 2, [3, 4], 5], flattennew(l, 1)) + call assert_equal([1, [2, [3, 4]], 5], l) +endfunc + +" vim: shiftwidth=2 sts=2 expandtab |