To: vim_dev@googlegroups.com Subject: Patch 8.2.2098 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2098 Problem: Vim9: function argument of sort() and map() not tested. Solution: Add a couple of tests. Files: src/testdir/test_vim9_builtin.vim *** ../vim-8.2.2097/src/testdir/test_vim9_builtin.vim 2020-12-02 17:36:49.173409740 +0100 --- src/testdir/test_vim9_builtin.vim 2020-12-05 21:44:42.006781959 +0100 *************** *** 229,234 **** --- 229,246 ---- return filter(items, {_, val -> get({[val]: 1}, 'x')}) enddef + def Test_map_function_arg() + var lines =<< trim END + def MapOne(i: number, v: string): string + return i .. ':' .. v + enddef + var l = ['a', 'b', 'c'] + map(l, MapOne) + assert_equal(['0:a', '1:b', '2:c'], l) + END + CheckDefAndScriptSuccess(lines) + enddef + def Test_filter_wrong_dict_key_type() assert_fails('Wrong_dict_key_type([1, 2, 3])', 'E1012:') enddef *************** *** 523,530 **** enddef def Test_sort_argument() ! var res = ['b', 'a', 'c']->sort('i') ! res->assert_equal(['a', 'b', 'c']) enddef def Test_split() --- 535,552 ---- enddef def Test_sort_argument() ! var lines =<< trim END ! var res = ['b', 'a', 'c']->sort('i') ! res->assert_equal(['a', 'b', 'c']) ! ! def Compare(a: number, b: number): number ! return a - b ! enddef ! var l = [3, 6, 7, 1, 8, 2, 4, 5] ! sort(l, Compare) ! assert_equal([1, 2, 3, 4, 5, 6, 7, 8], l) ! END ! CheckDefAndScriptSuccess(lines) enddef def Test_split() *** ../vim-8.2.2097/src/version.c 2020-12-05 21:22:03.626811733 +0100 --- src/version.c 2020-12-05 21:40:09.127596388 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2098, /**/ -- MONK: ... and the Lord spake, saying, "First shalt thou take out the Holy Pin, then shalt thou count to three, no more, no less. Three shalt be the number thou shalt count, and the number of the counting shalt be three. Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. Five is right out. Once the number three, being the third number, be reached, then lobbest thou thy Holy Hand Grenade of Antioch towards thou foe, who being naughty in my sight, shall snuff it. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///