To: vim_dev@googlegroups.com Subject: Patch 8.1.0980 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0980 Problem: extend() insufficiently tested. Solution: Add more tests. (Dominique Pelle, closes #4040) Files: src/testdir/test_listdict.vim *** ../vim-8.1.0979/src/testdir/test_listdict.vim 2019-02-10 22:14:24.184352831 +0100 --- src/testdir/test_listdict.vim 2019-02-25 05:51:20.254607204 +0100 *************** *** 641,659 **** endfunc func Test_listdict_extend() " Pass the same List to extend() ! let l = [1, 2, 3, 4, 5] ! call extend(l, l) ! call assert_equal([1, 2, 3, 4, 5, 1, 2, 3, 4, 5], l) " Pass the same Dict to extend() let d = { 'a': {'b': 'B'}} call extend(d, d) call assert_equal({'a': {'b': 'B'}}, d) ! " Pass the same Dict to extend() with "error" ! call assert_fails("call extend(d, d, 'error')", 'E737:') ! call assert_equal({'a': {'b': 'B'}}, d) endfunc func s:check_scope_dict(x, fixed) --- 641,709 ---- endfunc func Test_listdict_extend() + " Test extend() with lists + " Pass the same List to extend() ! let l = [1, 2, 3] ! call assert_equal([1, 2, 3, 1, 2, 3], extend(l, l)) ! call assert_equal([1, 2, 3, 1, 2, 3], l) ! ! let l = [1, 2, 3] ! call assert_equal([1, 2, 3, 4, 5, 6], extend(l, [4, 5, 6])) ! call assert_equal([1, 2, 3, 4, 5, 6], l) ! ! let l = [1, 2, 3] ! call extend(l, [4, 5, 6], 0) ! call assert_equal([4, 5, 6, 1, 2, 3], l) ! ! let l = [1, 2, 3] ! call extend(l, [4, 5, 6], 1) ! call assert_equal([1, 4, 5, 6, 2, 3], l) ! ! let l = [1, 2, 3] ! call extend(l, [4, 5, 6], 3) ! call assert_equal([1, 2, 3, 4, 5, 6], l) ! ! let l = [1, 2, 3] ! call extend(l, [4, 5, 6], -1) ! call assert_equal([1, 2, 4, 5, 6, 3], l) ! ! let l = [1, 2, 3] ! call extend(l, [4, 5, 6], -3) ! call assert_equal([4, 5, 6, 1, 2, 3], l) ! ! let l = [1, 2, 3] ! call assert_fails("call extend(l, [4, 5, 6], 4)", 'E684:') ! call assert_fails("call extend(l, [4, 5, 6], -4)", 'E684:') ! call assert_fails("call extend(l, [4, 5, 6], 1.2)", 'E805:') ! ! " Test extend() with dictionaries. " Pass the same Dict to extend() let d = { 'a': {'b': 'B'}} call extend(d, d) call assert_equal({'a': {'b': 'B'}}, d) ! let d = {'a': 'A', 'b': 'B'} ! call assert_equal({'a': 'A', 'b': 0, 'c': 'C'}, extend(d, {'b': 0, 'c':'C'})) ! call assert_equal({'a': 'A', 'b': 0, 'c': 'C'}, d) ! ! let d = {'a': 'A', 'b': 'B'} ! call extend(d, {'a': 'A', 'b': 0, 'c': 'C'}, "force") ! call assert_equal({'a': 'A', 'b': 0, 'c': 'C'}, d) ! ! let d = {'a': 'A', 'b': 'B'} ! call extend(d, {'b': 0, 'c':'C'}, "keep") ! call assert_equal({'a': 'A', 'b': 'B', 'c': 'C'}, d) ! ! let d = {'a': 'A', 'b': 'B'} ! call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 'error')", 'E737:') ! call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 'xxx')", 'E475:') ! call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 1.2)", 'E806:') ! call assert_equal({'a': 'A', 'b': 'B'}, d) ! ! call assert_fails("call extend([1, 2], 1)", 'E712:') ! call assert_fails("call extend([1, 2], {})", 'E712:') endfunc func s:check_scope_dict(x, fixed) *** ../vim-8.1.0979/src/version.c 2019-02-25 05:40:59.171067556 +0100 --- src/version.c 2019-02-25 05:54:54.821056710 +0100 *************** *** 781,782 **** --- 781,784 ---- { /* Add new patch number below this line */ + /**/ + 980, /**/ -- Bypasses are devices that allow some people to dash from point A to point B very fast while other people dash from point B to point A very fast. People living at point C, being a point directly in between, are often given to wonder what's so great about point A that so many people from point B are so keen to get there and what's so great about point B that so many people from point A are so keen to get there. They often wish that people would just once and for all work out where the hell they wanted to be. -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" /// 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 ///