Mercurial > vim
annotate src/testdir/test_terminal2.vim @ 22021:514d622473af v8.2.1560
patch 8.2.1560: using NULL pointers in some code
Commit: https://github.com/vim/vim/commit/9c2b06637b32742cac11bfd66b1a4e84583c6c2e
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Sep 1 19:56:15 2020 +0200
patch 8.2.1560: using NULL pointers in some code
Problem: Using NULL pointers in some code. (James McCoy)
Solution: Avoid adding to a NULL pointer. Use byte as unsigned.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 01 Sep 2020 20:00:03 +0200 |
parents | 08940efa6b4e |
children | ba2c3f38a596 |
rev | line source |
---|---|
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 " Tests for the terminal window. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 " This is split in two, because it can take a lot of time. |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
3 " See test_terminal.vim and test_terminal3.vim for further tests. |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 source check.vim |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 CheckFeature terminal |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 source shared.vim |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 source screendump.vim |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 source mouse.vim |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 source term_util.vim |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 let $PROMPT_COMMAND='' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 func Test_terminal_termwinsize_option_fixed() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 CheckRunVimInTerminal |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 set termwinsize=6x40 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 let text = [] |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 for n in range(10) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 call add(text, repeat(n, 50)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 endfor |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 call writefile(text, 'Xwinsize') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 let buf = RunVimInTerminal('Xwinsize', {}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 let win = bufwinid(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 call assert_equal([6, 40], term_getsize(buf)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 call assert_equal(6, winheight(win)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 call assert_equal(40, winwidth(win)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 " resizing the window doesn't resize the terminal. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 resize 10 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 vertical resize 60 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 call assert_equal([6, 40], term_getsize(buf)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 call assert_equal(10, winheight(win)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 call assert_equal(60, winwidth(win)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 call StopVimInTerminal(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 call delete('Xwinsize') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 call assert_fails('set termwinsize=40', 'E474') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 call assert_fails('set termwinsize=10+40', 'E474') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 call assert_fails('set termwinsize=abc', 'E474') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 set termwinsize= |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 func Test_terminal_termwinsize_option_zero() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 set termwinsize=0x0 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 let buf = Run_shell_in_terminal({}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 let win = bufwinid(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 call StopShellInTerminal(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 call TermWait(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 exe buf . 'bwipe' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 set termwinsize=7x0 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 let buf = Run_shell_in_terminal({}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 let win = bufwinid(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 call assert_equal([7, winwidth(win)], term_getsize(buf)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 call StopShellInTerminal(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 call TermWait(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 exe buf . 'bwipe' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 set termwinsize=0x33 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 let buf = Run_shell_in_terminal({}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 let win = bufwinid(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 call assert_equal([winheight(win), 33], term_getsize(buf)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 call StopShellInTerminal(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 call TermWait(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 exe buf . 'bwipe' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 set termwinsize= |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 func Test_terminal_termwinsize_minimum() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 set termwinsize=10*50 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
76 vsplit |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
77 let buf = Run_shell_in_terminal({}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
78 let win = bufwinid(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 call assert_inrange(10, 1000, winheight(win)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
80 call assert_inrange(50, 1000, winwidth(win)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
82 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
83 resize 15 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
84 vertical resize 60 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
85 redraw |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 call assert_equal([15, 60], term_getsize(buf)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 call assert_equal(15, winheight(win)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
88 call assert_equal(60, winwidth(win)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
89 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 resize 7 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
91 vertical resize 30 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 redraw |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 call assert_equal([10, 50], term_getsize(buf)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 call assert_equal(7, winheight(win)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 call assert_equal(30, winwidth(win)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
96 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 call StopShellInTerminal(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 call TermWait(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 exe buf . 'bwipe' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 set termwinsize=0*0 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 let buf = Run_shell_in_terminal({}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 let win = bufwinid(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
104 call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 call StopShellInTerminal(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 call TermWait(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
107 exe buf . 'bwipe' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
109 set termwinsize= |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 func Test_terminal_termwinkey() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 " make three tabpages, terminal in the middle |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 0tabnew |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 tabnext |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 tabnew |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
117 tabprev |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
118 call assert_equal(1, winnr('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 call assert_equal(2, tabpagenr()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
120 let thiswin = win_getid() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
121 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
122 let buf = Run_shell_in_terminal({}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
123 let termwin = bufwinid(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
124 set termwinkey=<C-L> |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
125 call feedkeys("\<C-L>w", 'tx') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 call assert_equal(thiswin, win_getid()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
127 call feedkeys("\<C-W>w", 'tx') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 call assert_equal(termwin, win_getid()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
129 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
130 if has('langmap') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
131 set langmap=xjyk |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
132 call feedkeys("\<C-L>x", 'tx') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
133 call assert_equal(thiswin, win_getid()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
134 call feedkeys("\<C-W>y", 'tx') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
135 call assert_equal(termwin, win_getid()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
136 set langmap= |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
137 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 call feedkeys("\<C-L>gt", "xt") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 call assert_equal(3, tabpagenr()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 tabprev |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 call assert_equal(2, tabpagenr()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
143 call assert_equal(termwin, win_getid()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
145 call feedkeys("\<C-L>gT", "xt") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
146 call assert_equal(1, tabpagenr()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
147 tabnext |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
148 call assert_equal(2, tabpagenr()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
149 call assert_equal(termwin, win_getid()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
150 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
151 let job = term_getjob(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
152 call feedkeys("\<C-L>\<C-C>", 'tx') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 call WaitForAssert({-> assert_equal("dead", job_status(job))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
154 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
155 set termwinkey& |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
156 tabnext |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
157 tabclose |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
158 tabprev |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
159 tabclose |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
160 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
161 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 func Test_terminal_out_err() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 CheckUnix |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
165 call writefile([ |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
166 \ '#!/bin/sh', |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
167 \ 'echo "this is standard error" >&2', |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
168 \ 'echo "this is standard out" >&1', |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
169 \ ], 'Xechoerrout.sh') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
170 call setfperm('Xechoerrout.sh', 'rwxrwx---') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 let outfile = 'Xtermstdout' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
173 let buf = term_start(['./Xechoerrout.sh'], {'out_io': 'file', 'out_name': outfile}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
174 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 call WaitFor({-> !empty(readfile(outfile)) && !empty(term_getline(buf, 1))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
176 call assert_equal(['this is standard out'], readfile(outfile)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
177 call assert_equal('this is standard error', term_getline(buf, 1)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
178 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
179 call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 exe buf . 'bwipe' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
181 call delete('Xechoerrout.sh') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
182 call delete(outfile) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
183 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
184 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
185 func Test_termwinscroll() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
186 CheckUnix |
21257
34a0f73226d9
patch 8.2.1179: Test_termwinscroll() sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
187 " TODO: Somehow this test sometimes hangs in the GUI |
34a0f73226d9
patch 8.2.1179: Test_termwinscroll() sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
188 CheckNotGui |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
189 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
190 " Let the terminal output more than 'termwinscroll' lines, some at the start |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
191 " will be dropped. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
192 exe 'set termwinscroll=' . &lines |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
193 let buf = term_start('/bin/sh') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
194 for i in range(1, &lines) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
195 call feedkeys("echo " . i . "\<CR>", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
196 call WaitForAssert({-> assert_match(string(i), term_getline(buf, term_getcursor(buf)[0] - 1))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
197 endfor |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
198 " Go to Terminal-Normal mode to update the buffer. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
199 call feedkeys("\<C-W>N", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
200 call assert_inrange(&lines, &lines * 110 / 100 + winheight(0), line('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 " Every "echo nr" must only appear once |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
203 let lines = getline(1, line('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
204 for i in range(&lines - len(lines) / 2 + 2, &lines) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
205 let filtered = filter(copy(lines), {idx, val -> val =~ 'echo ' . i . '\>'}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
206 call assert_equal(1, len(filtered), 'for "echo ' . i . '"') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
207 endfor |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
208 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 exe buf . 'bwipe!' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
210 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
212 " Resizing the terminal window caused an ml_get error. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 " TODO: This does not reproduce the original problem. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
214 func Test_terminal_resize() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
215 set statusline=x |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
216 terminal |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
217 call assert_equal(2, winnr('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
218 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
219 " Fill the terminal with text. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
220 if has('win32') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 call feedkeys("dir\<CR>", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
222 else |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
223 call feedkeys("ls\<CR>", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
224 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
225 " Go to Terminal-Normal mode for a moment. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
226 call feedkeys("\<C-W>N", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
227 " Open a new window |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
228 call feedkeys("i\<C-W>n", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
229 call assert_equal(3, winnr('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
230 redraw |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
231 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 close |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
233 call assert_equal(2, winnr('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
234 call feedkeys("exit\<CR>", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
235 set statusline& |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
236 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
237 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
238 " must be nearly the last, we can't go back from GUI to terminal |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
239 func Test_zz1_terminal_in_gui() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
240 CheckCanRunGui |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
241 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
242 " Ignore the "failed to create input context" error. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
243 call test_ignore_error('E285:') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
244 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
245 gui -f |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
246 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
247 call assert_equal(1, winnr('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
248 let buf = Run_shell_in_terminal({'term_finish': 'close'}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
249 call StopShellInTerminal(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
250 call TermWait(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
251 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
252 " closing window wipes out the terminal buffer a with finished job |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
253 call WaitForAssert({-> assert_equal(1, winnr('$'))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
254 call assert_equal("", bufname(buf)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
255 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
256 unlet g:job |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
257 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
258 |
21273
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
259 " TODO: reenable when this no longer hangs on Travis |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
260 "func Test_zz2_terminal_guioptions_bang() |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
261 " CheckGui |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
262 " set guioptions+=! |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
263 " |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
264 " let filename = 'Xtestscript' |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
265 " if has('win32') |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
266 " let filename .= '.bat' |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
267 " let prefix = '' |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
268 " let contents = ['@echo off', 'exit %1'] |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
269 " else |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
270 " let filename .= '.sh' |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
271 " let prefix = './' |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
272 " let contents = ['#!/bin/sh', 'exit $1'] |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
273 " endif |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
274 " call writefile(contents, filename) |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
275 " call setfperm(filename, 'rwxrwx---') |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
276 " |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
277 " " Check if v:shell_error is equal to the exit status. |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
278 " let exitval = 0 |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
279 " execute printf(':!%s%s %d', prefix, filename, exitval) |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
280 " call assert_equal(exitval, v:shell_error) |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
281 " |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
282 " let exitval = 9 |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
283 " execute printf(':!%s%s %d', prefix, filename, exitval) |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
284 " call assert_equal(exitval, v:shell_error) |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
285 " |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
286 " set guioptions& |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
287 " call delete(filename) |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
288 "endfunc |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
289 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
290 func Test_terminal_hidden() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
291 CheckUnix |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
292 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
293 term ++hidden cat |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
294 let bnr = bufnr('$') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
295 call assert_equal('terminal', getbufvar(bnr, '&buftype')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
296 exe 'sbuf ' . bnr |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
297 call assert_equal('terminal', &buftype) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
298 call term_sendkeys(bnr, "asdf\<CR>") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
299 call WaitForAssert({-> assert_match('asdf', term_getline(bnr, 2))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
300 call term_sendkeys(bnr, "\<C-D>") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
301 call WaitForAssert({-> assert_equal('finished', bnr->term_getstatus())}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
302 bwipe! |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
303 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
304 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
305 func Test_terminal_switch_mode() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
306 term |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
307 let bnr = bufnr('$') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
308 call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))}) |
21273
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
309 " In the GUI the first switch sometimes doesn't work. Switch twice to avoid |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
310 " flakyness. |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
311 call feedkeys("\<C-W>N", 'xt') |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
312 call feedkeys("A", 'xt') |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
313 call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))}) |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
314 call feedkeys("\<C-W>N", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
315 call WaitForAssert({-> assert_equal('running,normal', term_getstatus(bnr))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
316 call feedkeys("A", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
317 call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
318 call feedkeys("\<C-\>\<C-N>", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
319 call WaitForAssert({-> assert_equal('running,normal', term_getstatus(bnr))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
320 call feedkeys("I", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
321 call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
322 call feedkeys("\<C-W>Nv", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
323 call WaitForAssert({-> assert_equal('running,normal', term_getstatus(bnr))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
324 call feedkeys("I", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
325 call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
326 call feedkeys("\<C-W>Nv", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
327 call WaitForAssert({-> assert_equal('running,normal', term_getstatus(bnr))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
328 call feedkeys("A", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
329 call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
330 bwipe! |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
331 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
332 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
333 func Test_terminal_normal_mode() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
334 CheckRunVimInTerminal |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
335 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
336 " Run Vim in a terminal and open a terminal window to run Vim in. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
337 let lines =<< trim END |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
338 call setline(1, range(11111, 11122)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
339 3 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
340 END |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
341 call writefile(lines, 'XtermNormal') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
342 let buf = RunVimInTerminal('-S XtermNormal', {'rows': 8}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
343 call TermWait(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
344 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
345 call term_sendkeys(buf, "\<C-W>N") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
346 call term_sendkeys(buf, ":set number cursorline culopt=both\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
347 call VerifyScreenDump(buf, 'Test_terminal_normal_1', {}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
348 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
349 call term_sendkeys(buf, ":set culopt=number\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
350 call VerifyScreenDump(buf, 'Test_terminal_normal_2', {}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
351 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
352 call term_sendkeys(buf, ":set culopt=line\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
353 call VerifyScreenDump(buf, 'Test_terminal_normal_3', {}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
354 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
355 call assert_fails('call term_sendkeys(buf, [])', 'E730:') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
356 call term_sendkeys(buf, "a:q!\<CR>:q\<CR>:q\<CR>") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
357 call StopVimInTerminal(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
358 call delete('XtermNormal') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
359 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
360 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
361 func Test_terminal_hidden_and_close() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
362 CheckUnix |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
363 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
364 call assert_equal(1, winnr('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
365 term ++hidden ++close ls |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
366 let bnr = bufnr('$') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
367 call assert_equal('terminal', getbufvar(bnr, '&buftype')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
368 call WaitForAssert({-> assert_false(bufexists(bnr))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
369 call assert_equal(1, winnr('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
370 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
371 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
372 func Test_terminal_does_not_truncate_last_newlines() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
373 if has('conpty') |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21295
diff
changeset
|
374 throw 'Skipped: fail on ConPTY' |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
375 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
376 let contents = [ |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
377 \ [ 'One', '', 'X' ], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
378 \ [ 'Two', '', '' ], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
379 \ [ 'Three' ] + repeat([''], 30) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
380 \ ] |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
381 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
382 for c in contents |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
383 call writefile(c, 'Xfile') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
384 if has('win32') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
385 term cmd /c type Xfile |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
386 else |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
387 term cat Xfile |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
388 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
389 let bnr = bufnr('$') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
390 call assert_equal('terminal', getbufvar(bnr, '&buftype')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
391 call WaitForAssert({-> assert_equal('finished', term_getstatus(bnr))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
392 sleep 100m |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
393 call assert_equal(c, getline(1, line('$'))) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
394 quit |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
395 endfor |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
396 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
397 call delete('Xfile') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
398 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
399 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
400 func Test_terminal_no_job() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
401 if has('win32') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
402 let cmd = 'cmd /c ""' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
403 else |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
404 CheckExecutable false |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
405 let cmd = 'false' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
406 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
407 let term = term_start(cmd, {'term_finish': 'close'}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
408 call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) }) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
409 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
410 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
411 func Test_term_getcursor() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
412 CheckUnix |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
413 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
414 let buf = Run_shell_in_terminal({}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
415 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
416 " Wait for the shell to display a prompt. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
417 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
418 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
419 " Hide the cursor. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
420 call term_sendkeys(buf, "echo -e '\\033[?25l'\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
421 call WaitForAssert({-> assert_equal(0, term_getcursor(buf)[2].visible)}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
422 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
423 " Show the cursor. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
424 call term_sendkeys(buf, "echo -e '\\033[?25h'\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
425 call WaitForAssert({-> assert_equal(1, buf->term_getcursor()[2].visible)}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
426 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
427 " Change color of cursor. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
428 call WaitForAssert({-> assert_equal('', term_getcursor(buf)[2].color)}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
429 call term_sendkeys(buf, "echo -e '\\033]12;blue\\007'\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
430 call WaitForAssert({-> assert_equal('blue', term_getcursor(buf)[2].color)}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
431 call term_sendkeys(buf, "echo -e '\\033]12;green\\007'\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
432 call WaitForAssert({-> assert_equal('green', term_getcursor(buf)[2].color)}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
433 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
434 " Make cursor a blinking block. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
435 call term_sendkeys(buf, "echo -e '\\033[1 q'\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
436 call WaitForAssert({-> assert_equal([1, 1], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
437 \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
438 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
439 " Make cursor a steady block. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
440 call term_sendkeys(buf, "echo -e '\\033[2 q'\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
441 call WaitForAssert({-> assert_equal([0, 1], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
442 \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
443 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
444 " Make cursor a blinking underline. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
445 call term_sendkeys(buf, "echo -e '\\033[3 q'\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
446 call WaitForAssert({-> assert_equal([1, 2], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
447 \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
448 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
449 " Make cursor a steady underline. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
450 call term_sendkeys(buf, "echo -e '\\033[4 q'\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
451 call WaitForAssert({-> assert_equal([0, 2], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
452 \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
453 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
454 " Make cursor a blinking vertical bar. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
455 call term_sendkeys(buf, "echo -e '\\033[5 q'\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
456 call WaitForAssert({-> assert_equal([1, 3], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
457 \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
458 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
459 " Make cursor a steady vertical bar. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
460 call term_sendkeys(buf, "echo -e '\\033[6 q'\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
461 call WaitForAssert({-> assert_equal([0, 3], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
462 \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
463 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
464 call StopShellInTerminal(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
465 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
466 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
467 " Test for term_gettitle() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
468 func Test_term_gettitle() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
469 " term_gettitle() returns an empty string for a non-terminal buffer |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
470 " and for a non-existing buffer. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
471 call assert_equal('', bufnr('%')->term_gettitle()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
472 call assert_equal('', term_gettitle(bufnr('$') + 1)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
473 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
474 if !has('title') || empty(&t_ts) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
475 throw "Skipped: can't get/set title" |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
476 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
477 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
478 let term = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', '-c', 'set title']) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
479 if has('autoservername') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
480 call WaitForAssert({-> assert_match('^\[No Name\] - VIM\d\+$', term_gettitle(term)) }) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
481 call term_sendkeys(term, ":e Xfoo\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
482 call WaitForAssert({-> assert_match('^Xfoo (.*[/\\]testdir) - VIM\d\+$', term_gettitle(term)) }) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
483 else |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
484 call WaitForAssert({-> assert_equal('[No Name] - VIM', term_gettitle(term)) }) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
485 call term_sendkeys(term, ":e Xfoo\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
486 call WaitForAssert({-> assert_match('^Xfoo (.*[/\\]testdir) - VIM$', term_gettitle(term)) }) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
487 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
488 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
489 call term_sendkeys(term, ":set titlestring=foo\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
490 call WaitForAssert({-> assert_equal('foo', term_gettitle(term)) }) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
491 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
492 exe term . 'bwipe!' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
493 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
494 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
495 func Test_term_gettty() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
496 let buf = Run_shell_in_terminal({}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
497 let gettty = term_gettty(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
498 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
499 if has('unix') && executable('tty') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
500 " Find tty using the tty shell command. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
501 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
502 call term_sendkeys(buf, "tty\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
503 call WaitForAssert({-> assert_notequal('', term_getline(buf, 3))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
504 let tty = term_getline(buf, 2) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
505 call assert_equal(tty, gettty) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
506 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
507 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
508 let gettty0 = term_gettty(buf, 0) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
509 let gettty1 = term_gettty(buf, 1) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
510 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
511 call assert_equal(gettty, gettty0) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
512 call assert_equal(job_info(g:job).tty_out, gettty0) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
513 call assert_equal(job_info(g:job).tty_in, gettty1) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
514 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
515 if has('unix') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
516 " For unix, term_gettty(..., 0) and term_gettty(..., 1) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
517 " are identical according to :help term_gettty() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
518 call assert_equal(gettty0, gettty1) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
519 call assert_match('^/dev/', gettty) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
520 else |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
521 " ConPTY works on anonymous pipe. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
522 if !has('conpty') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
523 call assert_match('^\\\\.\\pipe\\', gettty0) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
524 call assert_match('^\\\\.\\pipe\\', gettty1) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
525 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
526 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
527 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
528 call assert_fails('call term_gettty(buf, 2)', 'E475:') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
529 call assert_fails('call term_gettty(buf, -1)', 'E475:') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
530 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
531 call assert_equal('', term_gettty(buf + 1)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
532 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
533 call StopShellInTerminal(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
534 call TermWait(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
535 exe buf . 'bwipe' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
536 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
537 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
538 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
539 " vim: shiftwidth=2 sts=2 expandtab |