Mercurial > vim
annotate src/testdir/test_terminal.vim @ 13678:39fcaaa973db v8.0.1711
patch 8.0.1711: term_setsize() is not implemented yet
commit https://github.com/vim/vim/commit/a42d363bac8a581afe769c370db70cf833767c41
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 14 17:05:38 2018 +0200
patch 8.0.1711: term_setsize() is not implemented yet
Problem: Term_setsize() is not implemented yet.
Solution: Implement it.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 14 Apr 2018 17:15:05 +0200 |
parents | 87ffb7f85b28 |
children | 1651a4c5c27a |
rev | line source |
---|---|
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for the terminal window. |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
12156
ee8ead988f2c
patch 8.0.0958: terminal test fails on Windows when winpty dll is missing
Christian Brabandt <cb@256bit.org>
parents:
12154
diff
changeset
|
3 if !has('terminal') |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 finish |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 endif |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 source shared.vim |
13438
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
8 source screendump.vim |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
12062
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
10 let s:python = PythonProg() |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
11 |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
12 " Open a terminal with a shell, assign the job to g:job and return the buffer |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
13 " number. |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
14 func Run_shell_in_terminal(options) |
12724
17c257dd2438
patch 8.0.1240: MS-Windows: term_start() does not support environment
Christian Brabandt <cb@256bit.org>
parents:
12650
diff
changeset
|
15 if has('win32') |
17c257dd2438
patch 8.0.1240: MS-Windows: term_start() does not support environment
Christian Brabandt <cb@256bit.org>
parents:
12650
diff
changeset
|
16 let buf = term_start([&shell,'/k'], a:options) |
17c257dd2438
patch 8.0.1240: MS-Windows: term_start() does not support environment
Christian Brabandt <cb@256bit.org>
parents:
12650
diff
changeset
|
17 else |
17c257dd2438
patch 8.0.1240: MS-Windows: term_start() does not support environment
Christian Brabandt <cb@256bit.org>
parents:
12650
diff
changeset
|
18 let buf = term_start(&shell, a:options) |
17c257dd2438
patch 8.0.1240: MS-Windows: term_start() does not support environment
Christian Brabandt <cb@256bit.org>
parents:
12650
diff
changeset
|
19 endif |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 let termlist = term_list() |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call assert_equal(1, len(termlist)) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call assert_equal(buf, termlist[0]) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 let g:job = term_getjob(buf) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 call assert_equal(v:t_job, type(g:job)) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 |
11973
aec3df2af27c
patch 8.0.0867: job and channel in a dict value not quoted
Christian Brabandt <cb@256bit.org>
parents:
11957
diff
changeset
|
28 let string = string({'job': term_getjob(buf)}) |
aec3df2af27c
patch 8.0.0867: job and channel in a dict value not quoted
Christian Brabandt <cb@256bit.org>
parents:
11957
diff
changeset
|
29 call assert_match("{'job': 'process \\d\\+ run'}", string) |
aec3df2af27c
patch 8.0.0867: job and channel in a dict value not quoted
Christian Brabandt <cb@256bit.org>
parents:
11957
diff
changeset
|
30 |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
31 return buf |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
32 endfunc |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
33 |
11912
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
34 func Test_terminal_basic() |
12505
5cf248ecb6e3
patch 8.0.1131: not easy to trigger an autocommand for new terminal window
Christian Brabandt <cb@256bit.org>
parents:
12479
diff
changeset
|
35 au BufWinEnter * if &buftype == 'terminal' | let b:done = 'yes' | endif |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
36 let buf = Run_shell_in_terminal({}) |
12505
5cf248ecb6e3
patch 8.0.1131: not easy to trigger an autocommand for new terminal window
Christian Brabandt <cb@256bit.org>
parents:
12479
diff
changeset
|
37 |
11933
d033653d3df8
patch 8.0.0846: cannot get the name of the pty of a job
Christian Brabandt <cb@256bit.org>
parents:
11923
diff
changeset
|
38 if has("unix") |
12389
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
39 call assert_match('^/dev/', job_info(g:job).tty_out) |
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
40 call assert_match('^/dev/', term_gettty('')) |
11933
d033653d3df8
patch 8.0.0846: cannot get the name of the pty of a job
Christian Brabandt <cb@256bit.org>
parents:
11923
diff
changeset
|
41 else |
12389
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
42 call assert_match('^\\\\.\\pipe\\', job_info(g:job).tty_out) |
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
43 call assert_match('^\\\\.\\pipe\\', term_gettty('')) |
11933
d033653d3df8
patch 8.0.0846: cannot get the name of the pty of a job
Christian Brabandt <cb@256bit.org>
parents:
11923
diff
changeset
|
44 endif |
12112
6afc7339c2ad
patch 8.0.0936: mode() returns wrong value for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12106
diff
changeset
|
45 call assert_equal('t', mode()) |
12505
5cf248ecb6e3
patch 8.0.1131: not easy to trigger an autocommand for new terminal window
Christian Brabandt <cb@256bit.org>
parents:
12479
diff
changeset
|
46 call assert_equal('yes', b:done) |
12112
6afc7339c2ad
patch 8.0.0936: mode() returns wrong value for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12106
diff
changeset
|
47 call assert_match('%aR[^\n]*running]', execute('ls')) |
13555
78ead137b2ad
patch 8.0.1651: cannot filter :ls output for terminal buffers
Christian Brabandt <cb@256bit.org>
parents:
13547
diff
changeset
|
48 call assert_match('%aR[^\n]*running]', execute('ls R')) |
78ead137b2ad
patch 8.0.1651: cannot filter :ls output for terminal buffers
Christian Brabandt <cb@256bit.org>
parents:
13547
diff
changeset
|
49 call assert_notmatch('%[^\n]*running]', execute('ls F')) |
78ead137b2ad
patch 8.0.1651: cannot filter :ls output for terminal buffers
Christian Brabandt <cb@256bit.org>
parents:
13547
diff
changeset
|
50 call assert_notmatch('%[^\n]*running]', execute('ls ?')) |
12112
6afc7339c2ad
patch 8.0.0936: mode() returns wrong value for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12106
diff
changeset
|
51 |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
52 call Stop_shell_in_terminal(buf) |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
53 call term_wait(buf) |
12112
6afc7339c2ad
patch 8.0.0936: mode() returns wrong value for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12106
diff
changeset
|
54 call assert_equal('n', mode()) |
6afc7339c2ad
patch 8.0.0936: mode() returns wrong value for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12106
diff
changeset
|
55 call assert_match('%aF[^\n]*finished]', execute('ls')) |
13555
78ead137b2ad
patch 8.0.1651: cannot filter :ls output for terminal buffers
Christian Brabandt <cb@256bit.org>
parents:
13547
diff
changeset
|
56 call assert_match('%aF[^\n]*finished]', execute('ls F')) |
78ead137b2ad
patch 8.0.1651: cannot filter :ls output for terminal buffers
Christian Brabandt <cb@256bit.org>
parents:
13547
diff
changeset
|
57 call assert_notmatch('%[^\n]*finished]', execute('ls R')) |
78ead137b2ad
patch 8.0.1651: cannot filter :ls output for terminal buffers
Christian Brabandt <cb@256bit.org>
parents:
13547
diff
changeset
|
58 call assert_notmatch('%[^\n]*finished]', execute('ls ?')) |
11912
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
59 |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
60 " closing window wipes out the terminal buffer a with finished job |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
61 close |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
62 call assert_equal("", bufname(buf)) |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
63 |
12505
5cf248ecb6e3
patch 8.0.1131: not easy to trigger an autocommand for new terminal window
Christian Brabandt <cb@256bit.org>
parents:
12479
diff
changeset
|
64 au! BufWinEnter |
11912
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
65 unlet g:job |
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
66 endfunc |
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
67 |
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
68 func Test_terminal_make_change() |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
69 let buf = Run_shell_in_terminal({}) |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
70 call Stop_shell_in_terminal(buf) |
11912
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
71 call term_wait(buf) |
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
72 |
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
73 setlocal modifiable |
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
74 exe "normal Axxx\<Esc>" |
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
75 call assert_fails(buf . 'bwipe', 'E517') |
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
76 undo |
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
77 |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 exe buf . 'bwipe' |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 unlet g:job |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 endfunc |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
82 func Test_terminal_wipe_buffer() |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
83 let buf = Run_shell_in_terminal({}) |
11957
bc0fee081e1e
patch 8.0.0858: can exit while a terminal is still running a job
Christian Brabandt <cb@256bit.org>
parents:
11955
diff
changeset
|
84 call assert_fails(buf . 'bwipe', 'E517') |
bc0fee081e1e
patch 8.0.0858: can exit while a terminal is still running a job
Christian Brabandt <cb@256bit.org>
parents:
11955
diff
changeset
|
85 exe buf . 'bwipe!' |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
86 call WaitFor('job_status(g:job) == "dead"') |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
87 call assert_equal('dead', job_status(g:job)) |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
88 call assert_equal("", bufname(buf)) |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
89 |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
90 unlet g:job |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
91 endfunc |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
92 |
12479
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
93 func Test_terminal_split_quit() |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
94 let buf = Run_shell_in_terminal({}) |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
95 call term_wait(buf) |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
96 split |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
97 quit! |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
98 call term_wait(buf) |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
99 sleep 50m |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
100 call assert_equal('run', job_status(g:job)) |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
101 |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
102 quit! |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
103 call WaitFor('job_status(g:job) == "dead"') |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
104 call assert_equal('dead', job_status(g:job)) |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
105 |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
106 exe buf . 'bwipe' |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
107 unlet g:job |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
108 endfunc |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
109 |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
110 func Test_terminal_hide_buffer() |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
111 let buf = Run_shell_in_terminal({}) |
12271
e4aa68825575
patch 8.0.1015: missing update to terminal test
Christian Brabandt <cb@256bit.org>
parents:
12263
diff
changeset
|
112 setlocal bufhidden=hide |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
113 quit |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
114 for nr in range(1, winnr('$')) |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
115 call assert_notequal(winbufnr(nr), buf) |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
116 endfor |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
117 call assert_true(bufloaded(buf)) |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
118 call assert_true(buflisted(buf)) |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
119 |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
120 exe 'split ' . buf . 'buf' |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
121 call Stop_shell_in_terminal(buf) |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
122 exe buf . 'bwipe' |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
123 |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
124 unlet g:job |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
125 endfunc |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
126 |
11939
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
127 func! s:Nasty_exit_cb(job, st) |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
128 exe g:buf . 'bwipe!' |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
129 let g:buf = 0 |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
130 endfunc |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
131 |
12405
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
132 func Get_cat_123_cmd() |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
133 if has('win32') |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
134 return 'cmd /c "cls && color 2 && echo 123"' |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
135 else |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
136 call writefile(["\<Esc>[32m123"], 'Xtext') |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
137 return "cat Xtext" |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
138 endif |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
139 endfunc |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
140 |
11939
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
141 func Test_terminal_nasty_cb() |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
142 let cmd = Get_cat_123_cmd() |
11939
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
143 let g:buf = term_start(cmd, {'exit_cb': function('s:Nasty_exit_cb')}) |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
144 let g:job = term_getjob(g:buf) |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
145 |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
146 call WaitFor('job_status(g:job) == "dead"') |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
147 call WaitFor('g:buf == 0') |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
148 unlet g:buf |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
149 unlet g:job |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
150 call delete('Xtext') |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
151 endfunc |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
152 |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
153 func Check_123(buf) |
11923
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
154 let l = term_scrape(a:buf, 0) |
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
155 call assert_true(len(l) == 0) |
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
156 let l = term_scrape(a:buf, 999) |
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
157 call assert_true(len(l) == 0) |
11906
7df4afab67c7
patch 8.0.0833: terminal test fails
Christian Brabandt <cb@256bit.org>
parents:
11872
diff
changeset
|
158 let l = term_scrape(a:buf, 1) |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 call assert_true(len(l) > 0) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 call assert_equal('1', l[0].chars) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 call assert_equal('2', l[1].chars) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 call assert_equal('3', l[2].chars) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 call assert_equal('#00e000', l[0].fg) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 if &background == 'light' |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 call assert_equal('#ffffff', l[0].bg) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 else |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 call assert_equal('#000000', l[0].bg) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 endif |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 |
11923
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
170 let l = term_getline(a:buf, -1) |
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
171 call assert_equal('', l) |
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
172 let l = term_getline(a:buf, 0) |
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
173 call assert_equal('', l) |
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
174 let l = term_getline(a:buf, 999) |
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
175 call assert_equal('', l) |
11906
7df4afab67c7
patch 8.0.0833: terminal test fails
Christian Brabandt <cb@256bit.org>
parents:
11872
diff
changeset
|
176 let l = term_getline(a:buf, 1) |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 call assert_equal('123', l) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 endfunc |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
180 func Test_terminal_scrape_123() |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
181 let cmd = Get_cat_123_cmd() |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 let buf = term_start(cmd) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 let termlist = term_list() |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 call assert_equal(1, len(termlist)) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
186 call assert_equal(buf, termlist[0]) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 |
11872
ff8122091ec6
patch 8.0.0816: crash when using invalid buffer number
Christian Brabandt <cb@256bit.org>
parents:
11846
diff
changeset
|
188 " Nothing happens with invalid buffer number |
ff8122091ec6
patch 8.0.0816: crash when using invalid buffer number
Christian Brabandt <cb@256bit.org>
parents:
11846
diff
changeset
|
189 call term_wait(1234) |
ff8122091ec6
patch 8.0.0816: crash when using invalid buffer number
Christian Brabandt <cb@256bit.org>
parents:
11846
diff
changeset
|
190 |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 call term_wait(buf) |
12349
bb67396239a4
patch 8.0.1054: terminal test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12345
diff
changeset
|
192 " On MS-Windows we first get a startup message of two lines, wait for the |
12355
368a7bf382c7
patch 8.0.1057: terminal scrape test waits too long
Christian Brabandt <cb@256bit.org>
parents:
12349
diff
changeset
|
193 " "cls" to happen, after that we have one line with three characters. |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
194 call WaitFor({-> len(term_scrape(buf, 1)) == 3}) |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 call Check_123(buf) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 " Must still work after the job ended. |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
198 let job = term_getjob(buf) |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
199 call WaitFor({-> job_status(job) == "dead"}) |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 call term_wait(buf) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 call Check_123(buf) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
202 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 exe buf . 'bwipe' |
11872
ff8122091ec6
patch 8.0.0816: crash when using invalid buffer number
Christian Brabandt <cb@256bit.org>
parents:
11846
diff
changeset
|
204 call delete('Xtext') |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 endfunc |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
206 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
207 func Test_terminal_scrape_multibyte() |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
208 if !has('multi_byte') |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
209 return |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
210 endif |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
211 call writefile(["léttまrs"], 'Xtext') |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
212 if has('win32') |
12126
bb43ab26381e
patch 8.0.0943: MS-Windows: Test_terminal_scrape_multibyte may fail
Christian Brabandt <cb@256bit.org>
parents:
12120
diff
changeset
|
213 " Run cmd with UTF-8 codepage to make the type command print the expected |
bb43ab26381e
patch 8.0.0943: MS-Windows: Test_terminal_scrape_multibyte may fail
Christian Brabandt <cb@256bit.org>
parents:
12120
diff
changeset
|
214 " multibyte characters. |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
215 let buf = term_start("cmd /K chcp 65001") |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
216 call term_sendkeys(buf, "type Xtext\<CR>") |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
217 call term_sendkeys(buf, "exit\<CR>") |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
218 let line = 4 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
219 else |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
220 let buf = term_start("cat Xtext") |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
221 let line = 1 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
222 endif |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
223 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
224 call WaitFor({-> len(term_scrape(buf, line)) >= 7 && term_scrape(buf, line)[0].chars == "l"}) |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
225 let l = term_scrape(buf, line) |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
226 call assert_true(len(l) >= 7) |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
227 call assert_equal('l', l[0].chars) |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
228 call assert_equal('é', l[1].chars) |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
229 call assert_equal(1, l[1].width) |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
230 call assert_equal('t', l[2].chars) |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
231 call assert_equal('t', l[3].chars) |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
232 call assert_equal('ま', l[4].chars) |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
233 call assert_equal(2, l[4].width) |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
234 call assert_equal('r', l[5].chars) |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
235 call assert_equal('s', l[6].chars) |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
236 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
237 let job = term_getjob(buf) |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
238 call WaitFor({-> job_status(job) == "dead"}) |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
239 call term_wait(buf) |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
240 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
241 exe buf . 'bwipe' |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
242 call delete('Xtext') |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
243 endfunc |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
244 |
12011
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
245 func Test_terminal_scroll() |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
246 call writefile(range(1, 200), 'Xtext') |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
247 if has('win32') |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
248 let cmd = 'cmd /c "type Xtext"' |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
249 else |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
250 let cmd = "cat Xtext" |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
251 endif |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
252 let buf = term_start(cmd) |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
253 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
254 let job = term_getjob(buf) |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
255 call WaitFor({-> job_status(job) == "dead"}) |
12011
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
256 call term_wait(buf) |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
257 if has('win32') |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
258 " TODO: this should not be needed |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
259 sleep 100m |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
260 endif |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
261 |
12025
c0ee48f48a2b
patch 8.0.0893: cannot get the scroll count of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12011
diff
changeset
|
262 let scrolled = term_getscrolled(buf) |
12011
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
263 call assert_equal('1', getline(1)) |
12025
c0ee48f48a2b
patch 8.0.0893: cannot get the scroll count of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12011
diff
changeset
|
264 call assert_equal('1', term_getline(buf, 1 - scrolled)) |
12011
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
265 call assert_equal('49', getline(49)) |
12025
c0ee48f48a2b
patch 8.0.0893: cannot get the scroll count of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12011
diff
changeset
|
266 call assert_equal('49', term_getline(buf, 49 - scrolled)) |
12011
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
267 call assert_equal('200', getline(200)) |
12025
c0ee48f48a2b
patch 8.0.0893: cannot get the scroll count of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12011
diff
changeset
|
268 call assert_equal('200', term_getline(buf, 200 - scrolled)) |
12011
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
269 |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
270 exe buf . 'bwipe' |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
271 call delete('Xtext') |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
272 endfunc |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
273 |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
274 func Test_terminal_size() |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
275 let cmd = Get_cat_123_cmd() |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
276 |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
277 exe 'terminal ++rows=5 ' . cmd |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
278 let size = term_getsize('') |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
279 bwipe! |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
280 call assert_equal(5, size[0]) |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
281 |
12056
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
282 call term_start(cmd, {'term_rows': 6}) |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
283 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
284 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
285 call assert_equal(6, size[0]) |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
286 |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
287 vsplit |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
288 exe 'terminal ++rows=5 ++cols=33 ' . cmd |
13678
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
289 call assert_equal([5, 33], term_getsize('')) |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
290 |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
291 call term_setsize('', 6, 0) |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
292 call assert_equal([6, 33], term_getsize('')) |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
293 |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
294 call term_setsize('', 0, 35) |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
295 call assert_equal([6, 35], term_getsize('')) |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
296 |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
297 call term_setsize('', 7, 30) |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
298 call assert_equal([7, 30], term_getsize('')) |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
299 |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
300 bwipe! |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
301 |
12056
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
302 call term_start(cmd, {'term_rows': 6, 'term_cols': 36}) |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
303 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
304 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
305 call assert_equal([6, 36], size) |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
306 |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
307 exe 'vertical terminal ++cols=20 ' . cmd |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
308 let size = term_getsize('') |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
309 bwipe! |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
310 call assert_equal(20, size[1]) |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
311 |
12056
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
312 call term_start(cmd, {'vertical': 1, 'term_cols': 26}) |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
313 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
314 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
315 call assert_equal(26, size[1]) |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
316 |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
317 split |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
318 exe 'vertical terminal ++rows=6 ++cols=20 ' . cmd |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
319 let size = term_getsize('') |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
320 bwipe! |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
321 call assert_equal([6, 20], size) |
12056
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
322 |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
323 call term_start(cmd, {'vertical': 1, 'term_rows': 7, 'term_cols': 27}) |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
324 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
325 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
326 call assert_equal([7, 27], size) |
12343
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
327 |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
328 call delete('Xtext') |
12060
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
329 endfunc |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
330 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
331 func Test_terminal_curwin() |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
332 let cmd = Get_cat_123_cmd() |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
333 call assert_equal(1, winnr('$')) |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
334 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
335 split dummy |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
336 exe 'terminal ++curwin ' . cmd |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
337 call assert_equal(2, winnr('$')) |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
338 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
339 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
340 split dummy |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
341 call term_start(cmd, {'curwin': 1}) |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
342 call assert_equal(2, winnr('$')) |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
343 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
344 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
345 split dummy |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
346 call setline(1, 'change') |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
347 call assert_fails('terminal ++curwin ' . cmd, 'E37:') |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
348 call assert_equal(2, winnr('$')) |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
349 exe 'terminal! ++curwin ' . cmd |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
350 call assert_equal(2, winnr('$')) |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
351 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
352 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
353 split dummy |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
354 call setline(1, 'change') |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
355 call assert_fails("call term_start(cmd, {'curwin': 1})", 'E37:') |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
356 call assert_equal(2, winnr('$')) |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
357 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
358 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
359 split dummy |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
360 bwipe! |
12343
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
361 call delete('Xtext') |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
362 endfunc |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
363 |
12903
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
364 func s:get_sleep_cmd() |
12062
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
365 if s:python != '' |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
366 let cmd = s:python . " test_short_sleep.py" |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
367 let waittime = 500 |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
368 else |
12062
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
369 echo 'This will take five seconds...' |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
370 let waittime = 2000 |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
371 if has('win32') |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
372 let cmd = $windir . '\system32\timeout.exe 1' |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
373 else |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
374 let cmd = 'sleep 1' |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
375 endif |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
376 endif |
12903
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
377 return [cmd, waittime] |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
378 endfunc |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
379 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
380 func Test_terminal_finish_open_close() |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
381 call assert_equal(1, winnr('$')) |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
382 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
383 let [cmd, waittime] = s:get_sleep_cmd() |
12062
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
384 |
13476
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
385 " shell terminal closes automatically |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
386 terminal |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
387 let buf = bufnr('%') |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
388 call assert_equal(2, winnr('$')) |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
389 " Wait for the shell to display a prompt |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
390 call WaitFor({-> term_getline(buf, 1) != ""}) |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
391 call Stop_shell_in_terminal(buf) |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
392 call WaitFor("winnr('$') == 1", waittime) |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
393 |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
394 " shell terminal that does not close automatically |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
395 terminal ++noclose |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
396 let buf = bufnr('%') |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
397 call assert_equal(2, winnr('$')) |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
398 " Wait for the shell to display a prompt |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
399 call WaitFor({-> term_getline(buf, 1) != ""}) |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
400 call Stop_shell_in_terminal(buf) |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
401 call assert_equal(2, winnr('$')) |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
402 quit |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
403 call assert_equal(1, winnr('$')) |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
404 |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
405 exe 'terminal ++close ' . cmd |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
406 call assert_equal(2, winnr('$')) |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
407 wincmd p |
12062
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
408 call WaitFor("winnr('$') == 1", waittime) |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
409 |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
410 call term_start(cmd, {'term_finish': 'close'}) |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
411 call assert_equal(2, winnr('$')) |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
412 wincmd p |
12062
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
413 call WaitFor("winnr('$') == 1", waittime) |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
414 call assert_equal(1, winnr('$')) |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
415 |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
416 exe 'terminal ++open ' . cmd |
12271
e4aa68825575
patch 8.0.1015: missing update to terminal test
Christian Brabandt <cb@256bit.org>
parents:
12263
diff
changeset
|
417 close! |
12062
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
418 call WaitFor("winnr('$') == 2", waittime) |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
419 call assert_equal(2, winnr('$')) |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
420 bwipe |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
421 |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
422 call term_start(cmd, {'term_finish': 'open'}) |
12271
e4aa68825575
patch 8.0.1015: missing update to terminal test
Christian Brabandt <cb@256bit.org>
parents:
12263
diff
changeset
|
423 close! |
12062
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
424 call WaitFor("winnr('$') == 2", waittime) |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
425 call assert_equal(2, winnr('$')) |
12064
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
426 bwipe |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
427 |
12064
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
428 exe 'terminal ++hidden ++open ' . cmd |
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
429 call assert_equal(1, winnr('$')) |
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
430 call WaitFor("winnr('$') == 2", waittime) |
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
431 call assert_equal(2, winnr('$')) |
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
432 bwipe |
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
433 |
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
434 call term_start(cmd, {'term_finish': 'open', 'hidden': 1}) |
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
435 call assert_equal(1, winnr('$')) |
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
436 call WaitFor("winnr('$') == 2", waittime) |
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
437 call assert_equal(2, winnr('$')) |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
438 bwipe |
12072
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
439 |
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
440 call assert_fails("call term_start(cmd, {'term_opencmd': 'open'})", 'E475:') |
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
441 call assert_fails("call term_start(cmd, {'term_opencmd': 'split %x'})", 'E475:') |
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
442 call assert_fails("call term_start(cmd, {'term_opencmd': 'split %d and %s'})", 'E475:') |
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
443 call assert_fails("call term_start(cmd, {'term_opencmd': 'split % and %d'})", 'E475:') |
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
444 |
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
445 call term_start(cmd, {'term_finish': 'open', 'term_opencmd': '4split | buffer %d'}) |
12271
e4aa68825575
patch 8.0.1015: missing update to terminal test
Christian Brabandt <cb@256bit.org>
parents:
12263
diff
changeset
|
446 close! |
12072
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
447 call WaitFor("winnr('$') == 2", waittime) |
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
448 call assert_equal(2, winnr('$')) |
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
449 call assert_equal(4, winheight(0)) |
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
450 bwipe |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
451 endfunc |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
452 |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
453 func Test_terminal_cwd() |
12415
cd66083e371e
patch 8.0.1087: Test_terminal_cwd is flaky
Christian Brabandt <cb@256bit.org>
parents:
12407
diff
changeset
|
454 if !executable('pwd') |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
455 return |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
456 endif |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
457 call mkdir('Xdir') |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
458 let buf = term_start('pwd', {'cwd': 'Xdir'}) |
12415
cd66083e371e
patch 8.0.1087: Test_terminal_cwd is flaky
Christian Brabandt <cb@256bit.org>
parents:
12407
diff
changeset
|
459 call WaitFor('"Xdir" == fnamemodify(getline(1), ":t")') |
cd66083e371e
patch 8.0.1087: Test_terminal_cwd is flaky
Christian Brabandt <cb@256bit.org>
parents:
12407
diff
changeset
|
460 call assert_equal('Xdir', fnamemodify(getline(1), ":t")) |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
461 |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
462 exe buf . 'bwipe' |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
463 call delete('Xdir', 'rf') |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
464 endfunc |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
465 |
12907
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12903
diff
changeset
|
466 func Test_terminal_servername() |
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12903
diff
changeset
|
467 if !has('clientserver') |
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12903
diff
changeset
|
468 return |
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12903
diff
changeset
|
469 endif |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
470 let buf = Run_shell_in_terminal({}) |
12907
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12903
diff
changeset
|
471 " Wait for the shell to display a prompt |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
472 call WaitFor({-> term_getline(buf, 1) != ""}) |
12907
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12903
diff
changeset
|
473 if has('win32') |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
474 call term_sendkeys(buf, "echo %VIM_SERVERNAME%\r") |
12907
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12903
diff
changeset
|
475 else |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
476 call term_sendkeys(buf, "echo $VIM_SERVERNAME\r") |
12907
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12903
diff
changeset
|
477 endif |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
478 call term_wait(buf) |
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
479 call Stop_shell_in_terminal(buf) |
12907
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12903
diff
changeset
|
480 call WaitFor('getline(2) == v:servername') |
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12903
diff
changeset
|
481 call assert_equal(v:servername, getline(2)) |
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12903
diff
changeset
|
482 |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
483 exe buf . 'bwipe' |
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
484 unlet buf |
12907
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12903
diff
changeset
|
485 endfunc |
32531a3eab1f
patch 8.0.1330: MS-Windows: job in terminal can't get back to Vim
Christian Brabandt <cb@256bit.org>
parents:
12903
diff
changeset
|
486 |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
487 func Test_terminal_env() |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
488 let buf = Run_shell_in_terminal({'env': {'TESTENV': 'correct'}}) |
12118
bf53df1f17ba
patch 8.0.0939: Test_terminal_env is flaky
Christian Brabandt <cb@256bit.org>
parents:
12112
diff
changeset
|
489 " Wait for the shell to display a prompt |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
490 call WaitFor({-> term_getline(buf, 1) != ""}) |
12724
17c257dd2438
patch 8.0.1240: MS-Windows: term_start() does not support environment
Christian Brabandt <cb@256bit.org>
parents:
12650
diff
changeset
|
491 if has('win32') |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
492 call term_sendkeys(buf, "echo %TESTENV%\r") |
12724
17c257dd2438
patch 8.0.1240: MS-Windows: term_start() does not support environment
Christian Brabandt <cb@256bit.org>
parents:
12650
diff
changeset
|
493 else |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
494 call term_sendkeys(buf, "echo $TESTENV\r") |
12724
17c257dd2438
patch 8.0.1240: MS-Windows: term_start() does not support environment
Christian Brabandt <cb@256bit.org>
parents:
12650
diff
changeset
|
495 endif |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
496 call term_wait(buf) |
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
497 call Stop_shell_in_terminal(buf) |
12118
bf53df1f17ba
patch 8.0.0939: Test_terminal_env is flaky
Christian Brabandt <cb@256bit.org>
parents:
12112
diff
changeset
|
498 call WaitFor('getline(2) == "correct"') |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
499 call assert_equal('correct', getline(2)) |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
500 |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
501 exe buf . 'bwipe' |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
502 endfunc |
12086
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
503 |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
504 " must be last, we can't go back from GUI to terminal |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
505 func Test_zz_terminal_in_gui() |
12106
d2c20ec4b95a
patch 8.0.0933: terminal test tries to start GUI when it's not possible
Christian Brabandt <cb@256bit.org>
parents:
12096
diff
changeset
|
506 if !CanRunGui() |
12086
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
507 return |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
508 endif |
12263
eddd5ea01116
patch 8.0.1011: terminal test fails with Athena and Motif
Christian Brabandt <cb@256bit.org>
parents:
12240
diff
changeset
|
509 |
eddd5ea01116
patch 8.0.1011: terminal test fails with Athena and Motif
Christian Brabandt <cb@256bit.org>
parents:
12240
diff
changeset
|
510 " Ignore the "failed to create input context" error. |
eddd5ea01116
patch 8.0.1011: terminal test fails with Athena and Motif
Christian Brabandt <cb@256bit.org>
parents:
12240
diff
changeset
|
511 call test_ignore_error('E285:') |
eddd5ea01116
patch 8.0.1011: terminal test fails with Athena and Motif
Christian Brabandt <cb@256bit.org>
parents:
12240
diff
changeset
|
512 |
12086
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
513 gui -f |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
514 |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
515 call assert_equal(1, winnr('$')) |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
516 let buf = Run_shell_in_terminal({'term_finish': 'close'}) |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
517 call Stop_shell_in_terminal(buf) |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
518 call term_wait(buf) |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
519 |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
520 " closing window wipes out the terminal buffer a with finished job |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
521 call WaitFor("winnr('$') == 1") |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
522 call assert_equal(1, winnr('$')) |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
523 call assert_equal("", bufname(buf)) |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
524 |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
525 unlet g:job |
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
526 endfunc |
12096
0a61213afdd2
patch 8.0.0928: MS-Windows: passing arglist to job has escaping problems
Christian Brabandt <cb@256bit.org>
parents:
12086
diff
changeset
|
527 |
0a61213afdd2
patch 8.0.0928: MS-Windows: passing arglist to job has escaping problems
Christian Brabandt <cb@256bit.org>
parents:
12086
diff
changeset
|
528 func Test_terminal_list_args() |
0a61213afdd2
patch 8.0.0928: MS-Windows: passing arglist to job has escaping problems
Christian Brabandt <cb@256bit.org>
parents:
12086
diff
changeset
|
529 let buf = term_start([&shell, &shellcmdflag, 'echo "123"']) |
0a61213afdd2
patch 8.0.0928: MS-Windows: passing arglist to job has escaping problems
Christian Brabandt <cb@256bit.org>
parents:
12086
diff
changeset
|
530 call assert_fails(buf . 'bwipe', 'E517') |
0a61213afdd2
patch 8.0.0928: MS-Windows: passing arglist to job has escaping problems
Christian Brabandt <cb@256bit.org>
parents:
12086
diff
changeset
|
531 exe buf . 'bwipe!' |
0a61213afdd2
patch 8.0.0928: MS-Windows: passing arglist to job has escaping problems
Christian Brabandt <cb@256bit.org>
parents:
12086
diff
changeset
|
532 call assert_equal("", bufname(buf)) |
0a61213afdd2
patch 8.0.0928: MS-Windows: passing arglist to job has escaping problems
Christian Brabandt <cb@256bit.org>
parents:
12086
diff
changeset
|
533 endfunction |
12154
71e10b81226d
patch 8.0.0957: a terminal job can deadlock when sending many keys
Christian Brabandt <cb@256bit.org>
parents:
12126
diff
changeset
|
534 |
71e10b81226d
patch 8.0.0957: a terminal job can deadlock when sending many keys
Christian Brabandt <cb@256bit.org>
parents:
12126
diff
changeset
|
535 func Test_terminal_noblock() |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
536 let buf = term_start(&shell) |
12339
040ec95b8647
patch 8.0.1049: shell on Mac can't handle long text
Christian Brabandt <cb@256bit.org>
parents:
12313
diff
changeset
|
537 if has('mac') |
040ec95b8647
patch 8.0.1049: shell on Mac can't handle long text
Christian Brabandt <cb@256bit.org>
parents:
12313
diff
changeset
|
538 " The shell or something else has a problem dealing with more than 1000 |
040ec95b8647
patch 8.0.1049: shell on Mac can't handle long text
Christian Brabandt <cb@256bit.org>
parents:
12313
diff
changeset
|
539 " characters at the same time. |
040ec95b8647
patch 8.0.1049: shell on Mac can't handle long text
Christian Brabandt <cb@256bit.org>
parents:
12313
diff
changeset
|
540 let len = 1000 |
040ec95b8647
patch 8.0.1049: shell on Mac can't handle long text
Christian Brabandt <cb@256bit.org>
parents:
12313
diff
changeset
|
541 else |
040ec95b8647
patch 8.0.1049: shell on Mac can't handle long text
Christian Brabandt <cb@256bit.org>
parents:
12313
diff
changeset
|
542 let len = 5000 |
040ec95b8647
patch 8.0.1049: shell on Mac can't handle long text
Christian Brabandt <cb@256bit.org>
parents:
12313
diff
changeset
|
543 endif |
12154
71e10b81226d
patch 8.0.0957: a terminal job can deadlock when sending many keys
Christian Brabandt <cb@256bit.org>
parents:
12126
diff
changeset
|
544 |
71e10b81226d
patch 8.0.0957: a terminal job can deadlock when sending many keys
Christian Brabandt <cb@256bit.org>
parents:
12126
diff
changeset
|
545 for c in ['a','b','c','d','e','f','g','h','i','j','k'] |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
546 call term_sendkeys(buf, 'echo ' . repeat(c, len) . "\<cr>") |
12154
71e10b81226d
patch 8.0.0957: a terminal job can deadlock when sending many keys
Christian Brabandt <cb@256bit.org>
parents:
12126
diff
changeset
|
547 endfor |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
548 call term_sendkeys(buf, "echo done\<cr>") |
12198
65cff399750b
patch 8.0.0979: terminal noblock test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12196
diff
changeset
|
549 |
65cff399750b
patch 8.0.0979: terminal noblock test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12196
diff
changeset
|
550 " On MS-Windows there is an extra empty line below "done". Find "done" in |
65cff399750b
patch 8.0.0979: terminal noblock test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12196
diff
changeset
|
551 " the last-but-one or the last-but-two line. |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
552 let lnum = term_getsize(buf)[0] - 1 |
13158
43bd8bad22b6
patch 8.0.1453: terminal test fails on some slow terminals
Christian Brabandt <cb@256bit.org>
parents:
13156
diff
changeset
|
553 call WaitFor({-> term_getline(buf, lnum) =~ "done" || term_getline(buf, lnum - 1) =~ "done"}, 10000) |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
554 let line = term_getline(buf, lnum) |
12198
65cff399750b
patch 8.0.0979: terminal noblock test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12196
diff
changeset
|
555 if line !~ 'done' |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
556 let line = term_getline(buf, lnum - 1) |
12198
65cff399750b
patch 8.0.0979: terminal noblock test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12196
diff
changeset
|
557 endif |
65cff399750b
patch 8.0.0979: terminal noblock test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12196
diff
changeset
|
558 call assert_match('done', line) |
12154
71e10b81226d
patch 8.0.0957: a terminal job can deadlock when sending many keys
Christian Brabandt <cb@256bit.org>
parents:
12126
diff
changeset
|
559 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
560 let g:job = term_getjob(buf) |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
561 call Stop_shell_in_terminal(buf) |
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
562 call term_wait(buf) |
12166
f512c507b061
patch 8.0.0963: terminal test fails on MacOS
Christian Brabandt <cb@256bit.org>
parents:
12156
diff
changeset
|
563 unlet g:job |
12154
71e10b81226d
patch 8.0.0957: a terminal job can deadlock when sending many keys
Christian Brabandt <cb@256bit.org>
parents:
12126
diff
changeset
|
564 bwipe |
71e10b81226d
patch 8.0.0957: a terminal job can deadlock when sending many keys
Christian Brabandt <cb@256bit.org>
parents:
12126
diff
changeset
|
565 endfunc |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
566 |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
567 func Test_terminal_write_stdin() |
12309
e1f44e4afe67
patch 8.0.1034: sending buffer lines to terminal doesn't work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12271
diff
changeset
|
568 if !executable('wc') |
12313
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
569 throw 'skipped: wc command not available' |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
570 endif |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
571 new |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
572 call setline(1, ['one', 'two', 'three']) |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
573 %term wc |
12313
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
574 call WaitFor('getline("$") =~ "3"') |
12309
e1f44e4afe67
patch 8.0.1034: sending buffer lines to terminal doesn't work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12271
diff
changeset
|
575 let nrs = split(getline('$')) |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
576 call assert_equal(['3', '3', '14'], nrs) |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
577 bwipe |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
578 |
12313
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
579 new |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
580 call setline(1, ['one', 'two', 'three', 'four']) |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
581 2,3term wc |
12313
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
582 call WaitFor('getline("$") =~ "2"') |
12309
e1f44e4afe67
patch 8.0.1034: sending buffer lines to terminal doesn't work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12271
diff
changeset
|
583 let nrs = split(getline('$')) |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
584 call assert_equal(['2', '2', '10'], nrs) |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
585 bwipe |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
586 |
12313
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
587 if executable('python') |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
588 new |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
589 call setline(1, ['print("hello")']) |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
590 1term ++eof=exit() python |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
591 " MS-Windows echoes the input, Unix doesn't. |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
592 call WaitFor('getline("$") =~ "exit" || getline(1) =~ "hello"') |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
593 if getline(1) =~ 'hello' |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
594 call assert_equal('hello', getline(1)) |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
595 else |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
596 call assert_equal('hello', getline(line('$') - 1)) |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
597 endif |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
598 bwipe |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
599 |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
600 if has('win32') |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
601 new |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
602 call setline(1, ['print("hello")']) |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
603 1term ++eof=<C-Z> python |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
604 call WaitFor('getline("$") =~ "Z"') |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
605 call assert_equal('hello', getline(line('$') - 1)) |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
606 bwipe |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
607 endif |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
608 endif |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
609 |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
610 bwipe! |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
611 endfunc |
12240
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
612 |
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
613 func Test_terminal_no_cmd() |
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
614 " Todo: make this work in the GUI |
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
615 if !has('gui_running') |
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
616 return |
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
617 endif |
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
618 let buf = term_start('NONE', {}) |
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
619 call assert_notequal(0, buf) |
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
620 |
12389
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
621 let pty = job_info(term_getjob(buf))['tty_out'] |
12240
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
622 call assert_notequal('', pty) |
12389
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
623 if has('win32') |
12475
827ad6758d33
patch 8.0.1117: Test_terminal_no_cmd hangs on MS-Windows with GUI
Christian Brabandt <cb@256bit.org>
parents:
12473
diff
changeset
|
624 silent exe '!start cmd /c "echo look here > ' . pty . '"' |
12389
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
625 else |
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
626 call system('echo "look here" > ' . pty) |
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
627 endif |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
628 call WaitFor({-> term_getline(buf, 1) =~ "look here"}) |
12389
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
629 |
12475
827ad6758d33
patch 8.0.1117: Test_terminal_no_cmd hangs on MS-Windows with GUI
Christian Brabandt <cb@256bit.org>
parents:
12473
diff
changeset
|
630 call assert_match('look here', term_getline(buf, 1)) |
12240
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
631 bwipe! |
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
632 endfunc |
12343
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
633 |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
634 func Test_terminal_special_chars() |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
635 " this file name only works on Unix |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
636 if !has('unix') |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
637 return |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
638 endif |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
639 call mkdir('Xdir with spaces') |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
640 call writefile(['x'], 'Xdir with spaces/quoted"file') |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
641 term ls Xdir\ with\ spaces/quoted\"file |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
642 call WaitFor('term_getline("", 1) =~ "quoted"') |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
643 call assert_match('quoted"file', term_getline('', 1)) |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
644 call term_wait('') |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
645 |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
646 call delete('Xdir with spaces', 'rf') |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
647 bwipe |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
648 endfunc |
12345
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
649 |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
650 func Test_terminal_wrong_options() |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
651 call assert_fails('call term_start(&shell, { |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
652 \ "in_io": "file", |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
653 \ "in_name": "xxx", |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
654 \ "out_io": "file", |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
655 \ "out_name": "xxx", |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
656 \ "err_io": "file", |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
657 \ "err_name": "xxx" |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
658 \ })', 'E474:') |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
659 call assert_fails('call term_start(&shell, { |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
660 \ "out_buf": bufnr("%") |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
661 \ })', 'E474:') |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
662 call assert_fails('call term_start(&shell, { |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
663 \ "err_buf": bufnr("%") |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
664 \ })', 'E474:') |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
665 endfunc |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
666 |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
667 func Test_terminal_redir_file() |
12349
bb67396239a4
patch 8.0.1054: terminal test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12345
diff
changeset
|
668 " TODO: this should work on MS-Window |
bb67396239a4
patch 8.0.1054: terminal test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12345
diff
changeset
|
669 if has('unix') |
bb67396239a4
patch 8.0.1054: terminal test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12345
diff
changeset
|
670 let cmd = Get_cat_123_cmd() |
bb67396239a4
patch 8.0.1054: terminal test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12345
diff
changeset
|
671 let buf = term_start(cmd, {'out_io': 'file', 'out_name': 'Xfile'}) |
bb67396239a4
patch 8.0.1054: terminal test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12345
diff
changeset
|
672 call term_wait(buf) |
bb67396239a4
patch 8.0.1054: terminal test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12345
diff
changeset
|
673 call WaitFor('len(readfile("Xfile")) > 0') |
bb67396239a4
patch 8.0.1054: terminal test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12345
diff
changeset
|
674 call assert_match('123', readfile('Xfile')[0]) |
12415
cd66083e371e
patch 8.0.1087: Test_terminal_cwd is flaky
Christian Brabandt <cb@256bit.org>
parents:
12407
diff
changeset
|
675 let g:job = term_getjob(buf) |
cd66083e371e
patch 8.0.1087: Test_terminal_cwd is flaky
Christian Brabandt <cb@256bit.org>
parents:
12407
diff
changeset
|
676 call WaitFor('job_status(g:job) == "dead"') |
12349
bb67396239a4
patch 8.0.1054: terminal test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12345
diff
changeset
|
677 call delete('Xfile') |
12389
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
678 bwipe |
12349
bb67396239a4
patch 8.0.1054: terminal test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12345
diff
changeset
|
679 endif |
12345
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
680 |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
681 if has('unix') |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
682 call writefile(['one line'], 'Xfile') |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
683 let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xfile'}) |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
684 call term_wait(buf) |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
685 call WaitFor('term_getline(' . buf . ', 1) == "one line"') |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
686 call assert_equal('one line', term_getline(buf, 1)) |
12357
9a7fb1d01137
patch 8.0.1058: terminal redirection test is flaky
Christian Brabandt <cb@256bit.org>
parents:
12355
diff
changeset
|
687 let g:job = term_getjob(buf) |
9a7fb1d01137
patch 8.0.1058: terminal redirection test is flaky
Christian Brabandt <cb@256bit.org>
parents:
12355
diff
changeset
|
688 call WaitFor('job_status(g:job) == "dead"') |
12345
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
689 bwipe |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
690 call delete('Xfile') |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
691 endif |
76ab57a79183
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io options
Christian Brabandt <cb@256bit.org>
parents:
12343
diff
changeset
|
692 endfunc |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
693 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
694 func TerminalTmap(remap) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
695 let buf = Run_shell_in_terminal({}) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
696 call assert_equal('t', mode()) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
697 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
698 if a:remap |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
699 tmap 123 456 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
700 else |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
701 tnoremap 123 456 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
702 endif |
12983
7a9c4a8b1ceb
patch 8.0.1367: terminal test hangs, executing abcde
Christian Brabandt <cb@256bit.org>
parents:
12907
diff
changeset
|
703 " don't use abcde, it's an existing command |
7a9c4a8b1ceb
patch 8.0.1367: terminal test hangs, executing abcde
Christian Brabandt <cb@256bit.org>
parents:
12907
diff
changeset
|
704 tmap 456 abxde |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
705 call assert_equal('456', maparg('123', 't')) |
12983
7a9c4a8b1ceb
patch 8.0.1367: terminal test hangs, executing abcde
Christian Brabandt <cb@256bit.org>
parents:
12907
diff
changeset
|
706 call assert_equal('abxde', maparg('456', 't')) |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
707 call feedkeys("123", 'tx') |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
708 call WaitFor({-> term_getline(buf, term_getcursor(buf)[0]) =~ 'abxde\|456'}) |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
709 let lnum = term_getcursor(buf)[0] |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
710 if a:remap |
12983
7a9c4a8b1ceb
patch 8.0.1367: terminal test hangs, executing abcde
Christian Brabandt <cb@256bit.org>
parents:
12907
diff
changeset
|
711 call assert_match('abxde', term_getline(buf, lnum)) |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
712 else |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
713 call assert_match('456', term_getline(buf, lnum)) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
714 endif |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
715 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
716 call term_sendkeys(buf, "\r") |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
717 call Stop_shell_in_terminal(buf) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
718 call term_wait(buf) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
719 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
720 tunmap 123 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
721 tunmap 456 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
722 call assert_equal('', maparg('123', 't')) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
723 close |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
724 unlet g:job |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
725 endfunc |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
726 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
727 func Test_terminal_tmap() |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
728 call TerminalTmap(1) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
729 call TerminalTmap(0) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
730 endfunc |
12648
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
731 |
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
732 func Test_terminal_wall() |
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
733 let buf = Run_shell_in_terminal({}) |
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
734 wall |
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
735 call Stop_shell_in_terminal(buf) |
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
736 call term_wait(buf) |
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
737 exe buf . 'bwipe' |
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
738 unlet g:job |
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
739 endfunc |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
740 |
13302
b5806be0b36d
patch 8.0.1525: using :wqa exits even if a job runs in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13158
diff
changeset
|
741 func Test_terminal_wqall() |
b5806be0b36d
patch 8.0.1525: using :wqa exits even if a job runs in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13158
diff
changeset
|
742 let buf = Run_shell_in_terminal({}) |
b5806be0b36d
patch 8.0.1525: using :wqa exits even if a job runs in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13158
diff
changeset
|
743 call assert_fails('wqall', 'E948') |
b5806be0b36d
patch 8.0.1525: using :wqa exits even if a job runs in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13158
diff
changeset
|
744 call Stop_shell_in_terminal(buf) |
b5806be0b36d
patch 8.0.1525: using :wqa exits even if a job runs in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13158
diff
changeset
|
745 call term_wait(buf) |
b5806be0b36d
patch 8.0.1525: using :wqa exits even if a job runs in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13158
diff
changeset
|
746 exe buf . 'bwipe' |
b5806be0b36d
patch 8.0.1525: using :wqa exits even if a job runs in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13158
diff
changeset
|
747 unlet g:job |
b5806be0b36d
patch 8.0.1525: using :wqa exits even if a job runs in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13158
diff
changeset
|
748 endfunc |
b5806be0b36d
patch 8.0.1525: using :wqa exits even if a job runs in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13158
diff
changeset
|
749 |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
750 func Test_terminal_composing_unicode() |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
751 let save_enc = &encoding |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
752 set encoding=utf-8 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
753 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
754 if has('win32') |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
755 let cmd = "cmd /K chcp 65001" |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
756 let lnum = [3, 6, 9] |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
757 else |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
758 let cmd = &shell |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
759 let lnum = [1, 3, 5] |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
760 endif |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
761 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
762 enew |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
763 let buf = term_start(cmd, {'curwin': bufnr('')}) |
12734
810a4c3d4f7e
patch 8.0.1245: when WaitFor() has a wrong expression it just waits a second
Christian Brabandt <cb@256bit.org>
parents:
12724
diff
changeset
|
764 let g:job = term_getjob(buf) |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
765 call term_wait(buf, 50) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
766 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
767 " ascii + composing |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
768 let txt = "a\u0308bc" |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
769 call term_sendkeys(buf, "echo " . txt . "\r") |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
770 call term_wait(buf, 50) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
771 call assert_match("echo " . txt, term_getline(buf, lnum[0])) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
772 call assert_equal(txt, term_getline(buf, lnum[0] + 1)) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
773 let l = term_scrape(buf, lnum[0] + 1) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
774 call assert_equal("a\u0308", l[0].chars) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
775 call assert_equal("b", l[1].chars) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
776 call assert_equal("c", l[2].chars) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
777 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
778 " multibyte + composing |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
779 let txt = "\u304b\u3099\u304e\u304f\u3099\u3052\u3053\u3099" |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
780 call term_sendkeys(buf, "echo " . txt . "\r") |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
781 call term_wait(buf, 50) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
782 call assert_match("echo " . txt, term_getline(buf, lnum[1])) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
783 call assert_equal(txt, term_getline(buf, lnum[1] + 1)) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
784 let l = term_scrape(buf, lnum[1] + 1) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
785 call assert_equal("\u304b\u3099", l[0].chars) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
786 call assert_equal("\u304e", l[1].chars) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
787 call assert_equal("\u304f\u3099", l[2].chars) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
788 call assert_equal("\u3052", l[3].chars) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
789 call assert_equal("\u3053\u3099", l[4].chars) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
790 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
791 " \u00a0 + composing |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
792 let txt = "abc\u00a0\u0308" |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
793 call term_sendkeys(buf, "echo " . txt . "\r") |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
794 call term_wait(buf, 50) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
795 call assert_match("echo " . txt, term_getline(buf, lnum[2])) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
796 call assert_equal(txt, term_getline(buf, lnum[2] + 1)) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
797 let l = term_scrape(buf, lnum[2] + 1) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
798 call assert_equal("\u00a0\u0308", l[3].chars) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
799 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
800 call term_sendkeys(buf, "exit\r") |
12734
810a4c3d4f7e
patch 8.0.1245: when WaitFor() has a wrong expression it just waits a second
Christian Brabandt <cb@256bit.org>
parents:
12724
diff
changeset
|
801 call WaitFor('job_status(g:job) == "dead"') |
810a4c3d4f7e
patch 8.0.1245: when WaitFor() has a wrong expression it just waits a second
Christian Brabandt <cb@256bit.org>
parents:
12724
diff
changeset
|
802 call assert_equal('dead', job_status(g:job)) |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
803 bwipe! |
12734
810a4c3d4f7e
patch 8.0.1245: when WaitFor() has a wrong expression it just waits a second
Christian Brabandt <cb@256bit.org>
parents:
12724
diff
changeset
|
804 unlet g:job |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
805 let &encoding = save_enc |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
806 endfunc |
12903
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
807 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
808 func Test_terminal_aucmd_on_close() |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
809 fun Nop() |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
810 let s:called = 1 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
811 endfun |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
812 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
813 aug repro |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
814 au! |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
815 au BufWinLeave * call Nop() |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
816 aug END |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
817 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
818 let [cmd, waittime] = s:get_sleep_cmd() |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
819 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
820 call assert_equal(1, winnr('$')) |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
821 new |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
822 call setline(1, ['one', 'two']) |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
823 exe 'term ++close ' . cmd |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
824 wincmd p |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
825 call WaitFor("winnr('$') == 2", waittime) |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
826 call assert_equal(1, s:called) |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
827 bwipe! |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
828 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
829 unlet s:called |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
830 au! repro |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
831 delfunc Nop |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
832 endfunc |
13109
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
833 |
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
834 func Test_terminal_term_start_empty_command() |
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
835 let cmd = "call term_start('', {'curwin' : 1, 'term_finish' : 'close'})" |
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
836 call assert_fails(cmd, 'E474') |
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
837 let cmd = "call term_start('', {'curwin' : 1, 'term_finish' : 'close'})" |
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
838 call assert_fails(cmd, 'E474') |
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
839 let cmd = "call term_start({}, {'curwin' : 1, 'term_finish' : 'close'})" |
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
840 call assert_fails(cmd, 'E474') |
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
841 let cmd = "call term_start(0, {'curwin' : 1, 'term_finish' : 'close'})" |
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
842 call assert_fails(cmd, 'E474') |
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
843 endfunc |
13132
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
844 |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
845 func Test_terminal_response_to_control_sequence() |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
846 if !has('unix') |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
847 return |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
848 endif |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
849 |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
850 let buf = Run_shell_in_terminal({}) |
13543
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
851 call WaitFor({-> term_getline(buf, 1) != ''}) |
13132
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
852 |
13543
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
853 call term_sendkeys(buf, "cat\<CR>") |
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
854 call WaitFor({-> term_getline(buf, 1) =~ 'cat'}) |
13156
36c503100cb3
patch 8.0.1452: terminal test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
13132
diff
changeset
|
855 |
13543
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
856 " Request the cursor position. |
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
857 call term_sendkeys(buf, "\x1b[6n\<CR>") |
13156
36c503100cb3
patch 8.0.1452: terminal test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
13132
diff
changeset
|
858 |
36c503100cb3
patch 8.0.1452: terminal test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
13132
diff
changeset
|
859 " Wait for output from tty to display, below an empty line. |
13543
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
860 call WaitFor({-> term_getline(buf, 4) =~ '3;1R'}) |
13132
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
861 |
13543
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
862 " End "cat" gently. |
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
863 call term_sendkeys(buf, "\<CR>\<C-D>") |
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
864 |
13132
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
865 call Stop_shell_in_terminal(buf) |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
866 exe buf . 'bwipe' |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
867 unlet g:job |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
868 endfunc |
13438
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
869 |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
870 " Run Vim, start a terminal in that Vim with the kill argument, |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
871 " :qall works. |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
872 func Run_terminal_qall_kill(line1, line2) |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
873 " 1. Open a terminal window and wait for the prompt to appear |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
874 " 2. set kill using term_setkill() |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
875 " 3. make Vim exit, it will kill the shell |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
876 let after = [ |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
877 \ a:line1, |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
878 \ 'let buf = bufnr("%")', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
879 \ 'while term_getline(buf, 1) =~ "^\\s*$"', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
880 \ ' sleep 10m', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
881 \ 'endwhile', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
882 \ a:line2, |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
883 \ 'au VimLeavePre * call writefile(["done"], "Xdone")', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
884 \ 'qall', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
885 \ ] |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
886 if !RunVim([], after, '') |
13438
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
887 return |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
888 endif |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
889 call assert_equal("done", readfile("Xdone")[0]) |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
890 call delete("Xdone") |
13438
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
891 endfunc |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
892 |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
893 " Run Vim in a terminal, then start a terminal in that Vim with a kill |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
894 " argument, check that :qall works. |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
895 func Test_terminal_qall_kill_arg() |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
896 call Run_terminal_qall_kill('term ++kill=kill', '') |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
897 endfunc |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
898 |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
899 " Run Vim, start a terminal in that Vim, set the kill argument with |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
900 " term_setkill(), check that :qall works. |
13438
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
901 func Test_terminal_qall_kill_func() |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
902 call Run_terminal_qall_kill('term', 'call term_setkill(buf, "kill")') |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
903 endfunc |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
904 |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
905 " Run Vim, start a terminal in that Vim without the kill argument, |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
906 " check that :qall does not exit, :qall! does. |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
907 func Test_terminal_qall_exit() |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
908 let after = [ |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
909 \ 'term', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
910 \ 'let buf = bufnr("%")', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
911 \ 'while term_getline(buf, 1) =~ "^\\s*$"', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
912 \ ' sleep 10m', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
913 \ 'endwhile', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
914 \ 'set nomore', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
915 \ 'au VimLeavePre * call writefile(["too early"], "Xdone")', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
916 \ 'qall', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
917 \ 'au! VimLeavePre * exe buf . "bwipe!" | call writefile(["done"], "Xdone")', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
918 \ 'cquit', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
919 \ ] |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
920 if !RunVim([], after, '') |
13438
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
921 return |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
922 endif |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
923 call assert_equal("done", readfile("Xdone")[0]) |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
924 call delete("Xdone") |
13438
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
925 endfunc |
13440
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
926 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
927 " Run Vim in a terminal, then start a terminal in that Vim without a kill |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
928 " argument, check that :confirm qall works. |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
929 func Test_terminal_qall_prompt() |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
930 if !CanRunVimInTerminal() |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
931 return |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
932 endif |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
933 let buf = RunVimInTerminal('', {}) |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
934 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
935 " Open a terminal window and wait for the prompt to appear |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
936 call term_sendkeys(buf, ":term\<CR>") |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
937 call WaitFor({-> term_getline(buf, 10) =~ '\[running]'}) |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
938 call WaitFor({-> term_getline(buf, 1) !~ '^\s*$'}) |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
939 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
940 " make Vim exit, it will prompt to kill the shell |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
941 call term_sendkeys(buf, "\<C-W>:confirm qall\<CR>") |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
942 call WaitFor({-> term_getline(buf, 20) =~ 'ancel:'}) |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
943 call term_sendkeys(buf, "y") |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
944 call WaitFor({-> term_getstatus(buf) == "finished"}) |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
945 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
946 " close the terminal window where Vim was running |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
947 quit |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
948 endfunc |
13444
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
949 |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
950 func Test_terminal_open_autocmd() |
13444
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
951 augroup repro |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
952 au! |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
953 au TerminalOpen * let s:called += 1 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
954 augroup END |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
955 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
956 let s:called = 0 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
957 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
958 " Open a terminal window with :terminal |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
959 terminal |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
960 call assert_equal(1, s:called) |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
961 bwipe! |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
962 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
963 " Open a terminal window with term_start() |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
964 call term_start(&shell) |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
965 call assert_equal(2, s:called) |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
966 bwipe! |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
967 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
968 " Open a hidden terminal buffer with :terminal |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
969 terminal ++hidden |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
970 call assert_equal(3, s:called) |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
971 for buf in term_list() |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
972 exe buf . "bwipe!" |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
973 endfor |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
974 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
975 " Open a hidden terminal buffer with term_start() |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
976 let buf = term_start(&shell, {'hidden': 1}) |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
977 call assert_equal(4, s:called) |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
978 exe buf . "bwipe!" |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
979 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
980 unlet s:called |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
981 au! repro |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
982 endfunction |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
983 |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
984 func Check_dump01(off) |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
985 call assert_equal('one two three four five', trim(getline(a:off + 1))) |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
986 call assert_equal('~ Select Word', trim(getline(a:off + 7))) |
13559
af68603e213d
patch 8.0.1653: screen dump is made too soon
Christian Brabandt <cb@256bit.org>
parents:
13557
diff
changeset
|
987 call assert_equal(':popup PopUp', trim(getline(a:off + 20))) |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
988 endfunc |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
989 |
13557
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
990 func Test_terminal_dumpwrite_composing() |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
991 if !CanRunVimInTerminal() |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
992 return |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
993 endif |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
994 let save_enc = &encoding |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
995 set encoding=utf-8 |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
996 call assert_equal(1, winnr('$')) |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
997 |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
998 let text = " a\u0300 e\u0302 o\u0308" |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
999 call writefile([text], 'Xcomposing') |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1000 let buf = RunVimInTerminal('Xcomposing', {}) |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1001 call WaitFor({-> term_getline(buf, 1) =~ text}) |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1002 call term_dumpwrite(buf, 'Xdump') |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1003 let dumpline = readfile('Xdump')[0] |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1004 call assert_match('|à| |ê| |ö', dumpline) |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1005 |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1006 call StopVimInTerminal(buf) |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1007 call delete('Xcomposing') |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1008 call delete('Xdump') |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1009 let &encoding = save_enc |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1010 endfunc |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1011 |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1012 " just testing basic functionality. |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1013 func Test_terminal_dumpload() |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1014 call assert_equal(1, winnr('$')) |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1015 call term_dumpload('dumps/Test_popup_command_01.dump') |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1016 call assert_equal(2, winnr('$')) |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1017 call assert_equal(20, line('$')) |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1018 call Check_dump01(0) |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1019 quit |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1020 endfunc |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1021 |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1022 func Test_terminal_dumpdiff() |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1023 call assert_equal(1, winnr('$')) |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1024 call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump') |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1025 call assert_equal(2, winnr('$')) |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1026 call assert_equal(62, line('$')) |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1027 call Check_dump01(0) |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1028 call Check_dump01(42) |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1029 call assert_equal(' bbbbbbbbbbbbbbbbbb ', getline(26)[0:29]) |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1030 quit |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1031 endfunc |
13527
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1032 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1033 func Test_terminal_dumpdiff_options() |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1034 set laststatus=0 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1035 call assert_equal(1, winnr('$')) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1036 let height = winheight(0) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1037 call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump', {'vertical': 1, 'term_cols': 33}) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1038 call assert_equal(2, winnr('$')) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1039 call assert_equal(height, winheight(winnr())) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1040 call assert_equal(33, winwidth(winnr())) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1041 call assert_equal('dump diff dumps/Test_popup_command_01.dump', bufname('%')) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1042 quit |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1043 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1044 call assert_equal(1, winnr('$')) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1045 let width = winwidth(0) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1046 call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump', {'vertical': 0, 'term_rows': 13, 'term_name': 'something else'}) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1047 call assert_equal(2, winnr('$')) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1048 call assert_equal(width, winwidth(winnr())) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1049 call assert_equal(13, winheight(winnr())) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1050 call assert_equal('something else', bufname('%')) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1051 quit |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1052 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1053 call assert_equal(1, winnr('$')) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1054 call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump', {'curwin': 1}) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1055 call assert_equal(1, winnr('$')) |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1056 bwipe |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1057 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1058 set laststatus& |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1059 endfunc |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1060 |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1061 func Api_drop_common(options) |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1062 call assert_equal(1, winnr('$')) |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1063 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1064 " Use the title termcap entries to output the escape sequence. |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1065 call writefile([ |
13541
296d02b0637f
patch 8.0.1644: terminal API tests still fail
Christian Brabandt <cb@256bit.org>
parents:
13539
diff
changeset
|
1066 \ 'set title', |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1067 \ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"', |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1068 \ 'let &titlestring = ''["drop","Xtextfile"' . a:options . ']''', |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1069 \ 'redraw', |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1070 \ "set t_ts=", |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1071 \ ], 'Xscript') |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1072 let buf = RunVimInTerminal('-S Xscript', {}) |
13650
87ffb7f85b28
patch 8.0.1697: various tests are still a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13626
diff
changeset
|
1073 call WaitFor({-> bufnr('Xtextfile') > 0}) |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1074 call assert_equal('Xtextfile', expand('%:t')) |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1075 call assert_true(winnr('$') >= 3) |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1076 return buf |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1077 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1078 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1079 func Test_terminal_api_drop_newwin() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1080 if !CanRunVimInTerminal() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1081 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1082 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1083 let buf = Api_drop_common('') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1084 call assert_equal(0, &bin) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1085 call assert_equal('', &fenc) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1086 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1087 call StopVimInTerminal(buf) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1088 call delete('Xscript') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1089 bwipe Xtextfile |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1090 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1091 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1092 func Test_terminal_api_drop_newwin_bin() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1093 if !CanRunVimInTerminal() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1094 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1095 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1096 let buf = Api_drop_common(',{"bin":1}') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1097 call assert_equal(1, &bin) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1098 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1099 call StopVimInTerminal(buf) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1100 call delete('Xscript') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1101 bwipe Xtextfile |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1102 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1103 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1104 func Test_terminal_api_drop_newwin_binary() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1105 if !CanRunVimInTerminal() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1106 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1107 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1108 let buf = Api_drop_common(',{"binary":1}') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1109 call assert_equal(1, &bin) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1110 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1111 call StopVimInTerminal(buf) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1112 call delete('Xscript') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1113 bwipe Xtextfile |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1114 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1115 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1116 func Test_terminal_api_drop_newwin_nobin() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1117 if !CanRunVimInTerminal() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1118 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1119 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1120 set binary |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1121 let buf = Api_drop_common(',{"nobin":1}') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1122 call assert_equal(0, &bin) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1123 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1124 call StopVimInTerminal(buf) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1125 call delete('Xscript') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1126 bwipe Xtextfile |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1127 set nobinary |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1128 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1129 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1130 func Test_terminal_api_drop_newwin_nobinary() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1131 if !CanRunVimInTerminal() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1132 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1133 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1134 set binary |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1135 let buf = Api_drop_common(',{"nobinary":1}') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1136 call assert_equal(0, &bin) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1137 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1138 call StopVimInTerminal(buf) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1139 call delete('Xscript') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1140 bwipe Xtextfile |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1141 set nobinary |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1142 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1143 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1144 func Test_terminal_api_drop_newwin_ff() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1145 if !CanRunVimInTerminal() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1146 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1147 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1148 let buf = Api_drop_common(',{"ff":"dos"}') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1149 call assert_equal("dos", &ff) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1150 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1151 call StopVimInTerminal(buf) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1152 call delete('Xscript') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1153 bwipe Xtextfile |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1154 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1155 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1156 func Test_terminal_api_drop_newwin_fileformat() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1157 if !CanRunVimInTerminal() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1158 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1159 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1160 let buf = Api_drop_common(',{"fileformat":"dos"}') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1161 call assert_equal("dos", &ff) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1162 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1163 call StopVimInTerminal(buf) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1164 call delete('Xscript') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1165 bwipe Xtextfile |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1166 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1167 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1168 func Test_terminal_api_drop_newwin_enc() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1169 if !CanRunVimInTerminal() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1170 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1171 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1172 let buf = Api_drop_common(',{"enc":"utf-16"}') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1173 call assert_equal("utf-16", &fenc) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1174 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1175 call StopVimInTerminal(buf) |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1176 call delete('Xscript') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1177 bwipe Xtextfile |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1178 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1179 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1180 func Test_terminal_api_drop_newwin_encoding() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1181 if !CanRunVimInTerminal() |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1182 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1183 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1184 let buf = Api_drop_common(',{"encoding":"utf-16"}') |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1185 call assert_equal("utf-16", &fenc) |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1186 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1187 call StopVimInTerminal(buf) |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1188 call delete('Xscript') |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1189 bwipe Xtextfile |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1190 endfunc |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1191 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1192 func Test_terminal_api_drop_oldwin() |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1193 if !CanRunVimInTerminal() |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1194 return |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1195 endif |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1196 let firstwinid = win_getid() |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1197 split Xtextfile |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1198 let textfile_winid = win_getid() |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1199 call assert_equal(2, winnr('$')) |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1200 call win_gotoid(firstwinid) |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1201 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1202 " Use the title termcap entries to output the escape sequence. |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1203 call writefile([ |
13541
296d02b0637f
patch 8.0.1644: terminal API tests still fail
Christian Brabandt <cb@256bit.org>
parents:
13539
diff
changeset
|
1204 \ 'set title', |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1205 \ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"', |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1206 \ 'let &titlestring = ''["drop","Xtextfile"]''', |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1207 \ 'redraw', |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1208 \ "set t_ts=", |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1209 \ ], 'Xscript') |
13537
3fa880445c99
patch 8.0.1642: running Vim in terminal fails with two windows
Christian Brabandt <cb@256bit.org>
parents:
13535
diff
changeset
|
1210 let buf = RunVimInTerminal('-S Xscript', {'rows': 10}) |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1211 call WaitFor({-> expand('%:t') =='Xtextfile'}) |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1212 call assert_equal(textfile_winid, win_getid()) |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1213 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1214 call StopVimInTerminal(buf) |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1215 call delete('Xscript') |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1216 bwipe Xtextfile |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1217 endfunc |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1218 |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1219 func Tapi_TryThis(bufnum, arg) |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1220 let g:called_bufnum = a:bufnum |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1221 let g:called_arg = a:arg |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1222 endfunc |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1223 |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1224 func WriteApiCall(funcname) |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1225 " Use the title termcap entries to output the escape sequence. |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1226 call writefile([ |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1227 \ 'set title', |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1228 \ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"', |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1229 \ 'let &titlestring = ''["call","' . a:funcname . '",["hello",123]]''', |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1230 \ 'redraw', |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1231 \ "set t_ts=", |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1232 \ ], 'Xscript') |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1233 endfunc |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1234 |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1235 func Test_terminal_api_call() |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1236 if !CanRunVimInTerminal() |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1237 return |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1238 endif |
13539
5f543bce50e8
patch 8.0.1643: terminal API tests fail
Christian Brabandt <cb@256bit.org>
parents:
13537
diff
changeset
|
1239 |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1240 call WriteApiCall('Tapi_TryThis') |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1241 let buf = RunVimInTerminal('-S Xscript', {}) |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1242 call WaitFor({-> exists('g:called_bufnum')}) |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1243 call assert_equal(buf, g:called_bufnum) |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1244 call assert_equal(['hello', 123], g:called_arg) |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1245 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1246 call StopVimInTerminal(buf) |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1247 call delete('Xscript') |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1248 unlet g:called_bufnum |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1249 unlet g:called_arg |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1250 endfunc |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1251 |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1252 func Test_terminal_api_call_fails() |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1253 if !CanRunVimInTerminal() |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1254 return |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1255 endif |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1256 |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1257 call WriteApiCall('TryThis') |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1258 call ch_logfile('Xlog', 'w') |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1259 let buf = RunVimInTerminal('-S Xscript', {}) |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1260 call WaitFor({-> string(readfile('Xlog')) =~ 'Invalid function name: TryThis'}) |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1261 |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1262 call StopVimInTerminal(buf) |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1263 call delete('Xscript') |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1264 call ch_logfile('', '') |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1265 call delete('Xlog') |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1266 endfunc |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1267 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1268 func Test_terminal_ansicolors_default() |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1269 let colors = [ |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1270 \ '#000000', '#e00000', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1271 \ '#00e000', '#e0e000', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1272 \ '#0000e0', '#e000e0', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1273 \ '#00e0e0', '#e0e0e0', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1274 \ '#808080', '#ff4040', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1275 \ '#40ff40', '#ffff40', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1276 \ '#4040ff', '#ff40ff', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1277 \ '#40ffff', '#ffffff', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1278 \] |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1279 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1280 let buf = Run_shell_in_terminal({}) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1281 call assert_equal(colors, term_getansicolors(buf)) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1282 call Stop_shell_in_terminal(buf) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1283 call term_wait(buf) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1284 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1285 exe buf . 'bwipe' |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1286 endfunc |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1287 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1288 let s:test_colors = [ |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1289 \ '#616e64', '#0d0a79', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1290 \ '#6d610d', '#0a7373', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1291 \ '#690d0a', '#6d696e', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1292 \ '#0d0a6f', '#616e0d', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1293 \ '#0a6479', '#6d0d0a', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1294 \ '#617373', '#0d0a69', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1295 \ '#6d690d', '#0a6e6f', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1296 \ '#610d0a', '#6e6479', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1297 \] |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1298 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1299 func Test_terminal_ansicolors_global() |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1300 let g:terminal_ansi_colors = reverse(copy(s:test_colors)) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1301 let buf = Run_shell_in_terminal({}) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1302 call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf)) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1303 call Stop_shell_in_terminal(buf) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1304 call term_wait(buf) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1305 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1306 exe buf . 'bwipe' |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1307 unlet g:terminal_ansi_colors |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1308 endfunc |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1309 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1310 func Test_terminal_ansicolors_func() |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1311 let g:terminal_ansi_colors = reverse(copy(s:test_colors)) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1312 let buf = Run_shell_in_terminal({'ansi_colors': s:test_colors}) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1313 call assert_equal(s:test_colors, term_getansicolors(buf)) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1314 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1315 call term_setansicolors(buf, g:terminal_ansi_colors) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1316 call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf)) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1317 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1318 let colors = [ |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1319 \ 'ivory', 'AliceBlue', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1320 \ 'grey67', 'dark goldenrod', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1321 \ 'SteelBlue3', 'PaleVioletRed4', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1322 \ 'MediumPurple2', 'yellow2', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1323 \ 'RosyBrown3', 'OrangeRed2', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1324 \ 'white smoke', 'navy blue', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1325 \ 'grey47', 'gray97', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1326 \ 'MistyRose2', 'DodgerBlue4', |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1327 \] |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1328 call term_setansicolors(buf, colors) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1329 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1330 let colors[4] = 'Invalid' |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1331 call assert_fails('call term_setansicolors(buf, colors)', 'E474:') |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1332 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1333 call Stop_shell_in_terminal(buf) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1334 call term_wait(buf) |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1335 exe buf . 'bwipe' |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1336 endfunc |