aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-02-24 15:03:28 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-02-24 15:36:08 +0800
commit904d0995837a2569ae640f5253da3dd4569fec6f (patch)
treecf18e60265b26ed416e71c64b0370c3cb436e73e /src/nvim/testdir
parent47bc297d81cf7dab5a28608657ddab3c09f794d0 (diff)
downloadrneovim-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.vim11
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