annotate src/testdir/test_termdebug.vim @ 33517:921673b465a6 v9.0.2007

patch 9.0.2007: Vim9: covariant parameter types allowed Commit: https://github.com/vim/vim/commit/e4671890220ef3f2bca43fde6ffe5d3ef3ed0e42 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Mon Oct 9 18:01:06 2023 +0200 patch 9.0.2007: Vim9: covariant parameter types allowed Problem: Vim9: covariant parameter types allowed when assigning functions Solution: Enforce invariant type check for arguments and return value when assigning a funcref closes: #13299 closes: #13305 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author Christian Brabandt <cb@256bit.org>
date Mon, 09 Oct 2023 18:15:03 +0200
parents 5334aca4cef4
children 55e587f6b02f
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
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 wincmd t
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 quit!
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 redraw!
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 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
87
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 call delete('XTD_basic')
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 %bw!
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 endfunc
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91
d55bf5bbcb6f patch 9.0.1791: No tests for the termdebug plugin
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 " vim: shiftwidth=2 sts=2 expandtab