annotate src/testdir/test_debugger.vim @ 32613:de4b01b2d7d1 v9.0.1638

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