Mercurial > vim
annotate src/testdir/test_debugger.vim @ 18945:c62d63d2b9f0 v8.2.0033
patch 8.2.0033: crash when make_extmatch() runs out of memory
Commit: https://github.com/vim/vim/commit/7c77b3496710f1be3232cfdc7f6812347fbd914a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Dec 22 19:40:40 2019 +0100
patch 8.2.0033: crash when make_extmatch() runs out of memory
Problem: Crash when make_extmatch() runs out of memory.
Solution: Check for NULL. (Dominique Pelle, closs https://github.com/vim/vim/issues/5392)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 22 Dec 2019 19:45:03 +0100 |
parents | 0da9bc55c31a |
children | 847cc7932c42 |
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 |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
5 source check.vim |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 " 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
|
8 " 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
|
9 func RunDbgCmd(buf, cmd, ...) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 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
|
11 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
|
12 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 if a:0 != 0 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 " Verify the expected output |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 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
|
16 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
|
17 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
|
18 let lnum += 1 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 endfor |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 endif |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 endfunc |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 " Debugger tests |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 func Test_Debugger() |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
25 CheckRunVimInTerminal |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 " Create a Vim script with some functions |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
28 let lines =<< trim END |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
29 func Foo() |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
30 let var1 = 1 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
31 let var2 = Bar(var1) + 9 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
32 return var2 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
33 endfunc |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
34 func Bar(var) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
35 let var1 = 2 + a:var |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
36 let var2 = Bazz(var1) + 4 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
37 return var2 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
38 endfunc |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
39 func Bazz(var) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
40 try |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
41 let var1 = 3 + a:var |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
42 let var3 = "another var" |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
43 let var3 = "value2" |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
44 catch |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
45 let var4 = "exception" |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
46 endtry |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
47 return var1 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
48 endfunc |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
49 END |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
50 call writefile(lines, 'Xtest.vim') |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 " 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
|
53 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
|
54 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 " Start the Vim debugger |
16920
8d91579414b8
patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents:
16372
diff
changeset
|
56 call RunDbgCmd(buf, ':debug echo Foo()', ['cmd: echo Foo()']) |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 " Create a few stack frames by stepping through functions |
16920
8d91579414b8
patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents:
16372
diff
changeset
|
59 call RunDbgCmd(buf, 'step', ['line 1: let var1 = 1']) |
8d91579414b8
patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents:
16372
diff
changeset
|
60 call RunDbgCmd(buf, 'step', ['line 2: let var2 = Bar(var1) + 9']) |
8d91579414b8
patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents:
16372
diff
changeset
|
61 call RunDbgCmd(buf, 'step', ['line 1: let var1 = 2 + a:var']) |
8d91579414b8
patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents:
16372
diff
changeset
|
62 call RunDbgCmd(buf, 'step', ['line 2: let var2 = Bazz(var1) + 4']) |
8d91579414b8
patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents:
16372
diff
changeset
|
63 call RunDbgCmd(buf, 'step', ['line 1: try']) |
8d91579414b8
patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents:
16372
diff
changeset
|
64 call RunDbgCmd(buf, 'step', ['line 2: let var1 = 3 + a:var']) |
8d91579414b8
patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents:
16372
diff
changeset
|
65 call RunDbgCmd(buf, 'step', ['line 3: let var3 = "another var"']) |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 " check backtrace |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 call RunDbgCmd(buf, 'backtrace', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 \ ' 2 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 \ ' 1 Bar[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 \ '->0 Bazz', |
16372
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
72 \ 'line 3: let var3 = "another var"']) |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 " 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
|
75 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
|
76 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
77 call RunDbgCmd(buf, 'up') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
78 call RunDbgCmd(buf, 'back', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 \ ' 2 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
80 \ '->1 Bar[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 \ ' 0 Bazz', |
16372
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
82 \ 'line 3: let var3 = "another var"']) |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
83 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
|
84 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
85 call RunDbgCmd(buf, 'u') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 call RunDbgCmd(buf, 'bt', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 \ '->2 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 \ ' 1 Bar[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 \ ' 0 Bazz', |
16372
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
90 \ 'line 3: let var3 = "another var"']) |
16350
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 var1', ['1']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 " Undefined variables |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 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
|
96 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
|
97 \ 'Error detected while processing function Foo[2]..Bar[2]..Bazz:', |
16372
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
98 \ 'line 4:', |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 \ 'E121: Undefined variable: var3']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 " 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
|
102 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
|
103 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
|
104 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 call RunDbgCmd(buf, 'step') |
16372
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
106 call RunDbgCmd(buf, '') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
107 call RunDbgCmd(buf, '') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
108 call RunDbgCmd(buf, '') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
109 call RunDbgCmd(buf, '') |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 call RunDbgCmd(buf, 'step', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 \ '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: End of function']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 call RunDbgCmd(buf, 'up') |
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 " Undefined var2 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 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
|
117 \ '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
|
118 \ 'line 3:', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 \ 'E121: Undefined variable: var2']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
120 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
121 " 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
|
122 call RunDbgCmd(buf, 'down') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
123 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
|
124 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
125 " Backtrace movements |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 call RunDbgCmd(buf, 'b', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
127 \ ' 1 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 \ '->0 Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
129 \ '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
|
130 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
131 " 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
|
132 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
|
133 call RunDbgCmd(buf, 'up') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
134 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
135 " 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
|
136 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
|
137 call RunDbgCmd(buf, 'where', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 \ '->1 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 \ ' 0 Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 \ '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
|
141 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 " 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
|
143 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
|
144 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
145 " relative backtrace movement |
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, 'frame', [ |
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 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
|
153 call RunDbgCmd(buf, 'fram', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
154 \ '->1 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
155 \ ' 0 Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
156 \ '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
|
157 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
158 " 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
|
159 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
|
160 call RunDbgCmd(buf, 'fra', [ |
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 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
|
166 call RunDbgCmd(buf, 'fram', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
167 \ ' 1 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
168 \ '->0 Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
169 \ '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
|
170 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 " final result 19 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 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
|
173 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
174 " breakpoints tests |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
176 " 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
|
177 " works properly. |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
178 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
|
179 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 " No breakpoints |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
181 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
|
182 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
183 " Place some breakpoints |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
184 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
|
185 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
|
186 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
|
187 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
|
188 \ ' 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
|
189 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
190 " 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
|
191 call RunDbgCmd(buf, 'cont', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
192 \ '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
|
193 \ 'function Foo[2]..Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
194 \ '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
|
195 call RunDbgCmd(buf, 'cont', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
196 \ '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
|
197 \ 'function Foo[2]..Bar[2]..Bazz', |
16372
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
198 \ 'line 3: let var3 = "another var"']) |
16350
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 " Delete the breakpoints |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 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
|
202 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
|
203 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
|
204 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
|
205 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
206 call RunDbgCmd(buf, 'cont') |
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 " 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
|
209 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
|
210 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 " 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
|
212 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
|
213 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
214 " Expression breakpoint |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
215 call RunDbgCmd(buf, ':breakadd func 2 Bazz') |
16372
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
216 call RunDbgCmd(buf, ':echo Bazz(1)', [ |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
217 \ 'Entering Debug mode. Type "cont" to continue.', |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
218 \ 'function Bazz', |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
219 \ 'line 2: let var1 = 3 + a:var']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
220 call RunDbgCmd(buf, 'step') |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
222 call RunDbgCmd(buf, 'breaka expr var3') |
16372
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
223 call RunDbgCmd(buf, 'breakl', [' 3 func Bazz line 2', |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
224 \ ' 4 expr var3']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
225 call RunDbgCmd(buf, 'cont', ['Breakpoint in "Bazz" line 5', |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
226 \ 'Oldval = "''another var''"', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
227 \ 'Newval = "''value2''"', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
228 \ 'function Bazz', |
16372
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
229 \ 'line 5: catch']) |
16350
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 RunDbgCmd(buf, 'breakdel *') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 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
|
233 |
16372
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
234 " Check for error cases |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
235 call RunDbgCmd(buf, 'breakadd abcd', [ |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
236 \ 'Error detected while processing function Bazz:', |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
237 \ 'line 5:', |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
238 \ 'E475: Invalid argument: abcd']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
239 call RunDbgCmd(buf, 'breakadd func', ['E475: Invalid argument: func']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
240 call RunDbgCmd(buf, 'breakadd func 2', ['E475: Invalid argument: func 2']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
241 call RunDbgCmd(buf, 'breaka func a()', ['E475: Invalid argument: func a()']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
242 call RunDbgCmd(buf, 'breakd abcd', ['E475: Invalid argument: abcd']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
243 call RunDbgCmd(buf, 'breakd func', ['E475: Invalid argument: func']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
244 call RunDbgCmd(buf, 'breakd func a()', ['E475: Invalid argument: func a()']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
245 call RunDbgCmd(buf, 'breakd func a', ['E161: Breakpoint not found: func a']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
246 call RunDbgCmd(buf, 'breakd expr', ['E475: Invalid argument: expr']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
247 call RunDbgCmd(buf, 'breakd expr x', [ |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
248 \ 'E121: Undefined variable: x', |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
249 \ 'E161: Breakpoint not found: expr x']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
250 |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
251 " finish the current function |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
252 call RunDbgCmd(buf, 'finish', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
253 \ 'function Bazz', |
16372
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
254 \ 'line 8: End of function']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
255 call RunDbgCmd(buf, 'cont') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
256 |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
257 " Test for :next |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
258 call RunDbgCmd(buf, ':debug echo Bar(1)') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
259 call RunDbgCmd(buf, 'step') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
260 call RunDbgCmd(buf, 'next') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
261 call RunDbgCmd(buf, '', [ |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
262 \ 'function Bar', |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
263 \ 'line 3: return var2']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
264 call RunDbgCmd(buf, 'c') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
265 |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
266 " Test for :interrupt |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
267 call RunDbgCmd(buf, ':debug echo Bazz(1)') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
268 call RunDbgCmd(buf, 'step') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
269 call RunDbgCmd(buf, 'step') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
270 call RunDbgCmd(buf, 'interrupt', [ |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
271 \ 'Exception thrown: Vim:Interrupt', |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
272 \ 'function Bazz', |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
273 \ 'line 5: catch']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
274 call RunDbgCmd(buf, 'c') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
275 |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
276 " Test for :quit |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
277 call RunDbgCmd(buf, ':debug echo Foo()') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
278 call RunDbgCmd(buf, 'breakdel *') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
279 call RunDbgCmd(buf, 'breakadd func 3 Foo') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
280 call RunDbgCmd(buf, 'breakadd func 3 Bazz') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
281 call RunDbgCmd(buf, 'cont', [ |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
282 \ 'Breakpoint in "Bazz" line 3', |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
283 \ 'function Foo[2]..Bar[2]..Bazz', |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
284 \ 'line 3: let var3 = "another var"']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
285 call RunDbgCmd(buf, 'quit', [ |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
286 \ 'Breakpoint in "Foo" line 3', |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
287 \ 'function Foo', |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
288 \ 'line 3: return var2']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
289 call RunDbgCmd(buf, 'breakdel *') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
290 call RunDbgCmd(buf, 'quit') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
291 call RunDbgCmd(buf, 'enew! | only!') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
292 |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
293 call StopVimInTerminal(buf) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
294 |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
295 " Tests for :breakadd file and :breakadd here |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
296 " Breakpoints should be set before sourcing the file |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
297 |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
298 let lines =<< trim END |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
299 let var1 = 10 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
300 let var2 = 20 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
301 let var3 = 30 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
302 let var4 = 40 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
303 END |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
304 call writefile(lines, 'Xtest.vim') |
16372
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
305 |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
306 " Start Vim in a terminal |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
307 let buf = RunVimInTerminal('Xtest.vim', {}) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
308 call RunDbgCmd(buf, ':breakadd file 2 Xtest.vim') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
309 call RunDbgCmd(buf, ':4 | breakadd here') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
310 call RunDbgCmd(buf, ':source Xtest.vim', ['line 2: let var2 = 20']) |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
311 call RunDbgCmd(buf, 'cont', ['line 4: let var4 = 40']) |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
312 call RunDbgCmd(buf, 'cont') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
313 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
314 call StopVimInTerminal(buf) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
315 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
316 call delete('Xtest.vim') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
317 endfunc |