annotate src/testdir/test_debugger.vim @ 27457:4c16acb2525f v8.2.4257

patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent Commit: https://github.com/vim/vim/commit/62aec93bfdb9e1b40d03a6d2e8e9511f8b1bdb2d Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 29 21:45:34 2022 +0000 patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent Problem: Vim9: finding global function without g: prefix but not finding global variable is inconsistent. Solution: Require using g: for a global function. Change the vim9.vim script into a Vim9 script with exports. Fix that import in legacy script does not work.
author Bram Moolenaar <Bram@vim.org>
date Sat, 29 Jan 2022 23:00:05 +0100
parents f15bf2470359
children 73f4d1e479f2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
7 CheckRunVimInTerminal
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
8
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
9 func CheckCWD()
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
10 " Check that the longer lines don't wrap due to the length of the script name
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
11 " in cwd
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
12 let script_len = len( getcwd() .. '/Xtest1.vim' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
13 let longest_line = len( 'Breakpoint in "" line 1' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
14 if script_len > ( 75 - longest_line )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
15 throw 'Skipped: Your CWD has too many characters'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
16 endif
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
17 endfunc
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
18 command! -nargs=0 -bar CheckCWD call CheckCWD()
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
19
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
20 " "options" argument can contain:
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
21 " 'msec' - time to wait for a match
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
22 " 'match' - "pattern" to use "lines" as pattern instead of text
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
23 func CheckDbgOutput(buf, lines, options = {})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
24 " Verify the expected output
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
25 let lnum = 20 - len(a:lines)
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
26 let msec = get(a:options, 'msec', 1000)
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
27 for l in a:lines
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
28 if get(a:options, 'match', 'equal') ==# 'pattern'
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
29 call WaitForAssert({-> assert_match(l, term_getline(a:buf, lnum))}, msec)
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
30 else
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
31 call WaitForAssert({-> assert_equal(l, term_getline(a:buf, lnum))}, msec)
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
32 endif
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
33 let lnum += 1
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
34 endfor
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
35 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
36
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 " 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
38 " 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
39 func RunDbgCmd(buf, cmd, ...)
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 call term_sendkeys(a:buf, a:cmd . "\r")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19651
diff changeset
41 call TermWait(a:buf)
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 if a:0 != 0
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
44 let options = #{match: 'equal'}
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
45 if a:0 > 1
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
46 call extend(options, a:2)
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
47 endif
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
48 call CheckDbgOutput(a:buf, a:1, options)
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 endif
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 endfunc
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 " Debugger tests
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 func Test_Debugger()
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 " 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
55 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
56 func Foo()
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
57 let var1 = 1
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
58 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
59 return var2
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
60 endfunc
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
61 func Bar(var)
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
62 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
63 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
64 return var2
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
65 endfunc
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
66 func Bazz(var)
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
67 try
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
68 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
69 let var3 = "another var"
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
70 let var3 = "value2"
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
71 catch
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
72 let var4 = "exception"
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
73 endtry
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
74 return var1
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
75 endfunc
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
76 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
77 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
78
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 " 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
80 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
81
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 " 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
83 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
84
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 " 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
86 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
87 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
88 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
89 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
90 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
91 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
92 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
93
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 " check backtrace
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 call RunDbgCmd(buf, 'backtrace', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 \ ' 2 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 \ ' 1 Bar[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 \ '->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
99 \ '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
100
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 " 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
102 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
103
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 call RunDbgCmd(buf, 'up')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 call RunDbgCmd(buf, 'back', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 \ ' 2 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 \ '->1 Bar[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 \ ' 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
109 \ '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
110 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
111
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 call RunDbgCmd(buf, 'u')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 call RunDbgCmd(buf, 'bt', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 \ '->2 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 \ ' 1 Bar[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 \ ' 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
117 \ '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
118 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
119
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 " Undefined variables
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 call RunDbgCmd(buf, 'step')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 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
123 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
124 \ '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
125 \ 'line 4:',
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 \ 'E121: Undefined variable: var3'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 " 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
129 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
130 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
131
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 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
133 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
134 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
135 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
136 call RunDbgCmd(buf, '')
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 call RunDbgCmd(buf, 'step', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 \ 'function Foo[2]..Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 \ '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
140 call RunDbgCmd(buf, 'up')
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 " Undefined var2
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 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
144 \ '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
145 \ 'line 3:',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 \ 'E121: Undefined variable: var2'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 " 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
149 call RunDbgCmd(buf, 'down')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 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
151
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 " Backtrace movements
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 call RunDbgCmd(buf, 'b', [
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 " 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
159 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
160 call RunDbgCmd(buf, 'up')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 " 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
163 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
164 call RunDbgCmd(buf, 'where', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 \ '->1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 \ ' 0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167 \ '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
168
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169 " 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
170 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
171
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172 " relative backtrace movement
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 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
174 call RunDbgCmd(buf, 'frame', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175 \ ' 1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 \ '->0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177 \ '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
178
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
179 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
180 call RunDbgCmd(buf, 'fram', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181 \ '->1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182 \ ' 0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183 \ '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
184
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185 " 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
186 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
187 call RunDbgCmd(buf, 'fra', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188 \ '->1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189 \ ' 0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
190 \ '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
191
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192 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
193 call RunDbgCmd(buf, 'fram', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 \ ' 1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195 \ '->0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196 \ '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
197
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198 " final result 19
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199 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
200
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 " breakpoints tests
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203 " 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
204 " works properly.
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
205 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
206
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207 " No breakpoints
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 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
209
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 " Place some breakpoints
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211 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
212 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
213 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
214 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
215 \ ' 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
216
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217 " 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
218 call RunDbgCmd(buf, 'cont', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 \ '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
220 \ 'function Foo[2]..Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 \ '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
222 call RunDbgCmd(buf, 'cont', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223 \ '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
224 \ '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
225 \ '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
226
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227 " Delete the breakpoints
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228 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
229 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
230 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
231 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
232
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
233 call RunDbgCmd(buf, 'cont')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
235 " 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
236 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
237
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 " 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
239 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
240
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
241 " Expression breakpoint
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242 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
243 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
244 \ '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
245 \ '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
246 \ '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
247 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
248 call RunDbgCmd(buf, 'step')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 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
250 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
251 \ ' 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
252 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
253 \ 'Oldval = "''another var''"',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254 \ 'Newval = "''value2''"',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
255 \ '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
256 \ 'line 5: catch'])
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
257
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
258 call RunDbgCmd(buf, 'breakdel *')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
259 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
260
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
261 " 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
262 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
263 \ '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
264 \ '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
265 \ '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
266 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
267 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
268 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
269 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
270 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
271 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
272 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
273 call RunDbgCmd(buf, 'breakd expr', ['E475: Invalid argument: expr'])
25767
dfa045d2cc89 patch 8.2.3419: a failing debug expression may make Vim unusable
Bram Moolenaar <Bram@vim.org>
parents: 25763
diff changeset
274 call RunDbgCmd(buf, 'breakd expr x', ['E161: Breakpoint not found: expr x'])
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
275
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
276 " finish the current function
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
277 call RunDbgCmd(buf, 'finish', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
278 \ '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
279 \ '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
280 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
281
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
282 " 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
283 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
284 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
285 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
286 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
287 \ '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
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, 'c')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
290
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
291 " 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
292 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
293 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
294 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
295 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
296 \ '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
297 \ '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
298 \ '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
299 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
300
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
301 " 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
302 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
303 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
304 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
305 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
306 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
307 \ '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
308 \ '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
309 \ '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
310 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
311 \ '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
312 \ '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
313 \ '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
314 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
315 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
316 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
317
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
318 call StopVimInTerminal(buf)
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
319 endfunc
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
320
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
321 func Test_Debugger_breakadd()
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
322 " 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
323 " 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
324
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
325 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
326 let var1 = 10
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
327 let var2 = 20
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
328 let var3 = 30
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
329 let var4 = 40
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
330 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
331 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
332
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
333 " 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
334 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
335 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
336 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
337 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
338 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
339 call RunDbgCmd(buf, 'cont')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
340
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
341 call StopVimInTerminal(buf)
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
342
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
343 call delete('Xtest.vim')
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
344 %bw!
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
345
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
346 call assert_fails('breakadd here', 'E32:')
22375
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21917
diff changeset
347 call assert_fails('breakadd file Xtest.vim /\)/', 'E55:')
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
348 endfunc
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
349
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
350 def Test_Debugger_breakadd_expr()
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
351 var lines =<< trim END
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
352 vim9script
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
353 func g:EarlyFunc()
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
354 endfunc
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
355 breakadd expr DoesNotExist()
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
356 func g:LaterFunc()
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
357 endfunc
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
358 breakdel *
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
359 END
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
360 writefile(lines, 'Xtest.vim')
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
361
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
362 # Start Vim in a terminal
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
363 var buf = g:RunVimInTerminal('-S Xtest.vim', {wait_for_ruler: 0})
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
364 call g:TermWait(buf)
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
365
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
366 # Despite the failure the functions are defined
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
367 g:RunDbgCmd(buf, ':function g:EarlyFunc',
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
368 ['function EarlyFunc()', 'endfunction'], {match: 'pattern'})
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
369 g:RunDbgCmd(buf, ':function g:LaterFunc',
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
370 ['function LaterFunc()', 'endfunction'], {match: 'pattern'})
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
371
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
372 call g:StopVimInTerminal(buf)
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
373 call delete('Xtest.vim')
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
374 enddef
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
375
26252
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
376 def Test_Debugger_break_at_return()
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
377 var lines =<< trim END
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
378 vim9script
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
379 def g:GetNum(): number
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
380 return 1
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
381 + 2
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
382 + 3
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
383 enddef
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
384 breakadd func GetNum
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
385 END
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
386 writefile(lines, 'Xtest.vim')
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
387
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
388 # Start Vim in a terminal
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
389 var buf = g:RunVimInTerminal('-S Xtest.vim', {wait_for_ruler: 0})
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
390 call g:TermWait(buf)
26252
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
391
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
392 g:RunDbgCmd(buf, ':call GetNum()',
26252
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
393 ['line 1: return 1 + 2 + 3'], {match: 'pattern'})
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
394
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
395 call g:StopVimInTerminal(buf)
26252
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
396 call delete('Xtest.vim')
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
397 enddef
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
398
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
399 func Test_Backtrace_Through_Source()
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
400 CheckCWD
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
401 let file1 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
402 func SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
403 source Xtest2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
404 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
405
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
406 func CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
407 call SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
408 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
409 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
410
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
411 func GlobalFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
412 call CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
413 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
414 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
415 call writefile(file1, 'Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
416
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
417 let file2 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
418 func DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
419 echo "DoAThing"
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
420 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
421
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
422 func File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
423 call DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
424 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
425
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
426 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
427 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
428 call writefile(file2, 'Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
429
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
430 let buf = RunVimInTerminal('-S Xtest1.vim', {})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
431
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
432 call RunDbgCmd(buf,
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
433 \ ':debug call GlobalFunction()',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
434 \ ['cmd: call GlobalFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
435 call RunDbgCmd(buf, 'step', ['line 1: call CallAFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
436
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
437 call RunDbgCmd(buf, 'backtrace', ['>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
438 \ '->0 function GlobalFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
439 \ 'line 1: call CallAFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
440
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
441 call RunDbgCmd(buf, 'step', ['line 1: call SourceAnotherFile()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
442 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
443
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
444 call RunDbgCmd(buf, 'backtrace', ['>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
445 \ ' 2 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
446 \ ' 1 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
447 \ '->0 SourceAnotherFile',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
448 \ 'line 1: source Xtest2.vim'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
449
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
450 " Step into the 'source' command. Note that we print the full trace all the
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
451 " way though the source command.
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
452 call RunDbgCmd(buf, 'step', ['line 1: func DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
453 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
454 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
455 \ ' 3 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
456 \ ' 2 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
457 \ ' 1 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
458 \ '->0 script ' .. getcwd() .. '/Xtest2.vim',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
459 \ 'line 1: func DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
460
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
461 call RunDbgCmd( buf, 'up' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
462 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
463 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
464 \ ' 3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
465 \ ' 2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
466 \ '->1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
467 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
468 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
469
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
470 call RunDbgCmd( buf, 'up' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
471 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
472 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
473 \ ' 3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
474 \ '->2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
475 \ ' 1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
476 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
477 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
478
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
479 call RunDbgCmd( buf, 'up' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
480 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
481 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
482 \ '->3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
483 \ ' 2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
484 \ ' 1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
485 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
486 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
487
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
488 call RunDbgCmd( buf, 'up', [ 'frame at highest level: 3' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
489 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
490 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
491 \ '->3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
492 \ ' 2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
493 \ ' 1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
494 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
495 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
496
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
497 call RunDbgCmd( buf, 'down' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
498 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
499 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
500 \ ' 3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
501 \ '->2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
502 \ ' 1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
503 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
504 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
505
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
506 call RunDbgCmd( buf, 'down' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
507 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
508 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
509 \ ' 3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
510 \ ' 2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
511 \ '->1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
512 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
513 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
514
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
515 call RunDbgCmd( buf, 'down' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
516 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
517 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
518 \ ' 3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
519 \ ' 2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
520 \ ' 1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
521 \ '->0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
522 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
523
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
524 call RunDbgCmd( buf, 'down', [ 'frame is zero' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
525
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 25767
diff changeset
526 " step until we have another meaningful trace
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
527 call RunDbgCmd(buf, 'step', ['line 5: func File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
528 call RunDbgCmd(buf, 'step', ['line 9: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
529 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
530 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
531 \ ' 3 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
532 \ ' 2 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
533 \ ' 1 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
534 \ '->0 script ' .. getcwd() .. '/Xtest2.vim',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
535 \ 'line 9: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
536
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
537 call RunDbgCmd(buf, 'step', ['line 1: call DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
538 call RunDbgCmd(buf, 'step', ['line 1: echo "DoAThing"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
539 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
540 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
541 \ ' 5 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
542 \ ' 4 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
543 \ ' 3 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
544 \ ' 2 script ' .. getcwd() .. '/Xtest2.vim[9]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
545 \ ' 1 function File2Function[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
546 \ '->0 DoAThing',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
547 \ 'line 1: echo "DoAThing"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
548
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
549 " Now, step (back to Xfile1.vim), and call the function _in_ Xfile2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
550 call RunDbgCmd(buf, 'step', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
551 call RunDbgCmd(buf, 'step', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
552 call RunDbgCmd(buf, 'step', ['line 10: End of sourced file'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
553 call RunDbgCmd(buf, 'step', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
554 call RunDbgCmd(buf, 'step', ['line 2: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
555 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
556 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
557 \ ' 1 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
558 \ '->0 CallAFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
559 \ 'line 2: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
560
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
561 call RunDbgCmd(buf, 'step', ['line 1: call DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
562 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
563 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
564 \ ' 2 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
565 \ ' 1 CallAFunction[2]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
566 \ '->0 File2Function',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
567 \ 'line 1: call DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
568
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
569 call StopVimInTerminal(buf)
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
570 call delete('Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
571 call delete('Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
572 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
573
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
574 func Test_Backtrace_Autocmd()
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
575 CheckCWD
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
576 let file1 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
577 func SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
578 source Xtest2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
579 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
580
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
581 func CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
582 call SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
583 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
584 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
585
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
586 func GlobalFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
587 call CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
588 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
589
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
590 au User TestGlobalFunction :call GlobalFunction() | echo "Done"
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
591 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
592 call writefile(file1, 'Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
593
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
594 let file2 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
595 func DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
596 echo "DoAThing"
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
597 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
598
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
599 func File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
600 call DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
601 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
602
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
603 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
604 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
605 call writefile(file2, 'Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
606
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
607 let buf = RunVimInTerminal('-S Xtest1.vim', {})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
608
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
609 call RunDbgCmd(buf,
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
610 \ ':debug doautocmd User TestGlobalFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
611 \ ['cmd: doautocmd User TestGlobalFunction'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
612 call RunDbgCmd(buf, 'step', ['cmd: call GlobalFunction() | echo "Done"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
613
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 25767
diff changeset
614 " At this point the only thing in the stack is the autocommand
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
615 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
616 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
617 \ '->0 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
618 \ 'cmd: call GlobalFunction() | echo "Done"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
619
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
620 " And now we're back into the call stack
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
621 call RunDbgCmd(buf, 'step', ['line 1: call CallAFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
622 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
623 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
624 \ ' 1 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
625 \ '->0 function GlobalFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
626 \ 'line 1: call CallAFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
627
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
628 call RunDbgCmd(buf, 'step', ['line 1: call SourceAnotherFile()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
629 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
630
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
631 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
632 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
633 \ ' 3 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
634 \ ' 2 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
635 \ ' 1 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
636 \ '->0 SourceAnotherFile',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
637 \ 'line 1: source Xtest2.vim'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
638
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
639 " Step into the 'source' command. Note that we print the full trace all the
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
640 " way though the source command.
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
641 call RunDbgCmd(buf, 'step', ['line 1: func DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
642 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
643 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
644 \ ' 4 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
645 \ ' 3 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
646 \ ' 2 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
647 \ ' 1 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
648 \ '->0 script ' .. getcwd() .. '/Xtest2.vim',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
649 \ 'line 1: func DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
650
21917
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
651 call RunDbgCmd( buf, 'up' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
652 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
653 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
654 \ ' 4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
655 \ ' 3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
656 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
657 \ '->1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
658 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
659 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
660
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
661 call RunDbgCmd( buf, 'up' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
662 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
663 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
664 \ ' 4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
665 \ ' 3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
666 \ '->2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
667 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
668 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
669 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
670
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
671 call RunDbgCmd( buf, 'up' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
672 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
673 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
674 \ ' 4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
675 \ '->3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
676 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
677 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
678 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
679 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
680
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
681 call RunDbgCmd( buf, 'up' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
682 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
683 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
684 \ '->4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
685 \ ' 3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
686 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
687 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
688 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
689 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
690
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
691 call RunDbgCmd( buf, 'up', [ 'frame at highest level: 4' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
692 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
693 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
694 \ '->4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
695 \ ' 3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
696 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
697 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
698 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
699 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
700
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
701 call RunDbgCmd( buf, 'down' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
702 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
703 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
704 \ ' 4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
705 \ '->3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
706 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
707 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
708 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
709 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
710
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
711
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
712 call RunDbgCmd( buf, 'down' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
713 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
714 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
715 \ ' 4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
716 \ ' 3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
717 \ '->2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
718 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
719 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
720 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
721
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
722 call RunDbgCmd( buf, 'down' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
723 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
724 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
725 \ ' 4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
726 \ ' 3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
727 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
728 \ '->1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
729 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
730 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
731
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
732 call RunDbgCmd( buf, 'down' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
733 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
734 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
735 \ ' 4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
736 \ ' 3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
737 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
738 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
739 \ '->0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
740 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
741
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
742 call RunDbgCmd( buf, 'down', [ 'frame is zero' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
743
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 25767
diff changeset
744 " step until we have another meaningful trace
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
745 call RunDbgCmd(buf, 'step', ['line 5: func File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
746 call RunDbgCmd(buf, 'step', ['line 9: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
747 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
748 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
749 \ ' 4 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
750 \ ' 3 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
751 \ ' 2 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
752 \ ' 1 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
753 \ '->0 script ' .. getcwd() .. '/Xtest2.vim',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
754 \ 'line 9: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
755
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
756 call RunDbgCmd(buf, 'step', ['line 1: call DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
757 call RunDbgCmd(buf, 'step', ['line 1: echo "DoAThing"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
758 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
759 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
760 \ ' 6 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
761 \ ' 5 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
762 \ ' 4 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
763 \ ' 3 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
764 \ ' 2 script ' .. getcwd() .. '/Xtest2.vim[9]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
765 \ ' 1 function File2Function[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
766 \ '->0 DoAThing',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
767 \ 'line 1: echo "DoAThing"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
768
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
769 " Now, step (back to Xfile1.vim), and call the function _in_ Xfile2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
770 call RunDbgCmd(buf, 'step', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
771 call RunDbgCmd(buf, 'step', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
772 call RunDbgCmd(buf, 'step', ['line 10: End of sourced file'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
773 call RunDbgCmd(buf, 'step', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
774 call RunDbgCmd(buf, 'step', ['line 2: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
775 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
776 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
777 \ ' 2 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
778 \ ' 1 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
779 \ '->0 CallAFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
780 \ 'line 2: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
781
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
782 call RunDbgCmd(buf, 'step', ['line 1: call DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
783 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
784 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
785 \ ' 3 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
786 \ ' 2 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
787 \ ' 1 CallAFunction[2]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
788 \ '->0 File2Function',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
789 \ 'line 1: call DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
790
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
791
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
792 " Now unwind so that we get back to the original autocommand (and the second
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
793 " cmd echo "Done")
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
794 call RunDbgCmd(buf, 'finish', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
795 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
796 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
797 \ ' 3 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
798 \ ' 2 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
799 \ ' 1 CallAFunction[2]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
800 \ '->0 File2Function',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
801 \ 'line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
802
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
803 call RunDbgCmd(buf, 'finish', ['line 2: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
804 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
805 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
806 \ ' 2 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
807 \ ' 1 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
808 \ '->0 CallAFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
809 \ 'line 2: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
810
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
811 call RunDbgCmd(buf, 'finish', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
812 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
813 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
814 \ ' 1 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
815 \ '->0 function GlobalFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
816 \ 'line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
817
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
818 call RunDbgCmd(buf, 'step', ['cmd: echo "Done"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
819 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
820 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
821 \ '->0 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
822 \ 'cmd: echo "Done"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
823
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
824 call StopVimInTerminal(buf)
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
825 call delete('Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
826 call delete('Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
827 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
828
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
829 func Test_Backtrace_CmdLine()
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
830 CheckCWD
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
831 let file1 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
832 func SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
833 source Xtest2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
834 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
835
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
836 func CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
837 call SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
838 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
839 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
840
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
841 func GlobalFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
842 call CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
843 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
844
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
845 au User TestGlobalFunction :call GlobalFunction() | echo "Done"
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
846 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
847 call writefile(file1, 'Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
848
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
849 let file2 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
850 func DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
851 echo "DoAThing"
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
852 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
853
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
854 func File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
855 call DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
856 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
857
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
858 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
859 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
860 call writefile(file2, 'Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
861
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
862 let buf = RunVimInTerminal(
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
863 \ '-S Xtest1.vim -c "debug call GlobalFunction()"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
864 \ {'wait_for_ruler': 0})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
865
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
866 " Need to wait for the vim-in-terminal to be ready.
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
867 " With valgrind this can take quite long.
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
868 call CheckDbgOutput(buf, ['command line',
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
869 \ 'cmd: call GlobalFunction()'], #{msec: 5000})
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
870
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 25767
diff changeset
871 " At this point the only thing in the stack is the cmdline
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
872 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
873 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
874 \ '->0 command line',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
875 \ 'cmd: call GlobalFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
876
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
877 " And now we're back into the call stack
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
878 call RunDbgCmd(buf, 'step', ['line 1: call CallAFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
879 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
880 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
881 \ ' 1 command line',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
882 \ '->0 function GlobalFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
883 \ 'line 1: call CallAFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
884
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
885 call StopVimInTerminal(buf)
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
886 call delete('Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
887 call delete('Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
888 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
889
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
890 func Test_Backtrace_DefFunction()
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
891 CheckCWD
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
892 let file1 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
893 vim9script
26982
f15bf2470359 patch 8.2.4020: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26911
diff changeset
894 import './Xtest2.vim' as imp
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
895
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
896 def SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
897 source Xtest2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
898 enddef
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
899
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
900 def CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
901 SourceAnotherFile()
26982
f15bf2470359 patch 8.2.4020: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26911
diff changeset
902 imp.File2Function()
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
903 enddef
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
904
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
905 def g:GlobalFunction()
24918
f11779c1d123 patch 8.2.2996: Vim9: when debugging cannot inspect local variables
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
906 var some = "some var"
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
907 CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
908 enddef
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
909
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
910 defcompile
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
911 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
912 call writefile(file1, 'Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
913
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
914 let file2 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
915 vim9script
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
916
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
917 def DoAThing(): number
22486
4086a1708c83 patch 8.2.1791: Vim9: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
918 var a = 100 * 2
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
919 a += 3
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
920 return a
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
921 enddef
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
922
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
923 export def File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
924 DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
925 enddef
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
926
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
927 defcompile
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
928 File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
929 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
930 call writefile(file2, 'Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
931
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
932 let buf = RunVimInTerminal('-S Xtest1.vim', {})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
933
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
934 call RunDbgCmd(buf,
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
935 \ ':debug call GlobalFunction()',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
936 \ ['cmd: call GlobalFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
937
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
938 call RunDbgCmd(buf, 'step', ['line 1: var some = "some var"'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
939 call RunDbgCmd(buf, 'step', ['line 2: CallAFunction()'])
24918
f11779c1d123 patch 8.2.2996: Vim9: when debugging cannot inspect local variables
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
940 call RunDbgCmd(buf, 'echo some', ['some var'])
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
941
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
942 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
943 \ '\V>backtrace',
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
944 \ '\V->0 function GlobalFunction',
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
945 \ '\Vline 2: CallAFunction()',
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
946 \ ],
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
947 \ #{match: 'pattern'})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
948
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
949 call RunDbgCmd(buf, 'step', ['line 1: SourceAnotherFile()'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
950 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
26771
fc859aea8cec patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents: 26252
diff changeset
951 " Repeated line, because we first are in the compiled function before the
24918
f11779c1d123 patch 8.2.2996: Vim9: when debugging cannot inspect local variables
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
952 " EXEC and then in do_cmdline() before the :source command.
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
953 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
954 call RunDbgCmd(buf, 'step', ['line 1: vim9script'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
955 call RunDbgCmd(buf, 'step', ['line 3: def DoAThing(): number'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
956 call RunDbgCmd(buf, 'step', ['line 9: export def File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
957 call RunDbgCmd(buf, 'step', ['line 9: def File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
958 call RunDbgCmd(buf, 'step', ['line 13: defcompile'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
959 call RunDbgCmd(buf, 'step', ['line 14: File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
960 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
961 \ '\V>backtrace',
24918
f11779c1d123 patch 8.2.2996: Vim9: when debugging cannot inspect local variables
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
962 \ '\V 3 function GlobalFunction[2]',
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
963 \ '\V 2 <SNR>\.\*_CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
964 \ '\V 1 <SNR>\.\*_SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
965 \ '\V->0 script ' .. getcwd() .. '/Xtest2.vim',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
966 \ '\Vline 14: File2Function()'],
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
967 \ #{match: 'pattern'})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
968
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
969 " Don't step into compiled functions...
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
970 call RunDbgCmd(buf, 'next', ['line 15: End of sourced file'])
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
971 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
972 \ '\V>backtrace',
24918
f11779c1d123 patch 8.2.2996: Vim9: when debugging cannot inspect local variables
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
973 \ '\V 3 function GlobalFunction[2]',
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
974 \ '\V 2 <SNR>\.\*_CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
975 \ '\V 1 <SNR>\.\*_SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
976 \ '\V->0 script ' .. getcwd() .. '/Xtest2.vim',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
977 \ '\Vline 15: End of sourced file'],
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
978 \ #{match: 'pattern'})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
979
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
980 call StopVimInTerminal(buf)
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
981 call delete('Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
982 call delete('Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
983 endfunc
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
984
25719
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
985 func Test_DefFunction_expr()
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
986 CheckCWD
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
987 let file3 =<< trim END
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
988 vim9script
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
989 g:someVar = "foo"
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
990 def g:ChangeVar()
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
991 g:someVar = "bar"
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
992 echo "changed"
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
993 enddef
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
994 defcompile
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
995 END
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
996 call writefile(file3, 'Xtest3.vim')
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
997 let buf = RunVimInTerminal('-S Xtest3.vim', {})
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
998
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
999 call RunDbgCmd(buf, ':breakadd expr g:someVar')
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1000 call RunDbgCmd(buf, ':call g:ChangeVar()', ['Oldval = "''foo''"', 'Newval = "''bar''"', 'function ChangeVar', 'line 2: echo "changed"'])
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1001
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1002 call StopVimInTerminal(buf)
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1003 call delete('Xtest3.vim')
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1004 endfunc
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1005
25059
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1006 func Test_debug_def_and_legacy_function()
24978
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1007 CheckCWD
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1008 let file =<< trim END
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1009 vim9script
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1010 def g:SomeFunc()
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1011 echo "here"
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1012 echo "and"
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1013 echo "there"
24980
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1014 breakadd func 2 LocalFunc
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1015 LocalFunc()
24978
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1016 enddef
24980
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1017
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1018 def LocalFunc()
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1019 echo "first"
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1020 echo "second"
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1021 breakadd func LegacyFunc
24980
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1022 LegacyFunc()
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1023 enddef
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1024
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1025 func LegacyFunc()
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1026 echo "legone"
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1027 echo "legtwo"
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1028 endfunc
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1029
24978
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1030 breakadd func 2 g:SomeFunc
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1031 END
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1032 call writefile(file, 'XtestDebug.vim')
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1033
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1034 let buf = RunVimInTerminal('-S XtestDebug.vim', {})
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1035
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1036 call RunDbgCmd(buf,':call SomeFunc()', ['line 2: echo "and"'])
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1037 call RunDbgCmd(buf,'next', ['line 3: echo "there"'])
24980
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1038 call RunDbgCmd(buf,'next', ['line 4: breakadd func 2 LocalFunc'])
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1039
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1040 " continue, next breakpoint is in LocalFunc()
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1041 call RunDbgCmd(buf,'cont', ['line 2: echo "second"'])
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1042
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1043 " continue, next breakpoint is in LegacyFunc()
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1044 call RunDbgCmd(buf,'cont', ['line 1: echo "legone"'])
24978
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1045
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1046 call RunDbgCmd(buf, 'cont')
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1047
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1048 call StopVimInTerminal(buf)
25118
12fd67997953 patch 8.2.3096: temp files remain after running tests
Bram Moolenaar <Bram@vim.org>
parents: 25098
diff changeset
1049 call delete('XtestDebug.vim')
24978
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1050 endfunc
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1051
24932
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1052 func Test_debug_def_function()
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1053 CheckCWD
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1054 let file =<< trim END
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1055 vim9script
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1056 def g:Func()
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1057 var n: number
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1058 def Closure(): number
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1059 return n + 3
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1060 enddef
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1061 n += Closure()
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1062 echo 'result: ' .. n
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1063 enddef
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1064
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1065 def g:FuncWithArgs(text: string, nr: number, ...items: list<number>)
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1066 echo text .. nr
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1067 for it in items
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1068 echo it
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1069 endfor
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1070 echo "done"
24932
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1071 enddef
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1072
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1073 def g:FuncWithDict()
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1074 var d = {
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1075 a: 1,
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1076 b: 2,
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1077 }
24960
64b70a958f19 patch 8.2.3017: Vim9: debugger shows too many lines
Bram Moolenaar <Bram@vim.org>
parents: 24952
diff changeset
1078 # comment
64b70a958f19 patch 8.2.3017: Vim9: debugger shows too many lines
Bram Moolenaar <Bram@vim.org>
parents: 24952
diff changeset
1079 def Inner()
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1080 eval 1 + 2
24960
64b70a958f19 patch 8.2.3017: Vim9: debugger shows too many lines
Bram Moolenaar <Bram@vim.org>
parents: 24952
diff changeset
1081 enddef
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1082 enddef
25159
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1083
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1084 def g:FuncComment()
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1085 # comment
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1086 echo "first"
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1087 .. "one"
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1088 # comment
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1089 echo "second"
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1090 enddef
25159
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1091
25098
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1092 def g:FuncForLoop()
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1093 eval 1 + 2
25098
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1094 for i in [11, 22, 33]
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1095 eval i + 2
25098
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1096 endfor
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1097 echo "done"
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1098 enddef
25159
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1099
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1100 def g:FuncWithSplitLine()
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1101 eval 1 + 2
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1102 | eval 2 + 3
25159
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1103 enddef
24932
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1104 END
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1105 call writefile(file, 'Xtest.vim')
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1106
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1107 let buf = RunVimInTerminal('-S Xtest.vim', {})
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1108
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1109 call RunDbgCmd(buf,
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1110 \ ':debug call Func()',
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1111 \ ['cmd: call Func()'])
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1112 call RunDbgCmd(buf, 'next', ['result: 3'])
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1113 call term_sendkeys(buf, "\r")
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1114 call RunDbgCmd(buf, 'cont')
24932
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1115
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1116 call RunDbgCmd(buf,
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1117 \ ':debug call FuncWithArgs("asdf", 42, 1, 2, 3)',
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1118 \ ['cmd: call FuncWithArgs("asdf", 42, 1, 2, 3)'])
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1119 call RunDbgCmd(buf, 'step', ['line 1: echo text .. nr'])
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1120 call RunDbgCmd(buf, 'echo text', ['asdf'])
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1121 call RunDbgCmd(buf, 'echo nr', ['42'])
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1122 call RunDbgCmd(buf, 'echo items', ['[1, 2, 3]'])
26911
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1123 call RunDbgCmd(buf, 'step', ['asdf42', 'function FuncWithArgs', 'line 2: for it in items'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1124 call RunDbgCmd(buf, 'step', ['function FuncWithArgs', 'line 2: for it in items'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1125 call RunDbgCmd(buf, 'echo it', ['0'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1126 call RunDbgCmd(buf, 'step', ['line 3: echo it'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1127 call RunDbgCmd(buf, 'echo it', ['1'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1128 call RunDbgCmd(buf, 'step', ['1', 'function FuncWithArgs', 'line 4: endfor'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1129 call RunDbgCmd(buf, 'step', ['line 2: for it in items'])
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1130 call RunDbgCmd(buf, 'echo it', ['1'])
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1131 call RunDbgCmd(buf, 'step', ['line 3: echo it'])
26911
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1132 call RunDbgCmd(buf, 'step', ['2', 'function FuncWithArgs', 'line 4: endfor'])
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1133 call RunDbgCmd(buf, 'step', ['line 2: for it in items'])
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1134 call RunDbgCmd(buf, 'echo it', ['2'])
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1135 call RunDbgCmd(buf, 'step', ['line 3: echo it'])
26911
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1136 call RunDbgCmd(buf, 'step', ['3', 'function FuncWithArgs', 'line 4: endfor'])
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1137 call RunDbgCmd(buf, 'step', ['line 2: for it in items'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1138 call RunDbgCmd(buf, 'step', ['line 5: echo "done"'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1139 call RunDbgCmd(buf, 'cont')
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1140
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1141 call RunDbgCmd(buf,
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1142 \ ':debug call FuncWithDict()',
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1143 \ ['cmd: call FuncWithDict()'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1144 call RunDbgCmd(buf, 'step', ['line 1: var d = { a: 1, b: 2, }'])
24960
64b70a958f19 patch 8.2.3017: Vim9: debugger shows too many lines
Bram Moolenaar <Bram@vim.org>
parents: 24952
diff changeset
1145 call RunDbgCmd(buf, 'step', ['line 6: def Inner()'])
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1146 call RunDbgCmd(buf, 'cont')
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1147
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1148 call RunDbgCmd(buf, ':breakadd func 1 FuncComment')
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1149 call RunDbgCmd(buf, ':call FuncComment()', ['function FuncComment', 'line 2: echo "first" .. "one"'])
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1150 call RunDbgCmd(buf, ':breakadd func 3 FuncComment')
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1151 call RunDbgCmd(buf, 'cont', ['function FuncComment', 'line 5: echo "second"'])
25098
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1152 call RunDbgCmd(buf, 'cont')
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1153
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1154 call RunDbgCmd(buf, ':breakadd func 2 FuncForLoop')
26911
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1155 call RunDbgCmd(buf, ':call FuncForLoop()', ['function FuncForLoop', 'line 2: for i in [11, 22, 33]'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1156 call RunDbgCmd(buf, 'step', ['line 2: for i in [11, 22, 33]'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1157 call RunDbgCmd(buf, 'next', ['function FuncForLoop', 'line 3: eval i + 2'])
25098
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1158 call RunDbgCmd(buf, 'echo i', ['11'])
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1159 call RunDbgCmd(buf, 'next', ['function FuncForLoop', 'line 4: endfor'])
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1160 call RunDbgCmd(buf, 'next', ['function FuncForLoop', 'line 2: for i in [11, 22, 33]'])
26911
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1161 call RunDbgCmd(buf, 'next', ['line 3: eval i + 2'])
25098
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1162 call RunDbgCmd(buf, 'echo i', ['22'])
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1163
25159
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1164 call RunDbgCmd(buf, 'breakdel *')
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1165 call RunDbgCmd(buf, 'cont')
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1166
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1167 call RunDbgCmd(buf, ':breakadd func FuncWithSplitLine')
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1168 call RunDbgCmd(buf, ':call FuncWithSplitLine()', ['function FuncWithSplitLine', 'line 1: eval 1 + 2 | eval 2 + 3'])
25159
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1169
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1170 call RunDbgCmd(buf, 'cont')
24932
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1171 call StopVimInTerminal(buf)
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1172 call delete('Xtest.vim')
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1173 endfunc
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1174
25059
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1175 func Test_debug_def_function_with_lambda()
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1176 CheckCWD
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1177 let lines =<< trim END
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1178 vim9script
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1179 def g:Func()
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1180 var s = 'a'
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1181 ['b']->map((_, v) => s)
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1182 echo "done"
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1183 enddef
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1184 breakadd func 2 g:Func
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1185 END
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1186 call writefile(lines, 'XtestLambda.vim')
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1187
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1188 let buf = RunVimInTerminal('-S XtestLambda.vim', {})
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1189
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1190 call RunDbgCmd(buf,
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1191 \ ':call g:Func()',
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1192 \ ['function Func', 'line 2: [''b'']->map((_, v) => s)'])
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1193 call RunDbgCmd(buf,
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1194 \ 'next',
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1195 \ ['function Func', 'line 3: echo "done"'])
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1196
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1197 call RunDbgCmd(buf, 'cont')
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1198 call StopVimInTerminal(buf)
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1199 call delete('XtestLambda.vim')
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1200 endfunc
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1201
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1202 func Test_debug_backtrace_level()
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1203 CheckCWD
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1204 let lines =<< trim END
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1205 let s:file1_var = 'file1'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1206 let g:global_var = 'global'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1207
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1208 func s:File1Func( arg )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1209 let s:file1_var .= a:arg
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1210 let local_var = s:file1_var .. ' test1'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1211 let g:global_var .= local_var
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1212 source Xtest2.vim
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1213 endfunc
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1214
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1215 call s:File1Func( 'arg1' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1216 END
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1217 call writefile(lines, 'Xtest1.vim')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1218
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1219 let lines =<< trim END
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1220 let s:file2_var = 'file2'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1221
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1222 func s:File2Func( arg )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1223 let s:file2_var .= a:arg
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1224 let local_var = s:file2_var .. ' test2'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1225 let g:global_var .= local_var
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1226 endfunc
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1227
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1228 call s:File2Func( 'arg2' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1229 END
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1230 call writefile(lines, 'Xtest2.vim')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1231
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1232 let file1 = getcwd() .. '/Xtest1.vim'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1233 let file2 = getcwd() .. '/Xtest2.vim'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1234
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1235 " set a breakpoint and source file1.vim
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1236 let buf = RunVimInTerminal(
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1237 \ '-c "breakadd file 1 Xtest1.vim" -S Xtest1.vim',
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
1238 \ #{wait_for_ruler: 0})
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1239
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1240 call CheckDbgOutput(buf, [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1241 \ 'Breakpoint in "' .. file1 .. '" line 1',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1242 \ 'Entering Debug mode. Type "cont" to continue.',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1243 \ 'command line..script ' .. file1,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1244 \ 'line 1: let s:file1_var = ''file1'''
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
1245 \ ], #{msec: 5000})
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1246
23229
b545334ae654 patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents: 22969
diff changeset
1247 " step through the initial declarations
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1248 call RunDbgCmd(buf, 'step', [ 'line 2: let g:global_var = ''global''' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1249 call RunDbgCmd(buf, 'step', [ 'line 4: func s:File1Func( arg )' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1250 call RunDbgCmd(buf, 'echo s:file1_var', [ 'file1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1251 call RunDbgCmd(buf, 'echo g:global_var', [ 'global' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1252 call RunDbgCmd(buf, 'echo global_var', [ 'global' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1253
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1254 " step in to the first function
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1255 call RunDbgCmd(buf, 'step', [ 'line 11: call s:File1Func( ''arg1'' )' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1256 call RunDbgCmd(buf, 'step', [ 'line 1: let s:file1_var .= a:arg' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1257 call RunDbgCmd(buf, 'echo a:arg', [ 'arg1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1258 call RunDbgCmd(buf, 'echo s:file1_var', [ 'file1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1259 call RunDbgCmd(buf, 'echo g:global_var', [ 'global' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1260 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1261 \'echo global_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1262 \[ 'E121: Undefined variable: global_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1263 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1264 \'echo local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1265 \[ 'E121: Undefined variable: local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1266 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1267 \'echo l:local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1268 \[ 'E121: Undefined variable: l:local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1269
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1270 " backtrace up
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1271 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1272 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1273 \ '\V 2 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1274 \ '\V 1 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1275 \ '\V->0 function <SNR>\.\*_File1Func',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1276 \ '\Vline 1: let s:file1_var .= a:arg',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1277 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1278 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1279 call RunDbgCmd(buf, 'up', [ '>up' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1280
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1281 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1282 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1283 \ '\V 2 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1284 \ '\V->1 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1285 \ '\V 0 function <SNR>\.\*_File1Func',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1286 \ '\Vline 1: let s:file1_var .= a:arg',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1287 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1288 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1289
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1290 " Expression evaluation in the script frame (not the function frame)
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 25767
diff changeset
1291 " FIXME: Unexpected in this scope (a: should not be visible)
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1292 call RunDbgCmd(buf, 'echo a:arg', [ 'arg1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1293 call RunDbgCmd(buf, 'echo s:file1_var', [ 'file1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1294 call RunDbgCmd(buf, 'echo g:global_var', [ 'global' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1295 " FIXME: Unexpected in this scope (global should be found)
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1296 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1297 \'echo global_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1298 \[ 'E121: Undefined variable: global_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1299 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1300 \'echo local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1301 \[ 'E121: Undefined variable: local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1302 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1303 \'echo l:local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1304 \[ 'E121: Undefined variable: l:local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1305
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1306
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1307 " step while backtraced jumps to the latest frame
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1308 call RunDbgCmd(buf, 'step', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1309 \ 'line 2: let local_var = s:file1_var .. '' test1''' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1310 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1311 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1312 \ '\V 2 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1313 \ '\V 1 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1314 \ '\V->0 function <SNR>\.\*_File1Func',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1315 \ '\Vline 2: let local_var = s:file1_var .. '' test1''',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1316 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1317 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1318
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1319 call RunDbgCmd(buf, 'step', [ 'line 3: let g:global_var .= local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1320 call RunDbgCmd(buf, 'echo local_var', [ 'file1arg1 test1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1321 call RunDbgCmd(buf, 'echo l:local_var', [ 'file1arg1 test1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1322
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1323 call RunDbgCmd(buf, 'step', [ 'line 4: source Xtest2.vim' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1324 call RunDbgCmd(buf, 'step', [ 'line 1: let s:file2_var = ''file2''' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1325 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1326 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1327 \ '\V 3 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1328 \ '\V 2 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1329 \ '\V 1 function <SNR>\.\*_File1Func[4]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1330 \ '\V->0 script ' .. file2,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1331 \ '\Vline 1: let s:file2_var = ''file2''',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1332 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1333 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1334
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1335 " Expression evaluation in the script frame file2 (not the function frame)
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1336 call RunDbgCmd(buf, 'echo a:arg', [ 'E121: Undefined variable: a:arg' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1337 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1338 \ 'echo s:file1_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1339 \ [ 'E121: Undefined variable: s:file1_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1340 call RunDbgCmd(buf, 'echo g:global_var', [ 'globalfile1arg1 test1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1341 call RunDbgCmd(buf, 'echo global_var', [ 'globalfile1arg1 test1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1342 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1343 \'echo local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1344 \[ 'E121: Undefined variable: local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1345 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1346 \'echo l:local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1347 \[ 'E121: Undefined variable: l:local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1348 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1349 \ 'echo s:file2_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1350 \ [ 'E121: Undefined variable: s:file2_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1351
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1352 call RunDbgCmd(buf, 'step', [ 'line 3: func s:File2Func( arg )' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1353 call RunDbgCmd(buf, 'echo s:file2_var', [ 'file2' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1354
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1355 " Up the stack to the other script context
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1356 call RunDbgCmd(buf, 'up')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1357 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1358 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1359 \ '\V 3 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1360 \ '\V 2 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1361 \ '\V->1 function <SNR>\.\*_File1Func[4]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1362 \ '\V 0 script ' .. file2,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1363 \ '\Vline 3: func s:File2Func( arg )',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1364 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1365 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1366 " FIXME: Unexpected. Should see the a: and l: dicts from File1Func
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1367 call RunDbgCmd(buf, 'echo a:arg', [ 'E121: Undefined variable: a:arg' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1368 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1369 \ 'echo l:local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1370 \ [ 'E121: Undefined variable: l:local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1371
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1372 call RunDbgCmd(buf, 'up')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1373 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1374 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1375 \ '\V 3 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1376 \ '\V->2 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1377 \ '\V 1 function <SNR>\.\*_File1Func[4]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1378 \ '\V 0 script ' .. file2,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1379 \ '\Vline 3: func s:File2Func( arg )',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1380 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1381 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1382
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1383 " FIXME: Unexpected (wrong script vars are used)
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1384 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1385 \ 'echo s:file1_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1386 \ [ 'E121: Undefined variable: s:file1_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1387 call RunDbgCmd(buf, 'echo s:file2_var', [ 'file2' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1388
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
1389 call RunDbgCmd(buf, 'cont')
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1390 call StopVimInTerminal(buf)
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1391 call delete('Xtest1.vim')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1392 call delete('Xtest2.vim')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1393 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21687
diff changeset
1394
21777
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1395 " Test for setting a breakpoint on a :endif where the :if condition is false
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1396 " and then quit the script. This should generate an interrupt.
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1397 func Test_breakpt_endif_intr()
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1398 func F()
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1399 let g:Xpath ..= 'a'
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1400 if v:false
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1401 let g:Xpath ..= 'b'
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1402 endif
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1403 invalid_command
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1404 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1405
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1406 let g:Xpath = ''
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1407 breakadd func 4 F
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1408 try
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1409 let caught_intr = 0
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1410 debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1411 call feedkeys(":call F()\<CR>quit\<CR>", "xt")
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1412 catch /^Vim:Interrupt$/
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1413 call assert_match('\.F, line 4', v:throwpoint)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1414 let caught_intr = 1
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1415 endtry
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1416 0debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1417 call assert_equal(1, caught_intr)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1418 call assert_equal('a', g:Xpath)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1419 breakdel *
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1420 delfunc F
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1421 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1422
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1423 " Test for setting a breakpoint on a :else where the :if condition is false
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1424 " and then quit the script. This should generate an interrupt.
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1425 func Test_breakpt_else_intr()
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1426 func F()
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1427 let g:Xpath ..= 'a'
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1428 if v:false
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1429 let g:Xpath ..= 'b'
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1430 else
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1431 invalid_command
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1432 endif
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1433 invalid_command
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1434 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1435
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1436 let g:Xpath = ''
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1437 breakadd func 4 F
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1438 try
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1439 let caught_intr = 0
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1440 debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1441 call feedkeys(":call F()\<CR>quit\<CR>", "xt")
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1442 catch /^Vim:Interrupt$/
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1443 call assert_match('\.F, line 4', v:throwpoint)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1444 let caught_intr = 1
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1445 endtry
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1446 0debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1447 call assert_equal(1, caught_intr)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1448 call assert_equal('a', g:Xpath)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1449 breakdel *
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1450 delfunc F
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1451 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1452
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1453 " Test for setting a breakpoint on a :endwhile where the :while condition is
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1454 " false and then quit the script. This should generate an interrupt.
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1455 func Test_breakpt_endwhile_intr()
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1456 func F()
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1457 let g:Xpath ..= 'a'
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1458 while v:false
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1459 let g:Xpath ..= 'b'
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1460 endwhile
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1461 invalid_command
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1462 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1463
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1464 let g:Xpath = ''
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1465 breakadd func 4 F
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1466 try
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1467 let caught_intr = 0
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1468 debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1469 call feedkeys(":call F()\<CR>quit\<CR>", "xt")
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1470 catch /^Vim:Interrupt$/
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1471 call assert_match('\.F, line 4', v:throwpoint)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1472 let caught_intr = 1
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1473 endtry
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1474 0debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1475 call assert_equal(1, caught_intr)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1476 call assert_equal('a', g:Xpath)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1477 breakdel *
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1478 delfunc F
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1479 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1480
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1481 " Test for setting a breakpoint on a script local function
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1482 func Test_breakpt_scriptlocal_func()
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1483 let g:Xpath = ''
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1484 func s:G()
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1485 let g:Xpath ..= 'a'
21777
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1486 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1487
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1488 let funcname = expand("<SID>") .. "G"
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1489 exe "breakadd func 1 " .. funcname
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1490 debuggreedy
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1491 redir => output
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1492 call feedkeys(":call " .. funcname .. "()\<CR>c\<CR>", "xt")
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1493 redir END
21777
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1494 0debuggreedy
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1495 call assert_match('Breakpoint in "' .. funcname .. '" line 1', output)
21777
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1496 call assert_equal('a', g:Xpath)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1497 breakdel *
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1498 exe "delfunc " .. funcname
21777
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1499 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1500
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21687
diff changeset
1501 " vim: shiftwidth=2 sts=2 expandtab