Mercurial > vim
comparison src/testdir/test_filter_map.vim @ 17936:7f3283683d97 v8.1.1964
patch 8.1.1964: crash when using nested map() and filter()
Commit: https://github.com/vim/vim/commit/c36350bca3eed8ef97061e28c38b5b89cae1f13e
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Sep 2 20:44:07 2019 +0200
patch 8.1.1964: crash when using nested map() and filter()
Problem: Crash when using nested map() and filter().
Solution: Do not set the v:key type to string without clearing the pointer.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 02 Sep 2019 20:45:04 +0200 |
parents | 051937ebaf22 |
children | 745c02392844 |
comparison
equal
deleted
inserted
replaced
17935:c539b7a1fda0 | 17936:7f3283683d97 |
---|---|
51 return a:index * 2 | 51 return a:index * 2 |
52 endfunc | 52 endfunc |
53 call assert_equal([0, 2, 4, 6], map([1, 2, 3, 4], function('s:filter4'))) | 53 call assert_equal([0, 2, 4, 6], map([1, 2, 3, 4], function('s:filter4'))) |
54 endfunc | 54 endfunc |
55 | 55 |
56 func Test_filter_map_nested() | |
57 let x = {"x":10} | |
58 let r = map(range(2), 'filter(copy(x), "1")') | |
59 call assert_equal([x, x], r) | |
60 endfunc | |
61 | |
56 " dict with funcref | 62 " dict with funcref |
57 func Test_filter_map_dict_expr_funcref() | 63 func Test_filter_map_dict_expr_funcref() |
58 let dict = {"foo": 1, "bar": 2, "baz": 3} | 64 let dict = {"foo": 1, "bar": 2, "baz": 3} |
59 | 65 |
60 " filter() | 66 " filter() |