summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0163
blob: f85411a6b9dd11c1753815b47fed2c8c5c58dca7 (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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0163
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.0163
Problem:    Insufficient testing for Tcl.
Solution:   Add a few more tests. (Dominique Pelle, closes #3166)
Files:      src/testdir/test_tcl.vim


*** ../vim-8.1.0162/src/testdir/test_tcl.vim	Wed Jul  4 22:36:42 2018
--- src/testdir/test_tcl.vim	Sat Jul  7 22:39:36 2018
***************
*** 110,115 ****
--- 110,126 ----
    call assert_equal('+4', &cc)
    call assert_equal('+4', TclEval('::vim::option cc'))
  
+   " Test boolean option with 'toggle', 'on' and 'off' keywords.
+   call assert_equal('0', TclEval('::vim::option nu toggle'))
+   call assert_equal(1, &nu)
+   call assert_equal('1', TclEval('::vim::option nu toggle'))
+   call assert_equal(0, &nu)
+   call assert_equal('0', TclEval('::vim::option nu on'))
+   call assert_equal(1, &nu)
+   call assert_equal('1', TclEval('::vim::option nu off'))
+   call assert_equal(0, &nu)
+ 
+   call assert_fails('tcl ::vim::option nu x', 'expected integer but got "x"')
    call assert_fails('tcl ::vim::option xxx', 'unknown vimOption')
    call assert_fails('tcl ::vim::option',
          \           'wrong # args: should be "::vim::option vimOption ?value?"')
***************
*** 124,129 ****
--- 135,141 ----
  
    call assert_fails('tcl ::vim::expr x y',
          \           'wrong # args: should be "::vim::expr vimExpr"')
+   call assert_fails('tcl ::vim::expr 1-', 'E15: Invalid expression: 1-')
  endfunc
  
  " Test ::vim::command
***************
*** 131,136 ****
--- 143,153 ----
    call assert_equal('hello world',
          \           TclEval('::vim::command {echo "hello world"}'))
  
+   " Check that if ::vim::command created a new Tcl interpreter, it is removed.
+   tcl set foo 123
+   call assert_equal('321', TclEval('::vim::command "tcl set foo 321"'))
+   call assert_equal('123', TclEval('set foo'))
+ 
    " With the -quiet option, the error should silently be ignored.
    call assert_equal('', TclEval('::vim::command -quiet xyz'))
  
***************
*** 142,147 ****
--- 159,166 ----
  
    " With the -quiet option, the error should silently be ignored.
    call assert_equal('', TclEval('::vim::command -quiet xyz'))
+ 
+   tcl unset foo
  endfunc
  
  " Test ::vim::window list
***************
*** 164,175 ****
  
  " Test output messages
  func Test_output()
!   call assert_fails('tcl puts vimerr "an error"', 'an error')
!   tcl puts vimout "a message"
!   tcl puts "another message"
    let messages = split(execute('message'), "\n")
!   call assert_equal('a message', messages[-2])
!   call assert_equal('another message', messages[-1])
  
    call assert_fails('tcl puts',
          \           'wrong # args: should be "puts ?-nonewline? ?channelId? string"')
--- 183,197 ----
  
  " Test output messages
  func Test_output()
!   call assert_fails('tcl puts vimerr "error #1"', 'error #1')
!   call assert_fails('tcl puts stderr "error #2"', 'error #2')
!   tcl puts vimout "message #1"
!   tcl puts stdout "message #2"
!   tcl puts "message #3"
    let messages = split(execute('message'), "\n")
!   call assert_equal('message #3', messages[-1])
!   call assert_equal('message #2', messages[-2])
!   call assert_equal('message #1', messages[-3])
  
    call assert_fails('tcl puts',
          \           'wrong # args: should be "puts ?-nonewline? ?channelId? string"')
***************
*** 447,459 ****
    call setline(1, ['line1', 'line2', 'line3', 'line4', 'line5'])
    tcl $::vim::current(buffer) set 2 a
    call assert_equal(['line1', 'a', 'line3', 'line4', 'line5'], getline(1, '$'))
    tcl $::vim::current(buffer) set 3 4 b
    call assert_equal(['line1', 'a', 'b', 'line5'], getline(1, '$'))
    tcl $::vim::current(buffer) set 4 3 c
    call assert_equal(['line1', 'a', 'c'], getline(1, '$'))
  
    call assert_fails('tcl $::vim::current(buffer) set 0 "x"', 'line number out of range')
!   call assert_fails('tcl $::vim::current(buffer) set 5 "x"', 'line number out of range')
  
    call assert_fails('tcl $::vim::current(buffer) set', 'wrong # args:')
    bwipe!
--- 469,489 ----
    call setline(1, ['line1', 'line2', 'line3', 'line4', 'line5'])
    tcl $::vim::current(buffer) set 2 a
    call assert_equal(['line1', 'a', 'line3', 'line4', 'line5'], getline(1, '$'))
+ 
+   " Test with fewer replacing lines than replaced lines: lines get deleted.
    tcl $::vim::current(buffer) set 3 4 b
    call assert_equal(['line1', 'a', 'b', 'line5'], getline(1, '$'))
    tcl $::vim::current(buffer) set 4 3 c
    call assert_equal(['line1', 'a', 'c'], getline(1, '$'))
  
+   " Test with more replacing lines than replaced lines: lines get added.
+   tcl $::vim::current(buffer) set 2 3 {x y z}
+   call assert_equal(['line1', 'x', 'y', 'z'], getline(1, '$'))
+   tcl $::vim::current(buffer) set 3 2 {X Y Z}
+   call assert_equal(['line1', 'X', 'Y', 'Z', 'z'], getline(1, '$'))
+ 
    call assert_fails('tcl $::vim::current(buffer) set 0 "x"', 'line number out of range')
!   call assert_fails('tcl $::vim::current(buffer) set 6 "x"', 'line number out of range')
  
    call assert_fails('tcl $::vim::current(buffer) set', 'wrong # args:')
    bwipe!
***************
*** 622,628 ****
    call delete('Xtcl_file')
  endfunc
  
! " Test exiting current Tcl interprepter and re-creating one.
  func Test_tcl_exit()
    tcl set foo "foo"
    call assert_fails('tcl exit 3', 'E572: exit code 3')
--- 652,658 ----
    call delete('Xtcl_file')
  endfunc
  
! " Test exiting current Tcl interpreter and re-creating one.
  func Test_tcl_exit()
    tcl set foo "foo"
    call assert_fails('tcl exit 3', 'E572: exit code 3')
*** ../vim-8.1.0162/src/version.c	Sat Jul  7 22:26:49 2018
--- src/version.c	Sat Jul  7 22:39:52 2018
***************
*** 791,792 ****
--- 791,794 ----
  {   /* Add new patch number below this line */
+ /**/
+     163,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
200. You really believe in the concept of a "paperless" office.

 /// 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    ///