annotate src/testdir/test_termdebug.vim @ 35172:c98f002b1fe4 default tip

runtime(doc): fix typo in usr_52.txt Commit: https://github.com/vim/vim/commit/b7258738f80f26be302a84a99f968b3bdc2f29bb Author: Christian Brabandt <cb@256bit.org> Date: Sun May 12 19:04:47 2024 +0200 runtime(doc): fix typo in usr_52.txt fixes: https://github.com/vim/vim/issues/14758 Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sun, 12 May 2024 19:15:08 +0200
parents 4cacac1abdb8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for the termdebug plugin
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
33041
5334aca4cef4 patch 9.0.1811: still some issues with term_debug test
Christian Brabandt <cb@256bit.org>
parents: 33037
diff changeset
3 source shared.vim
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 source check.vim
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 CheckUnix
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 CheckFeature terminal
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 CheckExecutable gdb
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 CheckExecutable gcc
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 let g:GDB = exepath('gdb')
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 if g:GDB->empty()
33035
50fe2cd56d3a patch 9.0.1808: termdebug: Typo in termdebug test
Christian Brabandt <cb@256bit.org>
parents: 32998
diff changeset
13 throw 'Skipped: gdb is not found in $PATH'
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 endif
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 let g:GCC = exepath('gcc')
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 if g:GCC->empty()
33035
50fe2cd56d3a patch 9.0.1808: termdebug: Typo in termdebug test
Christian Brabandt <cb@256bit.org>
parents: 32998
diff changeset
18 throw 'Skipped: gcc is not found in $PATH'
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 endif
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20
33944
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
21 function s:generate_files(bin_name)
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
22 let src_name = a:bin_name .. '.c'
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 let lines =<< trim END
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 #include <stdio.h>
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 #include <stdlib.h>
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 int isprime(int n)
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 {
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 if (n <= 1)
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 return 0;
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 for (int i = 2; i <= n / 2; i++)
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 if (n % i == 0)
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 return 0;
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 return 1;
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 }
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 int main(int argc, char *argv[])
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 {
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 int n = 7;
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 printf("%d is %s prime\n", n, isprime(n) ? "a" : "not a");
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 return 0;
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 }
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 END
33944
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
48 call writefile(lines, src_name)
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
49 call system($'{g:GCC} -g -o {a:bin_name} {src_name}')
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
50 endfunction
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
51
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
52 function s:cleanup_files(bin_name)
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
53 call delete(a:bin_name)
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
54 call delete(a:bin_name .. '.c')
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
55 endfunction
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
56
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
57 packadd termdebug
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
58
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
59 func Test_termdebug_basic()
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
60 let bin_name = 'XTD_basic'
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
61 let src_name = bin_name .. '.c'
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
62 call s:generate_files(bin_name)
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 edit XTD_basic.c
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 Termdebug ./XTD_basic
33041
5334aca4cef4 patch 9.0.1811: still some issues with term_debug test
Christian Brabandt <cb@256bit.org>
parents: 33037
diff changeset
66 call WaitForAssert({-> assert_equal(3, winnr('$'))})
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 let gdb_buf = winbufnr(1)
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 wincmd b
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 Break 9
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 call term_wait(gdb_buf)
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 redraw!
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 call assert_equal([
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 \ {'lnum': 9, 'id': 1014, 'name': 'debugBreakpoint1.0',
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 \ 'priority': 110, 'group': 'TermDebug'}],
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 \ sign_getplaced('', #{group: 'TermDebug'})[0].signs)
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 Run
33037
e937929e4bff patch 9.0.1809: termdebug test flayk
Christian Brabandt <cb@256bit.org>
parents: 33035
diff changeset
77 call term_wait(gdb_buf, 400)
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 redraw!
33041
5334aca4cef4 patch 9.0.1811: still some issues with term_debug test
Christian Brabandt <cb@256bit.org>
parents: 33037
diff changeset
79 call WaitForAssert({-> assert_equal([
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 \ {'lnum': 9, 'id': 12, 'name': 'debugPC', 'priority': 110,
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 \ 'group': 'TermDebug'},
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 \ {'lnum': 9, 'id': 1014, 'name': 'debugBreakpoint1.0',
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 \ 'priority': 110, 'group': 'TermDebug'}],
33041
5334aca4cef4 patch 9.0.1811: still some issues with term_debug test
Christian Brabandt <cb@256bit.org>
parents: 33037
diff changeset
84 \ sign_getplaced('', #{group: 'TermDebug'})[0].signs)})
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 Finish
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 call term_wait(gdb_buf)
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 redraw!
33041
5334aca4cef4 patch 9.0.1811: still some issues with term_debug test
Christian Brabandt <cb@256bit.org>
parents: 33037
diff changeset
88 call WaitForAssert({-> assert_equal([
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 \ {'lnum': 9, 'id': 1014, 'name': 'debugBreakpoint1.0',
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 \ 'priority': 110, 'group': 'TermDebug'},
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 \ {'lnum': 20, 'id': 12, 'name': 'debugPC',
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 \ 'priority': 110, 'group': 'TermDebug'}],
33041
5334aca4cef4 patch 9.0.1811: still some issues with term_debug test
Christian Brabandt <cb@256bit.org>
parents: 33037
diff changeset
93 \ sign_getplaced('', #{group: 'TermDebug'})[0].signs)})
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 Continue
33761
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
95 call term_wait(gdb_buf)
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
96
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
97 let i = 2
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
98 while i <= 258
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
99 Break
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
100 call term_wait(gdb_buf)
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
101 if i == 2
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
102 call WaitForAssert({-> assert_equal(sign_getdefined('debugBreakpoint2.0')[0].text, '02')})
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
103 endif
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
104 if i == 10
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
105 call WaitForAssert({-> assert_equal(sign_getdefined('debugBreakpoint10.0')[0].text, '0A')})
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
106 endif
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
107 if i == 168
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
108 call WaitForAssert({-> assert_equal(sign_getdefined('debugBreakpoint168.0')[0].text, 'A8')})
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
109 endif
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
110 if i == 255
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
111 call WaitForAssert({-> assert_equal(sign_getdefined('debugBreakpoint255.0')[0].text, 'FF')})
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
112 endif
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
113 if i == 256
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
114 call WaitForAssert({-> assert_equal(sign_getdefined('debugBreakpoint256.0')[0].text, 'F+')})
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
115 endif
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
116 if i == 258
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
117 call WaitForAssert({-> assert_equal(sign_getdefined('debugBreakpoint258.0')[0].text, 'F+')})
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
118 endif
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
119 let i += 1
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
120 endwhile
33735
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
121
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
122 let cn = 0
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
123 " 60 is approx spaceBuffer * 3
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
124 if winwidth(0) <= 78 + 60
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
125 Var
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
126 call assert_equal(winnr(), winnr('$'))
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
127 call assert_equal(winlayout(), ['col', [['leaf', 1002], ['leaf', 1001], ['leaf', 1000], ['leaf', 1003 + cn]]])
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
128 let cn += 1
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
129 bw!
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
130 Asm
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
131 call assert_equal(winnr(), winnr('$'))
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
132 call assert_equal(winlayout(), ['col', [['leaf', 1002], ['leaf', 1001], ['leaf', 1000], ['leaf', 1003 + cn]]])
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
133 let cn += 1
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
134 bw!
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
135 endif
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
136 set columns=160
33758
75176b7f8170 patch 9.0.2101: CI: test_termdebug may still fail
Christian Brabandt <cb@256bit.org>
parents: 33753
diff changeset
137 call term_wait(gdb_buf)
33753
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
138 let winw = winwidth(0)
33735
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
139 Var
33753
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
140 if winwidth(0) < winw
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
141 call assert_equal(winnr(), winnr('$') - 1)
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
142 call assert_equal(winlayout(), ['col', [['leaf', 1002], ['leaf', 1001], ['row', [['leaf', 1003 + cn], ['leaf', 1000]]]]])
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
143 let cn += 1
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
144 bw!
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
145 endif
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
146 let winw = winwidth(0)
33735
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
147 Asm
33753
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
148 if winwidth(0) < winw
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
149 call assert_equal(winnr(), winnr('$') - 1)
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
150 call assert_equal(winlayout(), ['col', [['leaf', 1002], ['leaf', 1001], ['row', [['leaf', 1003 + cn], ['leaf', 1000]]]]])
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
151 let cn += 1
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
152 bw!
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
153 endif
33735
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
154 set columns&
33758
75176b7f8170 patch 9.0.2101: CI: test_termdebug may still fail
Christian Brabandt <cb@256bit.org>
parents: 33753
diff changeset
155 call term_wait(gdb_buf)
33735
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
156
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 wincmd t
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 quit!
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 redraw!
33734
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
160 call WaitForAssert({-> assert_equal(1, winnr('$'))})
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 call assert_equal([], sign_getplaced('', #{group: 'TermDebug'})[0].signs)
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162
33944
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
163 call s:cleanup_files(bin_name)
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
164 %bw!
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
165 endfunc
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
166
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
167 func Test_termdebug_tbreak()
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
168 let g:test_is_flaky = 1
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
169 let bin_name = 'XTD_tbreak'
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
170 let src_name = bin_name .. '.c'
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
171
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
172 eval s:generate_files(bin_name)
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
173
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
174 execute 'edit ' .. src_name
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
175 execute 'Termdebug ./' .. bin_name
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
176
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
177 call WaitForAssert({-> assert_equal(3, winnr('$'))})
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
178 let gdb_buf = winbufnr(1)
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
179 wincmd b
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
180
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
181 let bp_line = 22 " 'return' statement in main
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
182 let temp_bp_line = 10 " 'if' statement in 'for' loop body
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
183 execute "Tbreak " .. temp_bp_line
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
184 execute "Break " .. bp_line
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
185
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
186 call term_wait(gdb_buf)
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
187 redraw!
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
188 " both temporary and normal breakpoint signs were displayed...
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
189 call assert_equal([
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
190 \ {'lnum': temp_bp_line, 'id': 1014, 'name': 'debugBreakpoint1.0',
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
191 \ 'priority': 110, 'group': 'TermDebug'},
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
192 \ {'lnum': bp_line, 'id': 2014, 'name': 'debugBreakpoint2.0',
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
193 \ 'priority': 110, 'group': 'TermDebug'}],
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
194 \ sign_getplaced('', #{group: 'TermDebug'})[0].signs)
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
195
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
196 Run
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
197 call term_wait(gdb_buf, 400)
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
198 redraw!
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
199 " debugPC sign is on the line where the temp. bp was set;
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
200 " temp. bp sign was removed after hit;
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
201 " normal bp sign is still present
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
202 call WaitForAssert({-> assert_equal([
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
203 \ {'lnum': temp_bp_line, 'id': 12, 'name': 'debugPC', 'priority': 110,
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
204 \ 'group': 'TermDebug'},
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
205 \ {'lnum': bp_line, 'id': 2014, 'name': 'debugBreakpoint2.0',
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
206 \ 'priority': 110, 'group': 'TermDebug'}],
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
207 \ sign_getplaced('', #{group: 'TermDebug'})[0].signs)})
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
208
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
209 Continue
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
210 call term_wait(gdb_buf)
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
211 redraw!
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
212 " debugPC is on the normal breakpoint,
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
213 " temp. bp on line 10 was only hit once
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
214 call WaitForAssert({-> assert_equal([
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
215 \ {'lnum': bp_line, 'id': 12, 'name': 'debugPC', 'priority': 110,
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
216 \ 'group': 'TermDebug'},
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
217 \ {'lnum': bp_line, 'id': 2014, 'name': 'debugBreakpoint2.0',
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
218 \ 'priority': 110, 'group': 'TermDebug'}],
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
219 \ sign_getplaced('', #{group: 'TermDebug'})[0].signs)})
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
220
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
221 wincmd t
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
222 quit!
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
223 redraw!
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
224 call WaitForAssert({-> assert_equal(1, winnr('$'))})
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
225 call assert_equal([], sign_getplaced('', #{group: 'TermDebug'})[0].signs)
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
226
4cacac1abdb8 runtime(termdebug): add Tbreak command
Christian Brabandt <cb@256bit.org>
parents: 33761
diff changeset
227 eval s:cleanup_files(bin_name)
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 %bw!
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 endfunc
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230
33734
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
231 func Test_termdebug_mapping()
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
232 %bw!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
233 call assert_equal(maparg('K', 'n', 0, 1)->empty(), 1)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
234 call assert_equal(maparg('-', 'n', 0, 1)->empty(), 1)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
235 call assert_equal(maparg('+', 'n', 0, 1)->empty(), 1)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
236 Termdebug
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
237 call WaitForAssert({-> assert_equal(3, winnr('$'))})
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
238 wincmd b
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
239 call assert_equal(maparg('K', 'n', 0, 1)->empty(), 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
240 call assert_equal(maparg('-', 'n', 0, 1)->empty(), 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
241 call assert_equal(maparg('+', 'n', 0, 1)->empty(), 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
242 call assert_equal(maparg('K', 'n', 0, 1).buffer, 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
243 call assert_equal(maparg('-', 'n', 0, 1).buffer, 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
244 call assert_equal(maparg('+', 'n', 0, 1).buffer, 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
245 call assert_equal(maparg('K', 'n', 0, 1).rhs, ':Evaluate<CR>')
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
246 wincmd t
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
247 quit!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
248 redraw!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
249 call WaitForAssert({-> assert_equal(1, winnr('$'))})
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
250 call assert_equal(maparg('K', 'n', 0, 1)->empty(), 1)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
251 call assert_equal(maparg('-', 'n', 0, 1)->empty(), 1)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
252 call assert_equal(maparg('+', 'n', 0, 1)->empty(), 1)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
253
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
254 %bw!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
255 nnoremap K :echom "K"<cr>
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
256 nnoremap - :echom "-"<cr>
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
257 nnoremap + :echom "+"<cr>
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
258 Termdebug
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
259 call WaitForAssert({-> assert_equal(3, winnr('$'))})
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
260 wincmd b
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
261 call assert_equal(maparg('K', 'n', 0, 1)->empty(), 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
262 call assert_equal(maparg('-', 'n', 0, 1)->empty(), 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
263 call assert_equal(maparg('+', 'n', 0, 1)->empty(), 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
264 call assert_equal(maparg('K', 'n', 0, 1).buffer, 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
265 call assert_equal(maparg('-', 'n', 0, 1).buffer, 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
266 call assert_equal(maparg('+', 'n', 0, 1).buffer, 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
267 call assert_equal(maparg('K', 'n', 0, 1).rhs, ':Evaluate<CR>')
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
268 wincmd t
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
269 quit!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
270 redraw!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
271 call WaitForAssert({-> assert_equal(1, winnr('$'))})
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
272 call assert_equal(maparg('K', 'n', 0, 1)->empty(), 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
273 call assert_equal(maparg('-', 'n', 0, 1)->empty(), 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
274 call assert_equal(maparg('+', 'n', 0, 1)->empty(), 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
275 call assert_equal(maparg('K', 'n', 0, 1).buffer, 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
276 call assert_equal(maparg('-', 'n', 0, 1).buffer, 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
277 call assert_equal(maparg('+', 'n', 0, 1).buffer, 0)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
278 call assert_equal(maparg('K', 'n', 0, 1).rhs, ':echom "K"<cr>')
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
279
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
280 %bw!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
281 nnoremap <buffer> K :echom "bK"<cr>
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
282 nnoremap <buffer> - :echom "b-"<cr>
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
283 nnoremap <buffer> + :echom "b+"<cr>
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
284 Termdebug
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
285 call WaitForAssert({-> assert_equal(3, winnr('$'))})
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
286 wincmd b
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
287 call assert_equal(maparg('K', 'n', 0, 1).buffer, 1)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
288 call assert_equal(maparg('-', 'n', 0, 1).buffer, 1)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
289 call assert_equal(maparg('+', 'n', 0, 1).buffer, 1)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
290 call assert_equal(maparg('K', 'n', 0, 1).rhs, ':echom "bK"<cr>')
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
291 wincmd t
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
292 quit!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
293 redraw!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
294 call WaitForAssert({-> assert_equal(1, winnr('$'))})
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
295 call assert_equal(maparg('K', 'n', 0, 1).buffer, 1)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
296 call assert_equal(maparg('-', 'n', 0, 1).buffer, 1)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
297 call assert_equal(maparg('+', 'n', 0, 1).buffer, 1)
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
298 call assert_equal(maparg('K', 'n', 0, 1).rhs, ':echom "bK"<cr>')
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
299
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
300 %bw!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
301 endfunc
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
302
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
303 " vim: shiftwidth=2 sts=2 expandtab