summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1180
blob: 21174606d565158c31c316d4540a9f186e16be36 (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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1180
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.1180
Problem:    Vim script debugger tests are old style.
Solution:   Turn into new style tests. (Yegappan Lakshmanan, closes #4259)
Files:	    src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_vms.mms,
            src/testdir/test108.in, src/testdir/test108.ok,
            src/testdir/test_debugger.vim


*** ../vim-8.1.1179/src/Makefile	2019-04-11 18:13:53.337894322 +0200
--- src/Makefile	2019-04-17 16:49:23.358684152 +0200
***************
*** 2176,2182 ****
  	test64 test69 \
  	test70 test72 \
  	test86 test87 test88 \
! 	test94 test95 test99 test108:
  	cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
  
  # Run individual NEW style test.
--- 2176,2182 ----
  	test64 test69 \
  	test70 test72 \
  	test86 test87 test88 \
! 	test94 test95 test99:
  	cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
  
  # Run individual NEW style test.
*** ../vim-8.1.1179/src/testdir/Make_all.mak	2019-04-07 14:21:26.226339351 +0200
--- src/testdir/Make_all.mak	2019-04-17 16:49:23.358684152 +0200
***************
*** 28,34 ****
  	test94.out \
  	test95.out \
  	test99.out \
- 	test108.out \
  	test_eval.out
  
  
--- 28,33 ----
***************
*** 97,102 ****
--- 96,102 ----
  	test_cscope \
  	test_cursor_func \
  	test_curswant \
+ 	test_debugger \
  	test_delete \
  	test_diffmode \
  	test_digraph \
***************
*** 312,317 ****
--- 312,318 ----
  	test_crypt.res \
  	test_cscope.res \
  	test_curswant.res \
+ 	test_debugger.res \
  	test_diffmode.res \
  	test_digraph.res \
  	test_display.res \
*** ../vim-8.1.1179/src/testdir/Make_vms.mms	2018-07-14 21:48:42.444978086 +0200
--- src/testdir/Make_vms.mms	2019-04-17 16:49:23.358684152 +0200
***************
*** 80,86 ****
         test42.out test44.out test48.out test49.out \
         test64.out test69.out \
         test72.out test77a.out test88.out \
!        test94.out test95.out test99.out test108.out \
         test_eval.out
  
  # Known problems:
--- 80,86 ----
         test42.out test44.out test48.out test49.out \
         test64.out test69.out \
         test72.out test77a.out test88.out \
!        test94.out test95.out test99.out \
         test_eval.out
  
  # Known problems:
*** ../vim-8.1.1179/src/testdir/test108.in	2016-01-16 22:06:08.000000000 +0100
--- src/testdir/test108.in	1970-01-01 01:00:00.000000000 +0100
***************
*** 1,88 ****
- Tests for backtrace debug commands.     vim: set ft=vim :
- 
- STARTTEST
- :so small.vim
- :lang mess C
- :function! Foo()
- :   let var1 = 1
- :   let var2 = Bar(var1) + 9
- :   return var2
- :endfunction
- :
- :function! Bar(var)
- :    let var1 = 2 + a:var
- :    let var2 = Bazz(var1) + 4
- :    return var2
- :endfunction
- :
- :function! Bazz(var)
- :    let var1 = 3 + a:var
- :    let var3 = "another var"
- :    return var1
- :endfunction
- :new
- :debuggreedy
- :redir => out
- :debug echo Foo()
- step
- step
- step
- step
- step
- step
- echo "- show backtrace:\n"
- backtrace
- echo "\nshow variables on different levels:\n"
- echo var1
- up
- back
- echo var1
- u
- bt
- echo var1
- echo "\n- undefined vars:\n"
- step
- frame 2
- echo "undefined var3 on former level:"
- echo var3
- fr 0
- echo "here var3 is defined with \"another var\":"
- echo var3
- step
- step
- step
- up
- echo "\nundefined var2 on former level"
- echo var2
- down
- echo "here var2 is defined with 10:"
- echo var2
- echo "\n- backtrace movements:\n"
- b
- echo "\nnext command cannot go down, we are on bottom\n"
- down
- up
- echo "\nnext command cannot go up, we are on top\n"
- up
- b
- echo "fil is not frame or finish, it is file"
- fil
- echo "\n- relative backtrace movement\n"
- fr -1
- frame
- fra +1
- fram
- echo "\n- go beyond limits does not crash\n"
- fr 100
- fra
- frame -40
- fram
- echo "\n- final result 19:"
- cont
- :0debuggreedy
- :redir END
- :$put =out
- :w! test.out
- :qa!
- ENDTEST
- 
--- 0 ----
*** ../vim-8.1.1179/src/testdir/test108.ok	2018-11-28 20:38:34.564273386 +0100
--- src/testdir/test108.ok	1970-01-01 01:00:00.000000000 +0100
***************
*** 1,82 ****
- 
- 
- 
- - show backtrace:
- 
-   2 function Foo[2]
-   1 Bar[2]
- ->0 Bazz
- line 2: let var3 = "another var"
- 
- show variables on different levels:
- 
- 6
-   2 function Foo[2]
- ->1 Bar[2]
-   0 Bazz
- line 2: let var3 = "another var"
- 3
- ->2 function Foo[2]
-   1 Bar[2]
-   0 Bazz
- line 2: let var3 = "another var"
- 1
- 
- - undefined vars:
- 
- undefined var3 on former level:
- Error detected while processing function Foo[2]..Bar[2]..Bazz:
- line    3:
- E121: Undefined variable: var3
- here var3 is defined with "another var":
- another var
- 
- undefined var2 on former level
- Error detected while processing function Foo[2]..Bar:
- line    3:
- E121: Undefined variable: var2
- here var2 is defined with 10:
- 10
- 
- - backtrace movements:
- 
-   1 function Foo[2]
- ->0 Bar
- line 3: End of function
- 
- next command cannot go down, we are on bottom
- 
- frame is zero
- 
- next command cannot go up, we are on top
- 
- frame at highest level: 1
- ->1 function Foo[2]
-   0 Bar
- line 3: End of function
- fil is not frame or finish, it is file
- "[No Name]" --No lines in buffer--
- 
- - relative backtrace movement
- 
-   1 function Foo[2]
- ->0 Bar
- line 3: End of function
- ->1 function Foo[2]
-   0 Bar
- line 3: End of function
- 
- - go beyond limits does not crash
- 
- frame at highest level: 1
- ->1 function Foo[2]
-   0 Bar
- line 3: End of function
- frame is zero
-   1 function Foo[2]
- ->0 Bar
- line 3: End of function
- 
- - final result 19:
- 19
- 
--- 0 ----
*** ../vim-8.1.1179/src/testdir/test_debugger.vim	2019-04-17 16:52:46.237656050 +0200
--- src/testdir/test_debugger.vim	2019-04-17 16:51:44.169971069 +0200
***************
*** 0 ****
--- 1,232 ----
+ " Tests for the Vim script debug commands
+ 
+ source shared.vim
+ source screendump.vim
+ 
+ " Run a Vim debugger command
+ " If the expected output argument is supplied, then check for it.
+ func RunDbgCmd(buf, cmd, ...)
+   call term_sendkeys(a:buf, a:cmd . "\r")
+   call term_wait(a:buf)
+ 
+   if a:0 != 0
+     " Verify the expected output
+     let lnum = 20 - len(a:1)
+     for l in a:1
+       call WaitForAssert({-> assert_equal(l, term_getline(a:buf, lnum))})
+       let lnum += 1
+     endfor
+   endif
+ endfunc
+ 
+ " Debugger tests
+ func Test_Debugger()
+   if !CanRunVimInTerminal()
+     return
+   endif
+ 
+   " Create a Vim script with some functions
+   call writefile([
+ 	      \ 'func Foo()',
+ 	      \ '  let var1 = 1',
+ 	      \ '  let var2 = Bar(var1) + 9',
+ 	      \ '  return var2',
+ 	      \ 'endfunc',
+ 	      \ 'func Bar(var)',
+ 	      \ '  let var1 = 2 + a:var',
+ 	      \ '  let var2 = Bazz(var1) + 4',
+ 	      \ '  return var2',
+ 	      \ 'endfunc',
+ 	      \ 'func Bazz(var)',
+ 	      \ '  let var1 = 3 + a:var',
+ 	      \ '  let var3 = "another var"',
+ 	      \ '  let var3 = "value2"',
+ 	      \ '  let var3 = "value3"',
+ 	      \ '  return var1',
+ 	      \ 'endfunc'], 'Xtest.vim')
+ 
+   " Start Vim in a terminal
+   let buf = RunVimInTerminal('-S Xtest.vim', {})
+ 
+   " Start the Vim debugger
+   call RunDbgCmd(buf, ':debug echo Foo()')
+ 
+   " Create a few stack frames by stepping through functions
+   call RunDbgCmd(buf, 'step')
+   call RunDbgCmd(buf, 'step')
+   call RunDbgCmd(buf, 'step')
+   call RunDbgCmd(buf, 'step')
+   call RunDbgCmd(buf, 'step')
+   call RunDbgCmd(buf, 'step')
+ 
+   " check backtrace
+   call RunDbgCmd(buf, 'backtrace', [
+ 	      \ '  2 function Foo[2]',
+ 	      \ '  1 Bar[2]',
+ 	      \ '->0 Bazz',
+ 	      \ 'line 2: let var3 = "another var"'])
+ 
+   " Check variables in different stack frames
+   call RunDbgCmd(buf, 'echo var1', ['6'])
+ 
+   call RunDbgCmd(buf, 'up')
+   call RunDbgCmd(buf, 'back', [
+ 	      \ '  2 function Foo[2]',
+ 	      \ '->1 Bar[2]',
+ 	      \ '  0 Bazz',
+ 	      \ 'line 2: let var3 = "another var"'])
+   call RunDbgCmd(buf, 'echo var1', ['3'])
+ 
+   call RunDbgCmd(buf, 'u')
+   call RunDbgCmd(buf, 'bt', [
+ 	      \ '->2 function Foo[2]',
+ 	      \ '  1 Bar[2]',
+ 	      \ '  0 Bazz',
+ 	      \ 'line 2: let var3 = "another var"'])
+   call RunDbgCmd(buf, 'echo var1', ['1'])
+ 
+   " Undefined variables
+   call RunDbgCmd(buf, 'step')
+   call RunDbgCmd(buf, 'frame 2')
+   call RunDbgCmd(buf, 'echo var3', [
+ 	\ 'Error detected while processing function Foo[2]..Bar[2]..Bazz:',
+ 	\ 'line    3:',
+ 	\ 'E121: Undefined variable: var3'])
+ 
+   " var3 is defined in this level with some other value
+   call RunDbgCmd(buf, 'fr 0')
+   call RunDbgCmd(buf, 'echo var3', ['another var'])
+ 
+   call RunDbgCmd(buf, 'step')
+   call RunDbgCmd(buf, 'step')
+   call RunDbgCmd(buf, 'step')
+   call RunDbgCmd(buf, 'step')
+   call RunDbgCmd(buf, 'step', [
+ 	      \ 'function Foo[2]..Bar',
+ 	      \ 'line 3: End of function'])
+   call RunDbgCmd(buf, 'up')
+ 
+   " Undefined var2
+   call RunDbgCmd(buf, 'echo var2', [
+ 	      \ 'Error detected while processing function Foo[2]..Bar:',
+ 	      \ 'line    3:',
+ 	      \ 'E121: Undefined variable: var2'])
+ 
+   " Var2 is defined with 10
+   call RunDbgCmd(buf, 'down')
+   call RunDbgCmd(buf, 'echo var2', ['10'])
+ 
+   " Backtrace movements
+   call RunDbgCmd(buf, 'b', [
+ 	      \ '  1 function Foo[2]',
+ 	      \ '->0 Bar',
+ 	      \ 'line 3: End of function'])
+ 
+   " next command cannot go down, we are on bottom
+   call RunDbgCmd(buf, 'down', ['frame is zero'])
+   call RunDbgCmd(buf, 'up')
+ 
+   " next command cannot go up, we are on top
+   call RunDbgCmd(buf, 'up', ['frame at highest level: 1'])
+   call RunDbgCmd(buf, 'where', [
+ 	      \ '->1 function Foo[2]',
+ 	      \ '  0 Bar',
+ 	      \ 'line 3: End of function'])
+ 
+   " fil is not frame or finish, it is file
+   call RunDbgCmd(buf, 'fil', ['"[No Name]" --No lines in buffer--'])
+ 
+   " relative backtrace movement
+   call RunDbgCmd(buf, 'fr -1')
+   call RunDbgCmd(buf, 'frame', [
+ 	      \ '  1 function Foo[2]',
+ 	      \ '->0 Bar',
+ 	      \ 'line 3: End of function'])
+ 
+   call RunDbgCmd(buf, 'fr +1')
+   call RunDbgCmd(buf, 'fram', [
+ 	      \ '->1 function Foo[2]',
+ 	      \ '  0 Bar',
+ 	      \ 'line 3: End of function'])
+ 
+   " go beyond limits does not crash
+   call RunDbgCmd(buf, 'fr 100', ['frame at highest level: 1'])
+   call RunDbgCmd(buf, 'fra', [
+ 	      \ '->1 function Foo[2]',
+ 	      \ '  0 Bar',
+ 	      \ 'line 3: End of function'])
+ 
+   call RunDbgCmd(buf, 'frame -40', ['frame is zero'])
+   call RunDbgCmd(buf, 'fram', [
+ 	      \ '  1 function Foo[2]',
+ 	      \ '->0 Bar',
+ 	      \ 'line 3: End of function'])
+ 
+   " final result 19
+   call RunDbgCmd(buf, 'cont', ['19'])
+ 
+   " breakpoints tests
+ 
+   " Start a debug session, so that reading the last line from the terminal
+   " works properly.
+   call RunDbgCmd(buf, ':debug echo Foo()')
+ 
+   " No breakpoints
+   call RunDbgCmd(buf, 'breakl', ['No breakpoints defined'])
+ 
+   " Place some breakpoints
+   call RunDbgCmd(buf, 'breaka func Bar')
+   call RunDbgCmd(buf, 'breaklis', ['  1  func Bar  line 1'])
+   call RunDbgCmd(buf, 'breakadd func 3 Bazz')
+   call RunDbgCmd(buf, 'breaklist', ['  1  func Bar  line 1',
+ 	      \ '  2  func Bazz  line 3'])
+ 
+   " Check whether the breakpoints are hit
+   call RunDbgCmd(buf, 'cont', [
+ 	      \ 'Breakpoint in "Bar" line 1',
+ 	      \ 'function Foo[2]..Bar',
+ 	      \ 'line 1: let var1 = 2 + a:var'])
+   call RunDbgCmd(buf, 'cont', [
+ 	      \ 'Breakpoint in "Bazz" line 3',
+ 	      \ 'function Foo[2]..Bar[2]..Bazz',
+ 	      \ 'line 3: let var3 = "value2"'])
+ 
+   " Delete the breakpoints
+   call RunDbgCmd(buf, 'breakd 1')
+   call RunDbgCmd(buf, 'breakli', ['  2  func Bazz  line 3'])
+   call RunDbgCmd(buf, 'breakdel func 3 Bazz')
+   call RunDbgCmd(buf, 'breakl', ['No breakpoints defined'])
+ 
+   call RunDbgCmd(buf, 'cont')
+ 
+   " Make sure the breakpoints are removed
+   call RunDbgCmd(buf, ':echo Foo()', ['19'])
+ 
+   " Delete a non-existing breakpoint
+   call RunDbgCmd(buf, ':breakdel 2', ['E161: Breakpoint not found: 2'])
+ 
+   " Expression breakpoint
+   call RunDbgCmd(buf, ':breakadd func 2 Bazz')
+   call RunDbgCmd(buf, ':echo Bazz(1)')
+   call RunDbgCmd(buf, 'step')
+   call RunDbgCmd(buf, 'breaka expr var3')
+   call RunDbgCmd(buf, 'breakl', ['  4  expr var3'])
+   call RunDbgCmd(buf, 'cont', ['Breakpoint in "Bazz" line 4',
+ 	      \ 'Oldval = "''another var''"',
+ 	      \ 'Newval = "''value2''"',
+ 	      \ 'function Bazz',
+ 	      \ 'line 4: let var3 = "value3"'])
+ 
+   call RunDbgCmd(buf, 'breakdel *')
+   call RunDbgCmd(buf, 'breakl', ['No breakpoints defined'])
+ 
+   " finish the current function
+   call RunDbgCmd(buf, 'finish', [
+ 	      \ 'function Bazz',
+ 	      \ 'line 5: End of function'])
+   call RunDbgCmd(buf, 'cont')
+ 
+   call StopVimInTerminal(buf)
+ 
+   call delete('Xtest.vim')
+ endfunc
*** ../vim-8.1.1179/src/version.c	2019-04-17 16:33:42.795349446 +0200
--- src/version.c	2019-04-17 16:50:55.034220168 +0200
***************
*** 773,774 ****
--- 773,776 ----
  {   /* Add new patch number below this line */
+ /**/
+     1180,
  /**/

-- 
FIRST HEAD:  Oh! quick! get the sword out I want to cut his head off.
THIRD HEAD:  Oh, cut your own head off.
SECOND HEAD: Yes - do us all a favour.
                 "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    ///