Mercurial > vim
annotate src/testdir/test_debugger.vim @ 17370:ba06a1c42274 v8.1.1684
patch 8.1.1684: profiling functionality is spread out
commit https://github.com/vim/vim/commit/fa55cfc69d2b14761e2a8bd85bc1e0d82df770aa
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 13 22:59:32 2019 +0200
patch 8.1.1684: profiling functionality is spread out
Problem: Profiling functionality is spread out.
Solution: Put profiling functionality in profiling.c. (Yegappan Lakshmanan,
closes #4666)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 13 Jul 2019 23:00:06 +0200 |
parents | 6990c1160ea5 |
children | 0da9bc55c31a |
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() |
16965
ba7727889385
patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents:
16920
diff
changeset
|
25 throw 'Skipped: cannot run Vim in a terminal window' |
16350
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 |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
29 let lines =<< trim END |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
30 func Foo() |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
31 let var1 = 1 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
32 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
|
33 return var2 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
34 endfunc |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
35 func Bar(var) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
36 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
|
37 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
|
38 return var2 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
39 endfunc |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
40 func Bazz(var) |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
41 try |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
42 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
|
43 let var3 = "another var" |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
44 let var3 = "value2" |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
45 catch |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
46 let var4 = "exception" |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
47 endtry |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
48 return var1 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
49 endfunc |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
50 END |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
51 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
|
52 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 " 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
|
54 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
|
55 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 " 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
|
57 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
|
58 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 " 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
|
60 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
|
61 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 " check backtrace |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 call RunDbgCmd(buf, 'backtrace', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 \ ' 2 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 \ ' 1 Bar[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 \ '->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
|
73 \ '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
|
74 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 " 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
|
76 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
|
77 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
78 call RunDbgCmd(buf, 'up') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 call RunDbgCmd(buf, 'back', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
80 \ ' 2 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 \ '->1 Bar[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
82 \ ' 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
|
83 \ '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
|
84 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
|
85 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 call RunDbgCmd(buf, 'u') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 call RunDbgCmd(buf, 'bt', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 \ '->2 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 \ ' 1 Bar[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 \ ' 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
|
91 \ '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
|
92 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
|
93 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 " Undefined variables |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
96 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
|
97 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
|
98 \ '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
|
99 \ 'line 4:', |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 \ 'E121: Undefined variable: var3']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 " 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
|
103 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
|
104 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
|
105 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 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
|
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, '') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
110 call RunDbgCmd(buf, '') |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 call RunDbgCmd(buf, 'step', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 \ 'function Foo[2]..Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 \ '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
|
114 call RunDbgCmd(buf, 'up') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 " Undefined var2 |
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', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
118 \ '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
|
119 \ 'line 3:', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
120 \ 'E121: Undefined variable: var2']) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
121 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
122 " 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
|
123 call RunDbgCmd(buf, 'down') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
124 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
|
125 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 " Backtrace movements |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
127 call RunDbgCmd(buf, 'b', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 \ ' 1 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
129 \ '->0 Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
130 \ '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
|
131 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
132 " 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
|
133 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
|
134 call RunDbgCmd(buf, 'up') |
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 " 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
|
137 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
|
138 call RunDbgCmd(buf, 'where', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 \ '->1 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 \ ' 0 Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 \ '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
|
142 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
143 " 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
|
144 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
|
145 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
146 " relative backtrace movement |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
147 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
|
148 call RunDbgCmd(buf, 'frame', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
149 \ ' 1 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
150 \ '->0 Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
151 \ '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
|
152 |
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 +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, 'fram', [ |
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 " 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
|
160 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
|
161 call RunDbgCmd(buf, 'fra', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 \ '->1 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 \ ' 0 Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 \ '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
|
165 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
166 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
|
167 call RunDbgCmd(buf, 'fram', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
168 \ ' 1 function Foo[2]', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
169 \ '->0 Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
170 \ '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
|
171 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 " final result 19 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
173 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
|
174 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 " breakpoints tests |
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 " 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
|
178 " works properly. |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
179 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
|
180 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
181 " No breakpoints |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
182 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
|
183 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
184 " Place some breakpoints |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
185 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
|
186 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
|
187 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
|
188 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
|
189 \ ' 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
|
190 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
191 " 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
|
192 call RunDbgCmd(buf, 'cont', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
193 \ '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
|
194 \ 'function Foo[2]..Bar', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
195 \ '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
|
196 call RunDbgCmd(buf, 'cont', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
197 \ '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
|
198 \ '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
|
199 \ '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
|
200 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 " Delete the breakpoints |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 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
|
203 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
|
204 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
|
205 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
|
206 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
207 call RunDbgCmd(buf, 'cont') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
208 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 " 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
|
210 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
|
211 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
212 " 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
|
213 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
|
214 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
215 " Expression breakpoint |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
216 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
|
217 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
|
218 \ '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
|
219 \ '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
|
220 \ '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
|
221 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
|
222 call RunDbgCmd(buf, 'step') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
223 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
|
224 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
|
225 \ ' 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
|
226 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
|
227 \ 'Oldval = "''another var''"', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
228 \ 'Newval = "''value2''"', |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
229 \ '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
|
230 \ 'line 5: catch']) |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
231 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 call RunDbgCmd(buf, 'breakdel *') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
233 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
|
234 |
16372
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
235 " 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
|
236 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
|
237 \ '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
|
238 \ '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
|
239 \ '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
|
240 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
|
241 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
|
242 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
|
243 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
|
244 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
|
245 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
|
246 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
|
247 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
|
248 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
|
249 \ '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
|
250 \ '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
|
251 |
16350
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
252 " finish the current function |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
253 call RunDbgCmd(buf, 'finish', [ |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
254 \ '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
|
255 \ '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
|
256 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
|
257 |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
258 " 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
|
259 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
|
260 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
|
261 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
|
262 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
|
263 \ '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
|
264 \ '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
|
265 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
|
266 |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
267 " 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
|
268 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
|
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, 'step') |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
271 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
|
272 \ '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
|
273 \ '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
|
274 \ '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
|
275 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
|
276 |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
277 " 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
|
278 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
|
279 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
|
280 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
|
281 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
|
282 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
|
283 \ '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
|
284 \ '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
|
285 \ '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
|
286 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
|
287 \ '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
|
288 \ '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
|
289 \ '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
|
290 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
|
291 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
|
292 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
|
293 |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
294 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
|
295 |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
296 " 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
|
297 " 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
|
298 |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
299 let lines =<< trim END |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
300 let var1 = 10 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
301 let var2 = 20 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
302 let var3 = 30 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
303 let var4 = 40 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
304 END |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
305 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
|
306 |
5900941b2e37
patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents:
16350
diff
changeset
|
307 " 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
|
308 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
|
309 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
|
310 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
|
311 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
|
312 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
|
313 call RunDbgCmd(buf, 'cont') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
314 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
315 call StopVimInTerminal(buf) |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
316 |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
317 call delete('Xtest.vim') |
ffa791471a4c
patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
318 endfunc |