Mercurial > vim
annotate src/testdir/test_termdebug.vim @ 33735:c6e847116941
runtime(termdebug): improve window handling, shorten var types
Commit: https://github.com/vim/vim/commit/ca48202b6f46cfb40a0d1d80033a2f3e8cb7b813
Author: shane.xb.qian <shane.qian@foxmail.com>
Date: Wed Nov 8 21:59:15 2023 +0100
runtime(termdebug): improve window handling, shorten var types
closes https://github.com/vim/vim/issues/13474
Signed-off-by: shane.xb.qian <shane.qian@foxmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 08 Nov 2023 22:15:03 +0100 |
parents | 55e587f6b02f |
children | 0839c759c9d1 |
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 |
33735
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
83 |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
84 let cn = 0 |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
85 " 60 is approx spaceBuffer * 3 |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
86 if winwidth(0) <= 78 + 60 |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
87 Var |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
88 call assert_equal(winnr(), winnr('$')) |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
89 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
|
90 let cn += 1 |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
91 bw! |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
92 Asm |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
93 call assert_equal(winnr(), winnr('$')) |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
94 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
|
95 let cn += 1 |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
96 bw! |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
97 endif |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
98 set columns=160 |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
99 Var |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
100 call assert_equal(winnr(), winnr('$') - 1) |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
101 call assert_equal(winlayout(), ['col', [['leaf', 1002], ['leaf', 1001], ['row', [['leaf', 1003 + cn], ['leaf', 1000]]]]]) |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
102 let cn += 1 |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
103 bw! |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
104 Asm |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
105 call assert_equal(winnr(), winnr('$') - 1) |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
106 call assert_equal(winlayout(), ['col', [['leaf', 1002], ['leaf', 1001], ['row', [['leaf', 1003 + cn], ['leaf', 1000]]]]]) |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
107 let cn += 1 |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
108 bw! |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
109 set columns& |
c6e847116941
runtime(termdebug): improve window handling, shorten var types
Christian Brabandt <cb@256bit.org>
parents:
33734
diff
changeset
|
110 |
32998
d55bf5bbcb6f
patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 wincmd t |
d55bf5bbcb6f
patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 quit! |
d55bf5bbcb6f
patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 redraw! |
33734
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
114 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
|
115 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
|
116 |
d55bf5bbcb6f
patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 call delete('XTD_basic') |
d55bf5bbcb6f
patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 %bw! |
d55bf5bbcb6f
patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 endfunc |
d55bf5bbcb6f
patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 |
33734
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
121 func Test_termdebug_mapping() |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
122 %bw! |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
123 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
|
124 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
|
125 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
|
126 Termdebug |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
127 call WaitForAssert({-> assert_equal(3, winnr('$'))}) |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
128 wincmd b |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
129 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
|
130 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
|
131 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
|
132 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
|
133 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
|
134 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
|
135 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
|
136 wincmd t |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
137 quit! |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
138 redraw! |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
139 call WaitForAssert({-> assert_equal(1, winnr('$'))}) |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
140 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
|
141 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
|
142 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
|
143 |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
144 %bw! |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
145 nnoremap K :echom "K"<cr> |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
146 nnoremap - :echom "-"<cr> |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
147 nnoremap + :echom "+"<cr> |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
148 Termdebug |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
149 call WaitForAssert({-> assert_equal(3, winnr('$'))}) |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
150 wincmd b |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
151 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
|
152 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
|
153 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
|
154 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
|
155 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
|
156 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
|
157 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
|
158 wincmd t |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
159 quit! |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
160 redraw! |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
161 call WaitForAssert({-> assert_equal(1, winnr('$'))}) |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
162 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
|
163 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
|
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('K', 'n', 0, 1).buffer, 0) |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
166 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
|
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('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
|
169 |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
170 %bw! |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
171 nnoremap <buffer> K :echom "bK"<cr> |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
172 nnoremap <buffer> - :echom "b-"<cr> |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
173 nnoremap <buffer> + :echom "b+"<cr> |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
174 Termdebug |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
175 call WaitForAssert({-> assert_equal(3, winnr('$'))}) |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
176 wincmd b |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
177 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
|
178 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
|
179 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
|
180 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
|
181 wincmd t |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
182 quit! |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
183 redraw! |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
184 call WaitForAssert({-> assert_equal(1, winnr('$'))}) |
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).buffer, 1) |
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).buffer, 1) |
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).buffer, 1) |
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).rhs, ':echom "bK"<cr>') |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
189 |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
190 %bw! |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
191 endfunc |
55e587f6b02f
runtime(termdebug): handle buffer-local mappings properly
Christian Brabandt <cb@256bit.org>
parents:
33041
diff
changeset
|
192 |
32998
d55bf5bbcb6f
patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 " vim: shiftwidth=2 sts=2 expandtab |