Mercurial > vim
annotate src/testdir/test_debugger.vim @ 16350:ffa791471a4c v8.1.1180
patch 8.1.1180: Vim script debugger tests are old style
commit https://github.com/vim/vim/commit/113bf0672b114af5800fa642bcd09f674758e5d5
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Apr 17 16:54:05 2019 +0200
patch 8.1.1180: Vim script debugger tests are old style
Problem: Vim script debugger tests are old style.
Solution: Turn into new style tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/4259)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 17 Apr 2019 17:00:06 +0200 |
parents | |
children | 5900941b2e37 |
rev | line source |
---|---|
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 " Tests for the Vim script debug commands |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 source shared.vim |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 source screendump.vim |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 " Run a Vim debugger command |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 " If the expected output argument is supplied, then check for it. |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 func RunDbgCmd(buf, cmd, ...) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 call term_sendkeys(a:buf, a:cmd . "\r") |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 call term_wait(a:buf) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 if a:0 != 0 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 " Verify the expected output |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 let lnum = 20 - len(a:1) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 for l in a:1 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 call WaitForAssert({-> assert_equal(l, term_getline(a:buf, lnum))}) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 let lnum += 1 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 endfor |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 endif |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 endfunc |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 " Debugger tests |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 func Test_Debugger() |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 if !CanRunVimInTerminal() |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 return |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 endif |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 " Create a Vim script with some functions |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 call writefile([ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 \ 'func Foo()', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 \ ' let var1 = 1', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 \ ' let var2 = Bar(var1) + 9', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 \ ' return var2', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 \ 'endfunc', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 \ 'func Bar(var)', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 \ ' let var1 = 2 + a:var', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 \ ' let var2 = Bazz(var1) + 4', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 \ ' return var2', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 \ 'endfunc', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 \ 'func Bazz(var)', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 \ ' let var1 = 3 + a:var', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 \ ' let var3 = "another var"', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 \ ' let var3 = "value2"', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 \ ' let var3 = "value3"', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 \ ' return var1', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 \ 'endfunc'], 'Xtest.vim') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 " Start Vim in a terminal |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 let buf = RunVimInTerminal('-S Xtest.vim', {}) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 " Start the Vim debugger |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 call RunDbgCmd(buf, ':debug echo Foo()') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 " Create a few stack frames by stepping through functions |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 " check backtrace |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 call RunDbgCmd(buf, 'backtrace', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 \ ' 2 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 \ ' 1 Bar[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 \ '->0 Bazz', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 \ 'line 2: let var3 = "another var"']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 " Check variables in different stack frames |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 call RunDbgCmd(buf, 'echo var1', ['6']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 call RunDbgCmd(buf, 'up') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 call RunDbgCmd(buf, 'back', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 \ ' 2 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 \ '->1 Bar[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
76 \ ' 0 Bazz', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
77 \ 'line 2: let var3 = "another var"']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
78 call RunDbgCmd(buf, 'echo var1', ['3']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
80 call RunDbgCmd(buf, 'u') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 call RunDbgCmd(buf, 'bt', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
82 \ '->2 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
83 \ ' 1 Bar[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
84 \ ' 0 Bazz', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
85 \ 'line 2: let var3 = "another var"']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 call RunDbgCmd(buf, 'echo var1', ['1']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 " Undefined variables |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 call RunDbgCmd(buf, 'frame 2') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
91 call RunDbgCmd(buf, 'echo var3', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 \ 'Error detected while processing function Foo[2]..Bar[2]..Bazz:', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 \ 'line 3:', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 \ 'E121: Undefined variable: var3']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
96 " var3 is defined in this level with some other value |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 call RunDbgCmd(buf, 'fr 0') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 call RunDbgCmd(buf, 'echo var3', ['another var']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
104 call RunDbgCmd(buf, 'step', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 \ 'function Foo[2]..Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 \ 'line 3: End of function']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
107 call RunDbgCmd(buf, 'up') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
109 " Undefined var2 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 call RunDbgCmd(buf, 'echo var2', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 \ 'Error detected while processing function Foo[2]..Bar:', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 \ 'line 3:', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 \ 'E121: Undefined variable: var2']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 " Var2 is defined with 10 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 call RunDbgCmd(buf, 'down') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
117 call RunDbgCmd(buf, 'echo var2', ['10']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
118 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 " Backtrace movements |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
120 call RunDbgCmd(buf, 'b', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
121 \ ' 1 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
122 \ '->0 Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
123 \ 'line 3: End of function']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
124 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
125 " next command cannot go down, we are on bottom |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 call RunDbgCmd(buf, 'down', ['frame is zero']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
127 call RunDbgCmd(buf, 'up') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
129 " next command cannot go up, we are on top |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
130 call RunDbgCmd(buf, 'up', ['frame at highest level: 1']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
131 call RunDbgCmd(buf, 'where', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
132 \ '->1 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
133 \ ' 0 Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
134 \ 'line 3: End of function']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
135 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
136 " fil is not frame or finish, it is file |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
137 call RunDbgCmd(buf, 'fil', ['"[No Name]" --No lines in buffer--']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 " relative backtrace movement |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 call RunDbgCmd(buf, 'fr -1') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 call RunDbgCmd(buf, 'frame', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 \ ' 1 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
143 \ '->0 Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 \ 'line 3: End of function']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
145 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
146 call RunDbgCmd(buf, 'fr +1') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
147 call RunDbgCmd(buf, 'fram', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
148 \ '->1 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
149 \ ' 0 Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
150 \ 'line 3: End of function']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
151 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
152 " go beyond limits does not crash |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 call RunDbgCmd(buf, 'fr 100', ['frame at highest level: 1']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
154 call RunDbgCmd(buf, 'fra', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
155 \ '->1 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
156 \ ' 0 Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
157 \ 'line 3: End of function']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
158 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
159 call RunDbgCmd(buf, 'frame -40', ['frame is zero']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
160 call RunDbgCmd(buf, 'fram', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
161 \ ' 1 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 \ '->0 Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 \ 'line 3: End of function']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
165 " final result 19 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
166 call RunDbgCmd(buf, 'cont', ['19']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
167 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
168 " breakpoints tests |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
169 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
170 " Start a debug session, so that reading the last line from the terminal |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 " works properly. |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 call RunDbgCmd(buf, ':debug echo Foo()') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
173 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
174 " No breakpoints |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 call RunDbgCmd(buf, 'breakl', ['No breakpoints defined']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
176 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
177 " Place some breakpoints |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
178 call RunDbgCmd(buf, 'breaka func Bar') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
179 call RunDbgCmd(buf, 'breaklis', [' 1 func Bar line 1']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 call RunDbgCmd(buf, 'breakadd func 3 Bazz') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
181 call RunDbgCmd(buf, 'breaklist', [' 1 func Bar line 1', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
182 \ ' 2 func Bazz line 3']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
183 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
184 " Check whether the breakpoints are hit |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
185 call RunDbgCmd(buf, 'cont', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
186 \ 'Breakpoint in "Bar" line 1', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
187 \ 'function Foo[2]..Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
188 \ 'line 1: let var1 = 2 + a:var']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
189 call RunDbgCmd(buf, 'cont', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
190 \ 'Breakpoint in "Bazz" line 3', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
191 \ 'function Foo[2]..Bar[2]..Bazz', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
192 \ 'line 3: let var3 = "value2"']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
193 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
194 " Delete the breakpoints |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
195 call RunDbgCmd(buf, 'breakd 1') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
196 call RunDbgCmd(buf, 'breakli', [' 2 func Bazz line 3']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
197 call RunDbgCmd(buf, 'breakdel func 3 Bazz') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
198 call RunDbgCmd(buf, 'breakl', ['No breakpoints defined']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
199 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
200 call RunDbgCmd(buf, 'cont') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 " Make sure the breakpoints are removed |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
203 call RunDbgCmd(buf, ':echo Foo()', ['19']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
204 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
205 " Delete a non-existing breakpoint |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
206 call RunDbgCmd(buf, ':breakdel 2', ['E161: Breakpoint not found: 2']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
207 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
208 " Expression breakpoint |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 call RunDbgCmd(buf, ':breakadd func 2 Bazz') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
210 call RunDbgCmd(buf, ':echo Bazz(1)') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
212 call RunDbgCmd(buf, 'breaka expr var3') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 call RunDbgCmd(buf, 'breakl', [' 4 expr var3']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
214 call RunDbgCmd(buf, 'cont', ['Breakpoint in "Bazz" line 4', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
215 \ 'Oldval = "''another var''"', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
216 \ 'Newval = "''value2''"', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
217 \ 'function Bazz', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
218 \ 'line 4: let var3 = "value3"']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
219 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
220 call RunDbgCmd(buf, 'breakdel *') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 call RunDbgCmd(buf, 'breakl', ['No breakpoints defined']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
222 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
223 " finish the current function |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
224 call RunDbgCmd(buf, 'finish', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
225 \ 'function Bazz', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
226 \ 'line 5: End of function']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
227 call RunDbgCmd(buf, 'cont') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
228 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
229 call StopVimInTerminal(buf) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
230 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
231 call delete('Xtest.vim') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 endfunc |