summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0980
blob: 091d95943704d470b10667142bee7bffa5a2337b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0980
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.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    ///