diff options
Diffstat (limited to 'data/vim/patches/8.1.0440')
-rw-r--r-- | data/vim/patches/8.1.0440 | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/data/vim/patches/8.1.0440 b/data/vim/patches/8.1.0440 new file mode 100644 index 000000000..ca0bfe05a --- /dev/null +++ b/data/vim/patches/8.1.0440 @@ -0,0 +1,100 @@ +To: vim_dev@googlegroups.com +Subject: Patch 8.1.0440 +Fcc: outbox +From: Bram Moolenaar <Bram@moolenaar.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +------------ + +Patch 8.1.0440 +Problem: remove() with a range not sufficiently tested. +Solution: Add a test. (Dominique Pelle, closes #3497) +Files: src/testdir/test_listdict.vim + + +*** ../vim-8.1.0439/src/testdir/test_listdict.vim 2017-11-05 20:53:03.000000000 +0100 +--- src/testdir/test_listdict.vim 2018-09-30 17:14:40.140106358 +0200 +*************** +*** 106,111 **** +--- 106,148 ---- + call assert_equal([1, 2], l) + endfunc + ++ " Test removing items in list ++ func Test_list_func_remove() ++ " Test removing 1 element ++ let l = [1, 2, 3, 4] ++ call assert_equal(1, remove(l, 0)) ++ call assert_equal([2, 3, 4], l) ++ ++ let l = [1, 2, 3, 4] ++ call assert_equal(2, remove(l, 1)) ++ call assert_equal([1, 3, 4], l) ++ ++ let l = [1, 2, 3, 4] ++ call assert_equal(4, remove(l, -1)) ++ call assert_equal([1, 2, 3], l) ++ ++ " Test removing range of element(s) ++ let l = [1, 2, 3, 4] ++ call assert_equal([3], remove(l, 2, 2)) ++ call assert_equal([1, 2, 4], l) ++ ++ let l = [1, 2, 3, 4] ++ call assert_equal([2, 3], remove(l, 1, 2)) ++ call assert_equal([1, 4], l) ++ ++ let l = [1, 2, 3, 4] ++ call assert_equal([2, 3], remove(l, -3, -2)) ++ call assert_equal([1, 4], l) ++ ++ " Test invalid cases ++ let l = [1, 2, 3, 4] ++ call assert_fails("call remove(l, 5)", 'E684:') ++ call assert_fails("call remove(l, 1, 5)", 'E684:') ++ call assert_fails("call remove(l, 3, 2)", 'E16:') ++ call assert_fails("call remove(1, 0)", 'E712:') ++ call assert_fails("call remove(l, l)", 'E745:') ++ endfunc ++ + " Tests for Dictionary type + + func Test_dict() +*************** +*** 222,227 **** +--- 259,275 ---- + unlet g:dict + endfunc + ++ " Test removing items in la dictionary ++ func Test_dict_func_remove() ++ let d = {1:'a', 2:'b', 3:'c'} ++ call assert_equal('b', remove(d, 2)) ++ call assert_equal({1:'a', 3:'c'}, d) ++ ++ call assert_fails("call remove(d, 1, 2)", 'E118:') ++ call assert_fails("call remove(d, 'a')", 'E716:') ++ call assert_fails("call remove(d, [])", 'E730:') ++ endfunc ++ + " Nasty: remove func from Dict that's being called (works) + func Test_dict_func_remove_in_use() + let d = {1:1} +*** ../vim-8.1.0439/src/version.c 2018-09-30 17:11:45.305649987 +0200 +--- src/version.c 2018-09-30 17:15:38.475550891 +0200 +*************** +*** 796,797 **** +--- 796,799 ---- + { /* Add new patch number below this line */ ++ /**/ ++ 440, + /**/ + +-- +I have a watch cat! Just break in and she'll watch. + + /// 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 /// |