Mercurial > vim
annotate src/testdir/test_terminal2.vim @ 26354:7e7d0e01a2d0 v8.2.3708
patch 8.2.3708: Vim9: test fails with different error
Commit: https://github.com/vim/vim/commit/69535d8a0a1ba09047fc1b5bed86a8965302a4fa
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Nov 30 21:39:39 2021 +0000
patch 8.2.3708: Vim9: test fails with different error
Problem: Vim9: test fails with different error.
Solution: Correct the error number.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 30 Nov 2021 22:45:02 +0100 |
parents | a5a772dace5b |
children | c6a57c46271e |
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 |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
22079
diff
changeset
|
39 call assert_fails('set termwinsize=40', 'E474:') |
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
22079
diff
changeset
|
40 call assert_fails('set termwinsize=10+40', 'E474:') |
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
22079
diff
changeset
|
41 call assert_fails('set termwinsize=abc', 'E474:') |
21126
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 |
22079
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
112 func Test_terminal_termwinsize_overruled() |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
113 let cmd = GetDummyCmd() |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
114 set termwinsize=5x43 |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
115 let buf = term_start(cmd, #{term_rows: 7, term_cols: 50}) |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
116 call TermWait(buf) |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
117 call assert_equal([7, 50], term_getsize(buf)) |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
118 exe "bwipe! " .. buf |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
119 |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
120 let buf = term_start(cmd, #{term_cols: 50}) |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
121 call TermWait(buf) |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
122 call assert_equal([5, 50], term_getsize(buf)) |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
123 exe "bwipe! " .. buf |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
124 |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
125 let buf = term_start(cmd, #{term_rows: 7}) |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
126 call TermWait(buf) |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
127 call assert_equal([7, 43], term_getsize(buf)) |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
128 exe "bwipe! " .. buf |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
129 |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
130 set termwinsize= |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
131 endfunc |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
132 |
22097
f369bbd71a53
patch 8.2.1598: starting a hidden terminal resizes the current window
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
133 " hidden terminal must not change current window size |
f369bbd71a53
patch 8.2.1598: starting a hidden terminal resizes the current window
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
134 func Test_terminal_hidden_winsize() |
f369bbd71a53
patch 8.2.1598: starting a hidden terminal resizes the current window
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
135 let cmd = GetDummyCmd() |
f369bbd71a53
patch 8.2.1598: starting a hidden terminal resizes the current window
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
136 let rows = winheight(0) |
f369bbd71a53
patch 8.2.1598: starting a hidden terminal resizes the current window
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
137 let buf = term_start(cmd, #{hidden: 1, term_rows: 10}) |
f369bbd71a53
patch 8.2.1598: starting a hidden terminal resizes the current window
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
138 call assert_equal(rows, winheight(0)) |
f369bbd71a53
patch 8.2.1598: starting a hidden terminal resizes the current window
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
139 call assert_equal([10, &columns], term_getsize(buf)) |
f369bbd71a53
patch 8.2.1598: starting a hidden terminal resizes the current window
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
140 exe "bwipe! " .. buf |
f369bbd71a53
patch 8.2.1598: starting a hidden terminal resizes the current window
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
141 endfunc |
f369bbd71a53
patch 8.2.1598: starting a hidden terminal resizes the current window
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
142 |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
143 func Test_terminal_termwinkey() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 " 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
|
145 0tabnew |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
146 tabnext |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
147 tabnew |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
148 tabprev |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
149 call assert_equal(1, winnr('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
150 call assert_equal(2, tabpagenr()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
151 let thiswin = win_getid() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
152 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 let buf = Run_shell_in_terminal({}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
154 let termwin = bufwinid(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
155 set termwinkey=<C-L> |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
156 call feedkeys("\<C-L>w", 'tx') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
157 call assert_equal(thiswin, win_getid()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
158 call feedkeys("\<C-W>w", 'tx') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
159 call assert_equal(termwin, win_getid()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
160 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
161 if has('langmap') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 set langmap=xjyk |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 call feedkeys("\<C-L>x", 'tx') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 call assert_equal(thiswin, win_getid()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
165 call feedkeys("\<C-W>y", 'tx') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
166 call assert_equal(termwin, win_getid()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
167 set langmap= |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
168 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
169 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
170 call feedkeys("\<C-L>gt", "xt") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 call assert_equal(3, tabpagenr()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 tabprev |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
173 call assert_equal(2, tabpagenr()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
174 call assert_equal(termwin, win_getid()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
176 call feedkeys("\<C-L>gT", "xt") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
177 call assert_equal(1, tabpagenr()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
178 tabnext |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
179 call assert_equal(2, tabpagenr()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 call assert_equal(termwin, win_getid()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
181 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
182 let job = term_getjob(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
183 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
|
184 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
|
185 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
186 set termwinkey& |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
187 tabnext |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
188 tabclose |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
189 tabprev |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
190 tabclose |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
191 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
192 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
193 func Test_terminal_out_err() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
194 CheckUnix |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
195 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
196 call writefile([ |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
197 \ '#!/bin/sh', |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
198 \ 'echo "this is standard error" >&2', |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
199 \ 'echo "this is standard out" >&1', |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
200 \ ], 'Xechoerrout.sh') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 call setfperm('Xechoerrout.sh', 'rwxrwx---') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
203 let outfile = 'Xtermstdout' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
204 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
|
205 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
206 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
|
207 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
|
208 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
|
209 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
210 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
|
211 exe buf . 'bwipe' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
212 call delete('Xechoerrout.sh') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 call delete(outfile) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
214 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
215 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
216 func Test_termwinscroll() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
217 CheckUnix |
21257
34a0f73226d9
patch 8.2.1179: Test_termwinscroll() sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
218 " 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
|
219 CheckNotGui |
25969
a5a772dace5b
patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
24214
diff
changeset
|
220 let g:test_is_flaky = 1 |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
222 " 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
|
223 " will be dropped. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
224 exe 'set termwinscroll=' . &lines |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
225 let buf = term_start('/bin/sh') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
226 for i in range(1, &lines) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
227 call feedkeys("echo " . i . "\<CR>", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
228 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
|
229 endfor |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
230 " 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
|
231 call feedkeys("\<C-W>N", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 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
|
233 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
234 " 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
|
235 let lines = getline(1, line('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
236 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
|
237 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
|
238 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
|
239 endfor |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
240 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
241 exe buf . 'bwipe!' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
242 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
243 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
244 " 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
|
245 " 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
|
246 func Test_terminal_resize() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
247 set statusline=x |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
248 terminal |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
249 call assert_equal(2, winnr('$')) |
24214
5b841f349e77
patch 8.2.2648: terminal resize test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
250 let buf = bufnr() |
5b841f349e77
patch 8.2.2648: terminal resize test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
251 |
5b841f349e77
patch 8.2.2648: terminal resize test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
252 " Wait for the shell to display a prompt |
5b841f349e77
patch 8.2.2648: terminal resize test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
253 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
254 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
255 " Fill the terminal with text. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
256 if has('win32') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
257 call feedkeys("dir\<CR>", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
258 else |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
259 call feedkeys("ls\<CR>", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
260 endif |
24214
5b841f349e77
patch 8.2.2648: terminal resize test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
261 " Wait for some output |
5b841f349e77
patch 8.2.2648: terminal resize test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
262 call WaitForAssert({-> assert_notequal('', term_getline(buf, 3))}) |
5b841f349e77
patch 8.2.2648: terminal resize test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
263 |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
264 " 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
|
265 call feedkeys("\<C-W>N", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
266 " Open a new window |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
267 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
|
268 call assert_equal(3, winnr('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
269 redraw |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
270 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
271 close |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
272 call assert_equal(2, winnr('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
273 call feedkeys("exit\<CR>", 'xt') |
24214
5b841f349e77
patch 8.2.2648: terminal resize test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
274 call TermWait(buf) |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
275 set statusline& |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
276 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
277 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
278 " 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
|
279 func Test_zz1_terminal_in_gui() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
280 CheckCanRunGui |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
281 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
282 " 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
|
283 call test_ignore_error('E285:') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
284 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
285 gui -f |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
286 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
287 call assert_equal(1, winnr('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
288 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
|
289 call StopShellInTerminal(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
290 call TermWait(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
291 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
292 " 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
|
293 call WaitForAssert({-> assert_equal(1, winnr('$'))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
294 call assert_equal("", bufname(buf)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
295 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
296 unlet g:job |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
297 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
298 |
23229
b545334ae654
patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents:
22405
diff
changeset
|
299 " TODO: re-enable when this no longer hangs on Travis |
21273
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
300 "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
|
301 " CheckGui |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
302 " 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
|
303 " |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
304 " 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
|
305 " 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
|
306 " 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
|
307 " 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
|
308 " 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
|
309 " else |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
310 " 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
|
311 " 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
|
312 " 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
|
313 " endif |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
314 " 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
|
315 " 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
|
316 " |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
317 " " 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
|
318 " 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
|
319 " 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
|
320 " 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
|
321 " |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
322 " 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
|
323 " 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
|
324 " 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
|
325 " |
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
326 " 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
|
327 " 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
|
328 "endfunc |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
329 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
330 func Test_terminal_hidden() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
331 CheckUnix |
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 term ++hidden cat |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
334 let bnr = bufnr('$') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
335 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
|
336 exe 'sbuf ' . bnr |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
337 call assert_equal('terminal', &buftype) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
338 call term_sendkeys(bnr, "asdf\<CR>") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
339 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
|
340 call term_sendkeys(bnr, "\<C-D>") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
341 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
|
342 bwipe! |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
343 endfunc |
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 func Test_terminal_switch_mode() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
346 term |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
347 let bnr = bufnr('$') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
348 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
|
349 " In the GUI the first switch sometimes doesn't work. Switch twice to avoid |
23229
b545334ae654
patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents:
22405
diff
changeset
|
350 " flakiness. |
21273
c02041a2b66a
patch 8.2.1187: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents:
21257
diff
changeset
|
351 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
|
352 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
|
353 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
|
354 call feedkeys("\<C-W>N", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
355 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
|
356 call feedkeys("A", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
357 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
|
358 call feedkeys("\<C-\>\<C-N>", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
359 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
|
360 call feedkeys("I", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
361 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
|
362 call feedkeys("\<C-W>Nv", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
363 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
|
364 call feedkeys("I", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
365 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
|
366 call feedkeys("\<C-W>Nv", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
367 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
|
368 call feedkeys("A", 'xt') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
369 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
|
370 bwipe! |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
371 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
372 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
373 func Test_terminal_normal_mode() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
374 CheckRunVimInTerminal |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
375 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
376 " 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
|
377 let lines =<< trim END |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
378 call setline(1, range(11111, 11122)) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
379 3 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
380 END |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
381 call writefile(lines, 'XtermNormal') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
382 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
|
383 call TermWait(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
384 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
385 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
|
386 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
|
387 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
|
388 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
389 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
|
390 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
|
391 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
392 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
|
393 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
|
394 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
395 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
|
396 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
|
397 call StopVimInTerminal(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
398 call delete('XtermNormal') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
399 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
400 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
401 func Test_terminal_hidden_and_close() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
402 CheckUnix |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
403 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
404 call assert_equal(1, winnr('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
405 term ++hidden ++close ls |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
406 let bnr = bufnr('$') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
407 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
|
408 call WaitForAssert({-> assert_false(bufexists(bnr))}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
409 call assert_equal(1, winnr('$')) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
410 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
411 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
412 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
|
413 if has('conpty') |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21295
diff
changeset
|
414 throw 'Skipped: fail on ConPTY' |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
415 endif |
25969
a5a772dace5b
patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
24214
diff
changeset
|
416 let g:test_is_flaky = 1 |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
417 let contents = [ |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
418 \ [ 'One', '', 'X' ], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
419 \ [ 'Two', '', '' ], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
420 \ [ 'Three' ] + repeat([''], 30) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
421 \ ] |
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 for c in contents |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
424 call writefile(c, 'Xfile') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
425 if has('win32') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
426 term cmd /c type Xfile |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
427 else |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
428 term cat Xfile |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
429 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
430 let bnr = bufnr('$') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
431 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
|
432 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
|
433 sleep 100m |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
434 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
|
435 quit |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
436 endfor |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
437 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
438 call delete('Xfile') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
439 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
440 |
22079
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
441 func GetDummyCmd() |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
442 if has('win32') |
22079
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
443 return 'cmd /c ""' |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
444 else |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
445 CheckExecutable false |
22079
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
446 return 'false' |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
447 endif |
22079
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
448 endfunc |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
449 |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
450 func Test_terminal_no_job() |
ba2c3f38a596
patch 8.2.1589: term_start() options for size are overruled by 'termwinsize'
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
451 let cmd = GetDummyCmd() |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
452 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
|
453 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
|
454 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
455 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
456 func Test_term_getcursor() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
457 CheckUnix |
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 let buf = Run_shell_in_terminal({}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
460 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
461 " 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
|
462 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
|
463 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
464 " Hide the cursor. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
465 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
|
466 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
|
467 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
468 " Show the cursor. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
469 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
|
470 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
|
471 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
472 " Change color of cursor. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
473 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
|
474 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
|
475 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
|
476 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
|
477 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
|
478 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
479 " Make cursor a blinking block. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
480 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
|
481 call WaitForAssert({-> assert_equal([1, 1], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
482 \ [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
|
483 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
484 " Make cursor a steady block. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
485 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
|
486 call WaitForAssert({-> assert_equal([0, 1], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
487 \ [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
|
488 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
489 " Make cursor a blinking underline. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
490 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
|
491 call WaitForAssert({-> assert_equal([1, 2], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
492 \ [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
|
493 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
494 " Make cursor a steady underline. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
495 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
|
496 call WaitForAssert({-> assert_equal([0, 2], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
497 \ [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
|
498 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
499 " Make cursor a blinking vertical bar. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
500 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
|
501 call WaitForAssert({-> assert_equal([1, 3], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
502 \ [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
|
503 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
504 " Make cursor a steady vertical bar. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
505 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
|
506 call WaitForAssert({-> assert_equal([0, 3], |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
507 \ [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
|
508 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
509 call StopShellInTerminal(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
510 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
511 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
512 " Test for term_gettitle() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
513 func Test_term_gettitle() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
514 " 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
|
515 " and for a non-existing buffer. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
516 call assert_equal('', bufnr('%')->term_gettitle()) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
517 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
|
518 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
519 if !has('title') || empty(&t_ts) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
520 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
|
521 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
522 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
523 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
|
524 if has('autoservername') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
525 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
|
526 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
|
527 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
|
528 else |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
529 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
|
530 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
|
531 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
|
532 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
533 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
534 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
|
535 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
|
536 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
537 exe term . 'bwipe!' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
538 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
539 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
540 func Test_term_gettty() |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
541 let buf = Run_shell_in_terminal({}) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
542 let gettty = term_gettty(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
543 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
544 if has('unix') && executable('tty') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
545 " 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
|
546 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
|
547 call term_sendkeys(buf, "tty\r") |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
548 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
|
549 let tty = term_getline(buf, 2) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
550 call assert_equal(tty, gettty) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
551 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
552 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
553 let gettty0 = term_gettty(buf, 0) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
554 let gettty1 = term_gettty(buf, 1) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
555 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
556 call assert_equal(gettty, gettty0) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
557 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
|
558 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
|
559 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
560 if has('unix') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
561 " 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
|
562 " 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
|
563 call assert_equal(gettty0, gettty1) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
564 call assert_match('^/dev/', gettty) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
565 else |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
566 " ConPTY works on anonymous pipe. |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
567 if !has('conpty') |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
568 call assert_match('^\\\\.\\pipe\\', gettty0) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
569 call assert_match('^\\\\.\\pipe\\', gettty1) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
570 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
571 endif |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
572 |
22405
0ef3ae4ec70e
patch 8.2.1751: using 2 where bool is expected may throw an error
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
573 call assert_fails('call term_gettty(buf, 2)', 'E475:') |
0ef3ae4ec70e
patch 8.2.1751: using 2 where bool is expected may throw an error
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
574 call assert_fails('call term_gettty(buf, -1)', 'E475:') |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
575 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
576 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
|
577 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
578 call StopShellInTerminal(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
579 call TermWait(buf) |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
580 exe buf . 'bwipe' |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
581 endfunc |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
582 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
583 |
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
584 " vim: shiftwidth=2 sts=2 expandtab |