Mercurial > vim
diff src/testdir/test_filter_map.vim @ 23058:77f181975381 v8.2.2075
patch 8.2.2075: error for const argument to mapnew()
Commit: https://github.com/vim/vim/commit/57cf4973a283941c92744554474b2c52ce892fd1
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 1 21:08:05 2020 +0100
patch 8.2.2075: error for const argument to mapnew()
Problem: Error for const argument to mapnew().
Solution: Don't give an error. (closes https://github.com/vim/vim/issues/7400)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 01 Dec 2020 21:15:03 +0100 |
parents | 36fc73078bce |
children | 06693d1afc48 |
line wrap: on
line diff
--- a/src/testdir/test_filter_map.vim +++ b/src/testdir/test_filter_map.vim @@ -123,6 +123,9 @@ func Test_mapnew_dict() let dout = mapnew(din, {k, v -> string(v)}) call assert_equal(#{one: 1, two: 2}, din) call assert_equal(#{one: '1', two: '2'}, dout) + + const dconst = #{one: 1, two: 2, three: 3} + call assert_equal(#{one: 2, two: 3, three: 4}, mapnew(dconst, {_, v -> v + 1})) endfunc func Test_mapnew_list() @@ -130,6 +133,9 @@ func Test_mapnew_list() let lout = mapnew(lin, {k, v -> string(v)}) call assert_equal([1, 2, 3], lin) call assert_equal(['1', '2', '3'], lout) + + const lconst = [1, 2, 3] + call assert_equal([2, 3, 4], mapnew(lconst, {_, v -> v + 1})) endfunc func Test_mapnew_blob()