annotate src/testdir/test_termdebug.vim @ 33940:f60c0fe7cae4 v9.0.2166

patch 9.0.2166: Memory leak in Configure Script when checking GTK Commit: https://github.com/vim/vim/commit/549f8c0b4ebe47168c98f46c8b62b1eb33da7c9c Author: Zdenek Dohnal <zdohnal@redhat.com> Date: Thu Dec 14 20:22:49 2023 +0100 patch 9.0.2166: Memory leak in Configure Script when checking GTK Problem: Memory leak in Configure Script when checking GTK Solution: Free the allocated memory If the memory is not freed, GTK GUI VIM cannot be build with address sanitizer for debugging purposes - configure script will report missing GTK, because the testing file compilation fails due reported memory leak. closes: #13672 Signed-off-by: Zdenek Dohnal <zdohnal@redhat.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 14 Dec 2023 20:30:05 +0100
parents ffe9ffcb57e7
children 4cacac1abdb8
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
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 packadd termdebug
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 func Test_termdebug_basic()
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 let lines =<< trim END
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 #include <stdio.h>
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 #include <stdlib.h>
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 int isprime(int n)
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 {
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 if (n <= 1)
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 return 0;
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 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
34 if (n % i == 0)
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 return 0;
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 return 1;
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
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 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
41 {
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 int n = 7;
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 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
45
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 return 0;
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 }
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 END
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 call writefile(lines, 'XTD_basic.c', 'D')
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 call system($'{g:GCC} -g -o XTD_basic XTD_basic.c')
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 edit XTD_basic.c
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 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
54 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
55 let gdb_buf = winbufnr(1)
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 wincmd b
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 Break 9
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 call term_wait(gdb_buf)
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 redraw!
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 call assert_equal([
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 \ {'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
62 \ 'priority': 110, 'group': 'TermDebug'}],
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 \ 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
64 Run
33037
e937929e4bff patch 9.0.1809: termdebug test flayk
Christian Brabandt <cb@256bit.org>
parents: 33035
diff changeset
65 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
66 redraw!
33041
5334aca4cef4 patch 9.0.1811: still some issues with term_debug test
Christian Brabandt <cb@256bit.org>
parents: 33037
diff changeset
67 call WaitForAssert({-> assert_equal([
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 \ {'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
69 \ 'group': 'TermDebug'},
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 \ {'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
71 \ '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
72 \ 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
73 Finish
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 call term_wait(gdb_buf)
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 redraw!
33041
5334aca4cef4 patch 9.0.1811: still some issues with term_debug test
Christian Brabandt <cb@256bit.org>
parents: 33037
diff changeset
76 call WaitForAssert({-> assert_equal([
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 \ {'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
78 \ 'priority': 110, 'group': 'TermDebug'},
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 \ {'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
80 \ '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
81 \ 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
82 Continue
33761
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
83 call term_wait(gdb_buf)
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
84
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
85 let i = 2
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
86 while i <= 258
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
87 Break
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
88 call term_wait(gdb_buf)
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
89 if i == 2
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
90 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
91 endif
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
92 if i == 10
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
93 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
94 endif
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
95 if i == 168
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
96 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
97 endif
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
98 if i == 255
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
99 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
100 endif
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
101 if i == 256
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('debugBreakpoint256.0')[0].text, 'F+')})
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 == 258
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('debugBreakpoint258.0')[0].text, 'F+')})
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 let i += 1
ffe9ffcb57e7 runtime(termdebug): improve the breakpoint sign label (#13525)
Christian Brabandt <cb@256bit.org>
parents: 33758
diff changeset
108 endwhile
33735
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
109
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
110 let cn = 0
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
111 " 60 is approx spaceBuffer * 3
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
112 if winwidth(0) <= 78 + 60
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
113 Var
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
114 call assert_equal(winnr(), winnr('$'))
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
115 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
116 let cn += 1
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
117 bw!
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
118 Asm
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
119 call assert_equal(winnr(), winnr('$'))
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
120 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
121 let cn += 1
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
122 bw!
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
123 endif
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
124 set columns=160
33758
75176b7f8170 patch 9.0.2101: CI: test_termdebug may still fail
Christian Brabandt <cb@256bit.org>
parents: 33753
diff changeset
125 call term_wait(gdb_buf)
33753
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
126 let winw = winwidth(0)
33735
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
127 Var
33753
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
128 if winwidth(0) < winw
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
129 call assert_equal(winnr(), winnr('$') - 1)
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
130 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
131 let cn += 1
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
132 bw!
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
133 endif
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
134 let winw = winwidth(0)
33735
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
135 Asm
33753
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
136 if winwidth(0) < winw
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
137 call assert_equal(winnr(), winnr('$') - 1)
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
138 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
139 let cn += 1
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
140 bw!
0839c759c9d1 patch 9.0.2100: CI: test_termdebug fails
Christian Brabandt <cb@256bit.org>
parents: 33735
diff changeset
141 endif
33735
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
142 set columns&
33758
75176b7f8170 patch 9.0.2101: CI: test_termdebug may still fail
Christian Brabandt <cb@256bit.org>
parents: 33753
diff changeset
143 call term_wait(gdb_buf)
33735
c6e847116941 runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents: 33734
diff changeset
144
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 wincmd t
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 quit!
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 redraw!
33734
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
148 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
149 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
150
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 call delete('XTD_basic')
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 %bw!
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 endfunc
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154
33734
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
155 func Test_termdebug_mapping()
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
156 %bw!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
157 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
158 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
159 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
160 Termdebug
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
161 call WaitForAssert({-> assert_equal(3, winnr('$'))})
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
162 wincmd b
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
163 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
164 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
165 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
166 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
167 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
168 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
169 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
170 wincmd t
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
171 quit!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
172 redraw!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
173 call WaitForAssert({-> assert_equal(1, winnr('$'))})
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
174 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
175 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
176 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
177
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
178 %bw!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
179 nnoremap K :echom "K"<cr>
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
180 nnoremap - :echom "-"<cr>
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
181 nnoremap + :echom "+"<cr>
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
182 Termdebug
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
183 call WaitForAssert({-> assert_equal(3, winnr('$'))})
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
184 wincmd b
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
185 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
186 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
187 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
188 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
189 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
190 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
191 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
192 wincmd t
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
193 quit!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
194 redraw!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
195 call WaitForAssert({-> assert_equal(1, winnr('$'))})
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
196 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
197 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
198 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
199 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
200 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
201 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
202 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
203
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
204 %bw!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
205 nnoremap <buffer> K :echom "bK"<cr>
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
206 nnoremap <buffer> - :echom "b-"<cr>
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
207 nnoremap <buffer> + :echom "b+"<cr>
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
208 Termdebug
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
209 call WaitForAssert({-> assert_equal(3, winnr('$'))})
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
210 wincmd b
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
211 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
212 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
213 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
214 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
215 wincmd t
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
216 quit!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
217 redraw!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
218 call WaitForAssert({-> assert_equal(1, winnr('$'))})
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
219 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
220 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
221 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
222 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
223
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
224 %bw!
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
225 endfunc
55e587f6b02f runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents: 33041
diff changeset
226
32998
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 " vim: shiftwidth=2 sts=2 expandtab