Mercurial > vim
annotate src/testdir/test_terminal.vim @ 15557:c0560da7873e v8.1.0786
patch 8.1.0786: ml_get error when updating the status line
commit https://github.com/vim/vim/commit/10772307c4e5299ed45470f92779f089a00d841e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 20 18:25:54 2019 +0100
patch 8.1.0786: ml_get error when updating the status line
Problem: ml_get error when updating the status line and a terminal had its
scrollback cleared. (Chris Patuzzo)
Solution: Check the cursor position when drawing the status line.
(closes #3830)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 20 Jan 2019 18:30:06 +0100 |
parents | a0a1bd12e48c |
children | f611222a4349 |
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() |
13835
8e583c52eb44
patch 8.0.1789: BufWinEnter does not work well for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13829
diff
changeset
|
35 au TerminalOpen * let b:done = 'yes' |
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 |
13835
8e583c52eb44
patch 8.0.1789: BufWinEnter does not work well for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13829
diff
changeset
|
64 au! TerminalOpen |
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!' |
13798
415185e2c970
patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13750
diff
changeset
|
86 call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) |
11917
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("", bufname(buf)) |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
88 |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
89 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
|
90 endfunc |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
91 |
12479
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
92 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
|
93 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
|
94 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
|
95 split |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
96 quit! |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
97 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
|
98 sleep 50m |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
99 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
|
100 |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
101 quit! |
13798
415185e2c970
patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13750
diff
changeset
|
102 call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) |
12479
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
103 |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
104 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
|
105 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
|
106 endfunc |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
107 |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
108 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
|
109 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
|
110 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
|
111 quit |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
112 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
|
113 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
|
114 endfor |
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_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
|
116 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
|
117 |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
118 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
|
119 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
|
120 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
|
121 |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
122 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
|
123 endfunc |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
124 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
125 func s:Nasty_exit_cb(job, st) |
11939
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
126 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
|
127 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
|
128 endfunc |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
129 |
12405
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
130 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
|
131 if has('win32') |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
132 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
|
133 else |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
134 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
|
135 return "cat Xtext" |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
136 endif |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
137 endfunc |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
138 |
11939
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
139 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
|
140 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
|
141 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
|
142 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
|
143 |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
144 call WaitForAssert({-> assert_equal("dead", job_status(g:job))}) |
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
145 call WaitForAssert({-> assert_equal(0, g:buf)}) |
11939
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
146 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
|
147 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
|
148 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
|
149 endfunc |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
150 |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
151 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
|
152 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
|
153 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
|
154 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
|
155 call assert_true(len(l) == 0) |
11906
7df4afab67c7
patch 8.0.0833: terminal test fails
Christian Brabandt <cb@256bit.org>
parents:
11872
diff
changeset
|
156 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
|
157 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
|
158 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
|
159 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
|
160 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
|
161 call assert_equal('#00e000', l[0].fg) |
15231
42ce33efb23d
patch 8.1.0625: MS-Windows: terminal test fails in white console
Bram Moolenaar <Bram@vim.org>
parents:
15217
diff
changeset
|
162 if has('win32') |
42ce33efb23d
patch 8.1.0625: MS-Windows: terminal test fails in white console
Bram Moolenaar <Bram@vim.org>
parents:
15217
diff
changeset
|
163 " On Windows 'background' always defaults to dark, even though the terminal |
42ce33efb23d
patch 8.1.0625: MS-Windows: terminal test fails in white console
Bram Moolenaar <Bram@vim.org>
parents:
15217
diff
changeset
|
164 " may use a light background. Therefore accept both white and black. |
42ce33efb23d
patch 8.1.0625: MS-Windows: terminal test fails in white console
Bram Moolenaar <Bram@vim.org>
parents:
15217
diff
changeset
|
165 call assert_match('#ffffff\|#000000', l[0].bg) |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 else |
15231
42ce33efb23d
patch 8.1.0625: MS-Windows: terminal test fails in white console
Bram Moolenaar <Bram@vim.org>
parents:
15217
diff
changeset
|
167 if &background == 'light' |
42ce33efb23d
patch 8.1.0625: MS-Windows: terminal test fails in white console
Bram Moolenaar <Bram@vim.org>
parents:
15217
diff
changeset
|
168 call assert_equal('#ffffff', l[0].bg) |
42ce33efb23d
patch 8.1.0625: MS-Windows: terminal test fails in white console
Bram Moolenaar <Bram@vim.org>
parents:
15217
diff
changeset
|
169 else |
42ce33efb23d
patch 8.1.0625: MS-Windows: terminal test fails in white console
Bram Moolenaar <Bram@vim.org>
parents:
15217
diff
changeset
|
170 call assert_equal('#000000', l[0].bg) |
42ce33efb23d
patch 8.1.0625: MS-Windows: terminal test fails in white console
Bram Moolenaar <Bram@vim.org>
parents:
15217
diff
changeset
|
171 endif |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 endif |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 |
11923
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, -1) |
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) |
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
176 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
|
177 call assert_equal('', l) |
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
178 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
|
179 call assert_equal('', l) |
11906
7df4afab67c7
patch 8.0.0833: terminal test fails
Christian Brabandt <cb@256bit.org>
parents:
11872
diff
changeset
|
180 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
|
181 call assert_equal('123', l) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 endfunc |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
184 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
|
185 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
|
186 let buf = term_start(cmd) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 let termlist = term_list() |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 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
|
190 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
|
191 |
11872
ff8122091ec6
patch 8.0.0816: crash when using invalid buffer number
Christian Brabandt <cb@256bit.org>
parents:
11846
diff
changeset
|
192 " 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
|
193 call term_wait(1234) |
ff8122091ec6
patch 8.0.0816: crash when using invalid buffer number
Christian Brabandt <cb@256bit.org>
parents:
11846
diff
changeset
|
194 |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 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
|
196 " 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
|
197 " "cls" to happen, after that we have one line with three characters. |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
198 call WaitForAssert({-> assert_equal(3, len(term_scrape(buf, 1)))}) |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 call Check_123(buf) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 " 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
|
202 let job = term_getjob(buf) |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
203 call WaitForAssert({-> assert_equal("dead", job_status(job))}) |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 call term_wait(buf) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 call Check_123(buf) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 exe buf . 'bwipe' |
11872
ff8122091ec6
patch 8.0.0816: crash when using invalid buffer number
Christian Brabandt <cb@256bit.org>
parents:
11846
diff
changeset
|
208 call delete('Xtext') |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 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
|
210 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
211 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
|
212 if !has('multi_byte') |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
213 return |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
214 endif |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
215 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
|
216 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
|
217 " 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
|
218 " multibyte characters. |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
219 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
|
220 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
|
221 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
|
222 let line = 4 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
223 else |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
224 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
|
225 let line = 1 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
226 endif |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
227 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
228 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
|
229 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
|
230 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
|
231 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
|
232 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
|
233 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
|
234 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
|
235 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
|
236 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
|
237 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
|
238 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
|
239 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
|
240 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
241 let job = term_getjob(buf) |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
242 call WaitForAssert({-> assert_equal("dead", job_status(job))}) |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
243 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
|
244 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
245 exe buf . 'bwipe' |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
246 call delete('Xtext') |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
247 endfunc |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
248 |
12011
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
249 func Test_terminal_scroll() |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
250 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
|
251 if has('win32') |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
252 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
|
253 else |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
254 let cmd = "cat Xtext" |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
255 endif |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
256 let buf = term_start(cmd) |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
257 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
258 let job = term_getjob(buf) |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
259 call WaitForAssert({-> assert_equal("dead", job_status(job))}) |
12011
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
260 call term_wait(buf) |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
261 if has('win32') |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
262 " 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
|
263 sleep 100m |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
264 endif |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
265 |
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 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
|
267 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
|
268 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
|
269 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
|
270 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
|
271 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
|
272 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
|
273 |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
274 exe buf . 'bwipe' |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
275 call delete('Xtext') |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
276 endfunc |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
277 |
13684
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
278 func Test_terminal_scrollback() |
14017
e88e2a8de4c5
patch 8.1.0026: terminal test fails with very tall terminal
Christian Brabandt <cb@256bit.org>
parents:
13956
diff
changeset
|
279 let buf = Run_shell_in_terminal({'term_rows': 15}) |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
280 set termwinscroll=100 |
13684
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
281 call writefile(range(150), 'Xtext') |
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
282 if has('win32') |
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
283 call term_sendkeys(buf, "type Xtext\<CR>") |
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
284 else |
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
285 call term_sendkeys(buf, "cat Xtext\<CR>") |
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
286 endif |
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
287 let rows = term_getsize(buf)[0] |
13692
2dd14253ad12
patch 8.0.1718: terminal scrollback test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
13688
diff
changeset
|
288 " On MS-Windows there is an empty line, check both last line and above it. |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
289 call WaitForAssert({-> assert_match( '149', term_getline(buf, rows - 1) . term_getline(buf, rows - 2))}) |
13684
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
290 let lines = line('$') |
13688
f07e48d6650b
patch 8.0.1716: test for term_setsize() does not give a good error message
Christian Brabandt <cb@256bit.org>
parents:
13684
diff
changeset
|
291 call assert_inrange(91, 100, lines) |
13684
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
292 |
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
293 call Stop_shell_in_terminal(buf) |
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
294 call term_wait(buf) |
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
295 exe buf . 'bwipe' |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
296 set termwinscroll& |
13684
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
297 endfunc |
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
298 |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
299 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
|
300 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
|
301 |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
302 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
|
303 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
|
304 bwipe! |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
305 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
|
306 |
12056
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
307 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
|
308 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
309 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
310 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
|
311 |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
312 vsplit |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
313 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
|
314 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
|
315 |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
316 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
|
317 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
|
318 |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
319 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
|
320 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
|
321 |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
322 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
|
323 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
|
324 |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
325 bwipe! |
13684
1651a4c5c27a
patch 8.0.1714: term_setsize() does not give an error in a normal buffer
Christian Brabandt <cb@256bit.org>
parents:
13678
diff
changeset
|
326 call assert_fails("call term_setsize('', 7, 30)", "E955:") |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
327 |
12056
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
328 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
|
329 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
330 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
331 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
|
332 |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
333 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
|
334 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
|
335 bwipe! |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
336 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
|
337 |
12056
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
338 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
|
339 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
340 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
341 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
|
342 |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
343 split |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
344 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
|
345 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
|
346 bwipe! |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
347 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
|
348 |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
349 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
|
350 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
351 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
352 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
|
353 |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
354 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
|
355 endfunc |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
356 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
357 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
|
358 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
|
359 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
|
360 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
361 split dummy |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
362 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
|
363 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
|
364 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
365 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
366 split dummy |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
367 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
|
368 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
|
369 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
370 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
371 split dummy |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
372 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
|
373 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
|
374 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
|
375 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
|
376 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
|
377 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
378 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
379 split dummy |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
380 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
|
381 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
|
382 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
|
383 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
384 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
385 split dummy |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
386 bwipe! |
12343
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
387 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
|
388 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
|
389 |
12903
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
390 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
|
391 if s:python != '' |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
392 let cmd = s:python . " test_short_sleep.py" |
14027
6d9783027174
patch 8.1.0031: terminal test aucmd_on_close if flaky
Christian Brabandt <cb@256bit.org>
parents:
14023
diff
changeset
|
393 " 500 was not enough for Travis |
6d9783027174
patch 8.1.0031: terminal test aucmd_on_close if flaky
Christian Brabandt <cb@256bit.org>
parents:
14023
diff
changeset
|
394 let waittime = 900 |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
395 else |
12062
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
396 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
|
397 let waittime = 2000 |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
398 if has('win32') |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
399 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
|
400 else |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
401 let cmd = 'sleep 1' |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
402 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
|
403 endif |
12903
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
404 return [cmd, waittime] |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
405 endfunc |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
406 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
407 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
|
408 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
|
409 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
410 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
|
411 |
13476
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
412 " 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
|
413 terminal |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
414 let buf = bufnr('%') |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
415 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
|
416 " Wait for the shell to display a prompt |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
417 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) |
13476
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
418 call Stop_shell_in_terminal(buf) |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
419 call WaitForAssert({-> assert_equal(1, winnr('$'))}, waittime) |
13476
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
420 |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
421 " 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
|
422 terminal ++noclose |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
423 let buf = bufnr('%') |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
424 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
|
425 " Wait for the shell to display a prompt |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
426 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) |
13476
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
427 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
|
428 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
|
429 quit |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
430 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
|
431 |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
432 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
|
433 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
|
434 wincmd p |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
435 call WaitForAssert({-> assert_equal(1, winnr('$'))}, 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
|
436 |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
437 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
|
438 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
|
439 wincmd p |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
440 call WaitForAssert({-> assert_equal(1, winnr('$'))}, 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
|
441 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
|
442 |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
443 exe 'terminal ++open ' . cmd |
12271
e4aa68825575
patch 8.0.1015: missing update to terminal test
Christian Brabandt <cb@256bit.org>
parents:
12263
diff
changeset
|
444 close! |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
445 call WaitForAssert({-> assert_equal(2, winnr('$'))}, 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
|
446 bwipe |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
447 |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
448 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
|
449 close! |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
450 call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) |
12064
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
451 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
|
452 |
12064
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
453 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
|
454 call assert_equal(1, winnr('$')) |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
455 call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) |
12064
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
456 bwipe |
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
457 |
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
458 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
|
459 call assert_equal(1, winnr('$')) |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
460 call WaitForAssert({-> assert_equal(2, winnr('$'))}, 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
|
461 bwipe |
12072
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
462 |
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
463 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
|
464 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
|
465 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
|
466 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
|
467 |
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
468 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
|
469 close! |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
470 call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) |
12072
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
471 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
|
472 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
|
473 endfunc |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
474 |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
475 func Test_terminal_cwd() |
12415
cd66083e371e
patch 8.0.1087: Test_terminal_cwd is flaky
Christian Brabandt <cb@256bit.org>
parents:
12407
diff
changeset
|
476 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
|
477 return |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
478 endif |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
479 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
|
480 let buf = term_start('pwd', {'cwd': 'Xdir'}) |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
481 call WaitForAssert({-> 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
|
482 |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
483 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
|
484 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
|
485 endfunc |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
486 |
14948
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
487 func Test_terminal_cwd_failure() |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
488 " Case 1: Provided directory is not actually a directory. Attempt to make |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
489 " the file executable as well. |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
490 call writefile([], 'Xfile') |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
491 call setfperm('Xfile', 'rwx------') |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
492 call assert_fails("call term_start(&shell, {'cwd': 'Xfile'})", 'E475:') |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
493 call delete('Xfile') |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
494 |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
495 " Case 2: Directory does not exist. |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
496 call assert_fails("call term_start(&shell, {'cwd': 'Xdir'})", 'E475:') |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
497 |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
498 " Case 3: Directory exists but is not accessible. |
14995
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
499 " Skip this for root, it will be accessible anyway. |
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
500 if $USER != 'root' |
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
501 call mkdir('XdirNoAccess', '', '0600') |
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
502 " return early if the directory permissions could not be set properly |
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
503 if getfperm('XdirNoAccess')[2] == 'x' |
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
504 call delete('XdirNoAccess', 'rf') |
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
505 return |
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
506 endif |
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
507 call assert_fails("call term_start(&shell, {'cwd': 'XdirNoAccess'})", 'E475:') |
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
508 call delete('XdirNoAccess', 'rf') |
14948
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
509 endif |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
510 endfunc |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
511 |
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
|
512 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
|
513 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
|
514 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
|
515 endif |
14063
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
516 call s:test_environment("VIM_SERVERNAME", v:servername) |
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
517 endfunc |
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
518 |
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
519 func Test_terminal_version() |
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
520 call s:test_environment("VIM_TERMINAL", string(v:version)) |
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
521 endfunc |
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
522 |
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
523 func s:test_environment(name, value) |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
524 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
|
525 " Wait for the shell to display a prompt |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
526 call WaitForAssert({-> assert_notequal('', 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
|
527 if has('win32') |
14063
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
528 call term_sendkeys(buf, "echo %" . a:name . "%\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
|
529 else |
14063
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
530 call term_sendkeys(buf, "echo $" . a:name . "\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
|
531 endif |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
532 call term_wait(buf) |
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
533 call Stop_shell_in_terminal(buf) |
14063
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
534 call WaitForAssert({-> assert_equal(a:value, getline(2))}) |
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
|
535 |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
536 exe buf . 'bwipe' |
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
537 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
|
538 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
|
539 |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
540 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
|
541 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
|
542 " Wait for the shell to display a prompt |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
543 call WaitForAssert({-> assert_notequal('', 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
|
544 if has('win32') |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
545 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
|
546 else |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
547 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
|
548 endif |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
549 call term_wait(buf) |
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
550 call Stop_shell_in_terminal(buf) |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
551 call WaitForAssert({-> assert_equal('correct', getline(2))}) |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
552 |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
553 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
|
554 endfunc |
12086
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
555 |
12096
0a61213afdd2
patch 8.0.0928: MS-Windows: passing arglist to job has escaping problems
Christian Brabandt <cb@256bit.org>
parents:
12086
diff
changeset
|
556 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
|
557 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
|
558 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
|
559 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
|
560 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
|
561 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
|
562 |
71e10b81226d
patch 8.0.0957: a terminal job can deadlock when sending many keys
Christian Brabandt <cb@256bit.org>
parents:
12126
diff
changeset
|
563 func Test_terminal_noblock() |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
564 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
|
565 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
|
566 " 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
|
567 " 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
|
568 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
|
569 else |
040ec95b8647
patch 8.0.1049: shell on Mac can't handle long text
Christian Brabandt <cb@256bit.org>
parents:
12313
diff
changeset
|
570 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
|
571 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
|
572 |
71e10b81226d
patch 8.0.0957: a terminal job can deadlock when sending many keys
Christian Brabandt <cb@256bit.org>
parents:
12126
diff
changeset
|
573 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
|
574 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
|
575 endfor |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
576 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
|
577 |
65cff399750b
patch 8.0.0979: terminal noblock test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12196
diff
changeset
|
578 " 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
|
579 " 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
|
580 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
|
581 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
|
582 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
|
583 if line !~ 'done' |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
584 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
|
585 endif |
65cff399750b
patch 8.0.0979: terminal noblock test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12196
diff
changeset
|
586 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
|
587 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
588 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
|
589 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
|
590 call term_wait(buf) |
12166
f512c507b061
patch 8.0.0963: terminal test fails on MacOS
Christian Brabandt <cb@256bit.org>
parents:
12156
diff
changeset
|
591 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
|
592 bwipe |
71e10b81226d
patch 8.0.0957: a terminal job can deadlock when sending many keys
Christian Brabandt <cb@256bit.org>
parents:
12126
diff
changeset
|
593 endfunc |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
594 |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
595 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
|
596 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
|
597 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
|
598 endif |
14023
7f5ddc6e715b
patch 8.1.0029: terminal test fails on MS-Windows when "wc" exists
Christian Brabandt <cb@256bit.org>
parents:
14017
diff
changeset
|
599 if has('win32') |
7f5ddc6e715b
patch 8.1.0029: terminal test fails on MS-Windows when "wc" exists
Christian Brabandt <cb@256bit.org>
parents:
14017
diff
changeset
|
600 " TODO: enable once writing to stdin works on MS-Windows |
7f5ddc6e715b
patch 8.1.0029: terminal test fails on MS-Windows when "wc" exists
Christian Brabandt <cb@256bit.org>
parents:
14017
diff
changeset
|
601 return |
7f5ddc6e715b
patch 8.1.0029: terminal test fails on MS-Windows when "wc" exists
Christian Brabandt <cb@256bit.org>
parents:
14017
diff
changeset
|
602 endif |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
603 new |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
604 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
|
605 %term wc |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
606 call WaitForAssert({-> assert_match('3', getline("$"))}) |
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
|
607 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
|
608 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
|
609 bwipe |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
610 |
12313
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
611 new |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
612 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
|
613 2,3term wc |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
614 call WaitForAssert({-> assert_match('2', getline("$"))}) |
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
|
615 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
|
616 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
|
617 bwipe |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
618 |
12313
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
619 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
|
620 new |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
621 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
|
622 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
|
623 " 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
|
624 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
|
625 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
|
626 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
|
627 else |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
628 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
|
629 endif |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
630 bwipe |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
631 |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
632 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
|
633 new |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
634 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
|
635 1term ++eof=<C-Z> python |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
636 call WaitForAssert({-> assert_match('Z', getline("$"))}) |
12313
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
637 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
|
638 bwipe |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
639 endif |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
640 endif |
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
641 |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
642 bwipe! |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
643 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
|
644 |
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
645 func Test_terminal_no_cmd() |
15545
a0a1bd12e48c
patch 8.1.0780: terminal test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents:
15541
diff
changeset
|
646 " Does not work on Mac. |
15541
0e39325d5ea1
patch 8.1.0778: terminal test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
647 " Todo: make this work on Win32 again |
15545
a0a1bd12e48c
patch 8.1.0780: terminal test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents:
15541
diff
changeset
|
648 if has('mac') || has('win32') |
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
|
649 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
|
650 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
|
651 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
|
652 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
|
653 |
12389
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
654 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
|
655 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
|
656 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
|
657 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
|
658 else |
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
659 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
|
660 endif |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
661 call WaitForAssert({-> assert_match('look here', term_getline(buf, 1))}) |
12389
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
662 |
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
|
663 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
|
664 endfunc |
12343
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
665 |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
666 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
|
667 " 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
|
668 if !has('unix') |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
669 return |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
670 endif |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
671 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
|
672 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
|
673 term ls Xdir\ with\ spaces/quoted\"file |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
674 call WaitForAssert({-> assert_match('quoted"file', term_getline('', 1))}) |
12343
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
675 call term_wait('') |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
676 |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
677 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
|
678 bwipe |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
679 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
|
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 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
|
682 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
|
683 \ "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
|
684 \ "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
|
685 \ "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
|
686 \ "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
|
687 \ "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
|
688 \ "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
|
689 \ })', '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
|
690 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
|
691 \ "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
|
692 \ })', '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
|
693 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
|
694 \ "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
|
695 \ })', '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
|
696 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
|
697 |
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
|
698 func Test_terminal_redir_file() |
13860
7f892e37b017
patch 8.0.1801: MS-Windows: redirecting terminal output does not work
Christian Brabandt <cb@256bit.org>
parents:
13835
diff
changeset
|
699 let cmd = Get_cat_123_cmd() |
7f892e37b017
patch 8.0.1801: MS-Windows: redirecting terminal output does not work
Christian Brabandt <cb@256bit.org>
parents:
13835
diff
changeset
|
700 let buf = term_start(cmd, {'out_io': 'file', 'out_name': 'Xfile'}) |
7f892e37b017
patch 8.0.1801: MS-Windows: redirecting terminal output does not work
Christian Brabandt <cb@256bit.org>
parents:
13835
diff
changeset
|
701 call term_wait(buf) |
7f892e37b017
patch 8.0.1801: MS-Windows: redirecting terminal output does not work
Christian Brabandt <cb@256bit.org>
parents:
13835
diff
changeset
|
702 call WaitForAssert({-> assert_notequal(0, len(readfile("Xfile")))}) |
7f892e37b017
patch 8.0.1801: MS-Windows: redirecting terminal output does not work
Christian Brabandt <cb@256bit.org>
parents:
13835
diff
changeset
|
703 call assert_match('123', readfile('Xfile')[0]) |
7f892e37b017
patch 8.0.1801: MS-Windows: redirecting terminal output does not work
Christian Brabandt <cb@256bit.org>
parents:
13835
diff
changeset
|
704 let g:job = term_getjob(buf) |
7f892e37b017
patch 8.0.1801: MS-Windows: redirecting terminal output does not work
Christian Brabandt <cb@256bit.org>
parents:
13835
diff
changeset
|
705 call WaitForAssert({-> assert_equal("dead", job_status(g:job))}) |
7f892e37b017
patch 8.0.1801: MS-Windows: redirecting terminal output does not work
Christian Brabandt <cb@256bit.org>
parents:
13835
diff
changeset
|
706 call delete('Xfile') |
7f892e37b017
patch 8.0.1801: MS-Windows: redirecting terminal output does not work
Christian Brabandt <cb@256bit.org>
parents:
13835
diff
changeset
|
707 bwipe |
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
|
708 |
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
|
709 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
|
710 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
|
711 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
|
712 call term_wait(buf) |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
713 call WaitForAssert({-> 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
|
714 let g:job = term_getjob(buf) |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
715 call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) |
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
|
716 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
|
717 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
|
718 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
|
719 endfunc |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
720 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
721 func TerminalTmap(remap) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
722 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
|
723 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
|
724 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
725 if a:remap |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
726 tmap 123 456 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
727 else |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
728 tnoremap 123 456 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
729 endif |
12983
7a9c4a8b1ceb
patch 8.0.1367: terminal test hangs, executing abcde
Christian Brabandt <cb@256bit.org>
parents:
12907
diff
changeset
|
730 " 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
|
731 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
|
732 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
|
733 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
|
734 call feedkeys("123", 'tx') |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
735 call WaitForAssert({-> assert_match('abxde\|456', term_getline(buf, term_getcursor(buf)[0]))}) |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
736 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
|
737 if a:remap |
12983
7a9c4a8b1ceb
patch 8.0.1367: terminal test hangs, executing abcde
Christian Brabandt <cb@256bit.org>
parents:
12907
diff
changeset
|
738 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
|
739 else |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
740 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
|
741 endif |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
742 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
743 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
|
744 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
|
745 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
|
746 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
747 tunmap 123 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
748 tunmap 456 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
749 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
|
750 close |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
751 unlet g:job |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
752 endfunc |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
753 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
754 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
|
755 call TerminalTmap(1) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
756 call TerminalTmap(0) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
757 endfunc |
12648
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
758 |
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
759 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
|
760 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
|
761 wall |
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
762 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
|
763 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
|
764 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
|
765 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
|
766 endfunc |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
767 |
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
|
768 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
|
769 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
|
770 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
|
771 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
|
772 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
|
773 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
|
774 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
|
775 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
|
776 |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
777 func Test_terminal_composing_unicode() |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
778 let save_enc = &encoding |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
779 set encoding=utf-8 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
780 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
781 if has('win32') |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
782 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
|
783 let lnum = [3, 6, 9] |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
784 else |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
785 let cmd = &shell |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
786 let lnum = [1, 3, 5] |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
787 endif |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
788 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
789 enew |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
790 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
|
791 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
|
792 call term_wait(buf, 50) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
793 |
13750
3ab6198c1f9a
patch 8.0.1747: MS-Windows: term_start() does not set job_info() cmd
Christian Brabandt <cb@256bit.org>
parents:
13742
diff
changeset
|
794 if has('win32') |
3ab6198c1f9a
patch 8.0.1747: MS-Windows: term_start() does not set job_info() cmd
Christian Brabandt <cb@256bit.org>
parents:
13742
diff
changeset
|
795 call assert_equal('cmd', job_info(g:job).cmd[0]) |
3ab6198c1f9a
patch 8.0.1747: MS-Windows: term_start() does not set job_info() cmd
Christian Brabandt <cb@256bit.org>
parents:
13742
diff
changeset
|
796 else |
3ab6198c1f9a
patch 8.0.1747: MS-Windows: term_start() does not set job_info() cmd
Christian Brabandt <cb@256bit.org>
parents:
13742
diff
changeset
|
797 call assert_equal(&shell, job_info(g:job).cmd[0]) |
3ab6198c1f9a
patch 8.0.1747: MS-Windows: term_start() does not set job_info() cmd
Christian Brabandt <cb@256bit.org>
parents:
13742
diff
changeset
|
798 endif |
3ab6198c1f9a
patch 8.0.1747: MS-Windows: term_start() does not set job_info() cmd
Christian Brabandt <cb@256bit.org>
parents:
13742
diff
changeset
|
799 |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
800 " ascii + composing |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
801 let txt = "a\u0308bc" |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
802 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
|
803 call term_wait(buf, 50) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
804 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
|
805 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
|
806 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
|
807 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
|
808 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
|
809 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
|
810 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
811 " multibyte + composing |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
812 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
|
813 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
|
814 call term_wait(buf, 50) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
815 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
|
816 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
|
817 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
|
818 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
|
819 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
|
820 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
|
821 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
|
822 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
|
823 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
824 " \u00a0 + composing |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
825 let txt = "abc\u00a0\u0308" |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
826 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
|
827 call term_wait(buf, 50) |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
828 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
|
829 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
|
830 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
|
831 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
|
832 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
833 call term_sendkeys(buf, "exit\r") |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
834 call WaitForAssert({-> 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
|
835 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
|
836 unlet g:job |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
837 let &encoding = save_enc |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
838 endfunc |
12903
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
839 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
840 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
|
841 fun Nop() |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
842 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
|
843 endfun |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
844 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
845 aug repro |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
846 au! |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
847 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
|
848 aug END |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
849 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
850 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
|
851 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
852 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
|
853 new |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
854 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
|
855 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
|
856 wincmd p |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
857 call WaitForAssert({-> assert_equal(2, winnr('$'))}, waittime) |
12903
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
858 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
|
859 bwipe! |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
860 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
861 unlet s:called |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
862 au! repro |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
863 delfunc Nop |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
864 endfunc |
13109
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
865 |
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
866 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
|
867 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
|
868 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
|
869 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
|
870 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
|
871 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
|
872 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
|
873 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
|
874 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
|
875 endfunc |
13132
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
876 |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
877 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
|
878 if !has('unix') |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
879 return |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
880 endif |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
881 |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
882 let buf = Run_shell_in_terminal({}) |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
883 call WaitForAssert({-> assert_notequal('', 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
|
884 |
13543
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
885 call term_sendkeys(buf, "cat\<CR>") |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
886 call WaitForAssert({-> assert_match('cat', term_getline(buf, 1))}) |
13156
36c503100cb3
patch 8.0.1452: terminal test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
13132
diff
changeset
|
887 |
13543
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
888 " 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
|
889 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
|
890 |
36c503100cb3
patch 8.0.1452: terminal test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
13132
diff
changeset
|
891 " Wait for output from tty to display, below an empty line. |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
892 call WaitForAssert({-> assert_match('3;1R', term_getline(buf, 4))}) |
13132
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
893 |
13543
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
894 " 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
|
895 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
|
896 |
13132
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
897 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
|
898 exe buf . 'bwipe' |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
899 unlet g:job |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
900 endfunc |
13438
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
901 |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
902 " 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
|
903 " :qall works. |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
904 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
|
905 " 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
|
906 " 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
|
907 " 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
|
908 let after = [ |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
909 \ a:line1, |
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 \ a:line2, |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
915 \ '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
|
916 \ 'qall', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
917 \ ] |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
918 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
|
919 return |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
920 endif |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
921 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
|
922 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
|
923 endfunc |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
924 |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
925 " 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
|
926 " 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
|
927 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
|
928 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
|
929 endfunc |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
930 |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
931 " 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
|
932 " 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
|
933 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
|
934 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
|
935 endfunc |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
936 |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
937 " 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
|
938 " 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
|
939 func Test_terminal_qall_exit() |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
940 let after = [ |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
941 \ 'term', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
942 \ 'let buf = bufnr("%")', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
943 \ '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
|
944 \ ' sleep 10m', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
945 \ 'endwhile', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
946 \ 'set nomore', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
947 \ '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
|
948 \ 'qall', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
949 \ '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
|
950 \ 'cquit', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
951 \ ] |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
952 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
|
953 return |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
954 endif |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
955 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
|
956 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
|
957 endfunc |
13440
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
958 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
959 " 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
|
960 " 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
|
961 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
|
962 if !CanRunVimInTerminal() |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
963 return |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
964 endif |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
965 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
|
966 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
967 " 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
|
968 call term_sendkeys(buf, ":term\<CR>") |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
969 call WaitForAssert({-> assert_match('\[running]', term_getline(buf, 10))}) |
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
970 call WaitForAssert({-> assert_notmatch('^\s*$', term_getline(buf, 1))}) |
13440
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
971 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
972 " 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
|
973 call term_sendkeys(buf, "\<C-W>:confirm qall\<CR>") |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
974 call WaitForAssert({-> assert_match('ancel:', term_getline(buf, 20))}) |
13440
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
975 call term_sendkeys(buf, "y") |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
976 call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))}) |
13440
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
977 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
978 " 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
|
979 quit |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
980 endfunc |
13444
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
981 |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
982 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
|
983 augroup repro |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
984 au! |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
985 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
|
986 augroup END |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
987 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
988 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
|
989 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
990 " 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
|
991 terminal |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
992 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
|
993 bwipe! |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
994 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
995 " 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
|
996 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
|
997 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
|
998 bwipe! |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
999 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1000 " 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
|
1001 terminal ++hidden |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1002 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
|
1003 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
|
1004 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
|
1005 endfor |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1006 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1007 " 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
|
1008 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
|
1009 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
|
1010 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
|
1011 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1012 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
|
1013 au! repro |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1014 endfunction |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1015 |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1016 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
|
1017 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
|
1018 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
|
1019 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
|
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 |
13557
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1022 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
|
1023 if !CanRunVimInTerminal() |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1024 return |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1025 endif |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1026 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
|
1027 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
|
1028 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
|
1029 |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1030 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
|
1031 call writefile([text], 'Xcomposing') |
13816
9b0e4976dac6
patch 8.0.1780: test fails because Vim in a terminal uses wrong 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
13808
diff
changeset
|
1032 let buf = RunVimInTerminal('--cmd "set encoding=utf-8" Xcomposing', {}) |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1033 call WaitForAssert({-> assert_match(text, term_getline(buf, 1))}) |
13557
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1034 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
|
1035 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
|
1036 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
|
1037 |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1038 call StopVimInTerminal(buf) |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1039 call delete('Xcomposing') |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1040 call delete('Xdump') |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1041 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
|
1042 endfunc |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1043 |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1044 " 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
|
1045 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
|
1046 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
|
1047 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
|
1048 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
|
1049 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
|
1050 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
|
1051 quit |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1052 endfunc |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1053 |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1054 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
|
1055 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
|
1056 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
|
1057 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
|
1058 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
|
1059 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
|
1060 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
|
1061 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
|
1062 quit |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1063 endfunc |
13527
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1064 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1065 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
|
1066 set laststatus=0 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1067 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
|
1068 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
|
1069 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
|
1070 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
|
1071 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
|
1072 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
|
1073 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
|
1074 quit |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1075 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1076 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
|
1077 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
|
1078 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
|
1079 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
|
1080 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
|
1081 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
|
1082 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
|
1083 quit |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1084 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1085 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
|
1086 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
|
1087 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
|
1088 bwipe |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1089 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1090 set laststatus& |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1091 endfunc |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1092 |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1093 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
|
1094 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
|
1095 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1096 " 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
|
1097 call writefile([ |
13541
296d02b0637f
patch 8.0.1644: terminal API tests still fail
Christian Brabandt <cb@256bit.org>
parents:
13539
diff
changeset
|
1098 \ '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
|
1099 \ '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
|
1100 \ '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
|
1101 \ 'redraw', |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1102 \ "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
|
1103 \ ], 'Xscript') |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1104 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
|
1105 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
|
1106 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
|
1107 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
|
1108 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
|
1109 endfunc |
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 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
|
1112 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
|
1113 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1114 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1115 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
|
1116 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
|
1117 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
|
1118 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1119 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
|
1120 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
|
1121 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
|
1122 endfunc |
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 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
|
1125 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
|
1126 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1127 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1128 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
|
1129 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
|
1130 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1131 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
|
1132 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
|
1133 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
|
1134 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1135 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1136 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
|
1137 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
|
1138 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1139 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1140 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
|
1141 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
|
1142 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1143 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
|
1144 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
|
1145 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
|
1146 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1147 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1148 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
|
1149 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
|
1150 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1151 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1152 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
|
1153 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
|
1154 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
|
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 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
|
1157 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
|
1158 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
|
1159 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
|
1160 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1161 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1162 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
|
1163 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
|
1164 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1165 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1166 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
|
1167 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
|
1168 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
|
1169 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1170 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
|
1171 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
|
1172 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
|
1173 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
|
1174 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1175 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1176 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
|
1177 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
|
1178 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1179 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1180 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
|
1181 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
|
1182 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1183 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
|
1184 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
|
1185 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
|
1186 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1187 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1188 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
|
1189 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
|
1190 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1191 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1192 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
|
1193 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
|
1194 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1195 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
|
1196 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
|
1197 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
|
1198 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1199 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1200 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
|
1201 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
|
1202 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1203 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1204 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
|
1205 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
|
1206 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1207 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
|
1208 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
|
1209 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
|
1210 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1211 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1212 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
|
1213 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
|
1214 return |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1215 endif |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1216 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
|
1217 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
|
1218 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1219 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
|
1220 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
|
1221 bwipe Xtextfile |
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 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1224 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
|
1225 if !CanRunVimInTerminal() |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1226 return |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1227 endif |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1228 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
|
1229 split Xtextfile |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1230 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
|
1231 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
|
1232 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
|
1233 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1234 " 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
|
1235 call writefile([ |
13541
296d02b0637f
patch 8.0.1644: terminal API tests still fail
Christian Brabandt <cb@256bit.org>
parents:
13539
diff
changeset
|
1236 \ '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
|
1237 \ '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
|
1238 \ '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
|
1239 \ 'redraw', |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1240 \ "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
|
1241 \ ], 'Xscript') |
13537
3fa880445c99
patch 8.0.1642: running Vim in terminal fails with two windows
Christian Brabandt <cb@256bit.org>
parents:
13535
diff
changeset
|
1242 let buf = RunVimInTerminal('-S Xscript', {'rows': 10}) |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1243 call WaitForAssert({-> assert_equal('Xtextfile', expand('%:t'))}) |
13535
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(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
|
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 bwipe Xtextfile |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1249 endfunc |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1250 |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1251 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
|
1252 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
|
1253 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
|
1254 endfunc |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1255 |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1256 func WriteApiCall(funcname) |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1257 " 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
|
1258 call writefile([ |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1259 \ 'set title', |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1260 \ '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
|
1261 \ '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
|
1262 \ 'redraw', |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1263 \ "set t_ts=", |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1264 \ ], 'Xscript') |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1265 endfunc |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1266 |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1267 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
|
1268 if !CanRunVimInTerminal() |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1269 return |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1270 endif |
13539
5f543bce50e8
patch 8.0.1643: terminal API tests fail
Christian Brabandt <cb@256bit.org>
parents:
13537
diff
changeset
|
1271 |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1272 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
|
1273 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
|
1274 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
|
1275 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
|
1276 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
|
1277 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1278 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
|
1279 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
|
1280 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
|
1281 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
|
1282 endfunc |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1283 |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1284 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
|
1285 if !CanRunVimInTerminal() |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1286 return |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1287 endif |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1288 |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1289 call WriteApiCall('TryThis') |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1290 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
|
1291 let buf = RunVimInTerminal('-S Xscript', {}) |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1292 call WaitForAssert({-> assert_match('Invalid function name: TryThis', string(readfile('Xlog')))}) |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1293 |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1294 call StopVimInTerminal(buf) |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1295 call delete('Xscript') |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1296 call ch_logfile('', '') |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1297 call delete('Xlog') |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1298 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
|
1299 |
13720
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1300 let s:caught_e937 = 0 |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1301 |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1302 func Tapi_Delete(bufnum, arg) |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1303 try |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1304 execute 'bdelete!' a:bufnum |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1305 catch /E937:/ |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1306 let s:caught_e937 = 1 |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1307 endtry |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1308 endfunc |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1309 |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1310 func Test_terminal_api_call_fail_delete() |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1311 if !CanRunVimInTerminal() |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1312 return |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1313 endif |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1314 |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1315 call WriteApiCall('Tapi_Delete') |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1316 let buf = RunVimInTerminal('-S Xscript', {}) |
13808
16a062cf08c2
patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents:
13798
diff
changeset
|
1317 call WaitForAssert({-> assert_equal(1, s:caught_e937)}) |
13720
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1318 |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1319 call StopVimInTerminal(buf) |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1320 call delete('Xscript') |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1321 call ch_logfile('', '') |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1322 endfunc |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1323 |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1324 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
|
1325 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
|
1326 \ '#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
|
1327 \ '#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
|
1328 \ '#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
|
1329 \ '#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
|
1330 \ '#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
|
1331 \ '#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
|
1332 \ '#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
|
1333 \ '#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
|
1334 \] |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1335 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1336 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
|
1337 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
|
1338 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
|
1339 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
|
1340 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1341 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
|
1342 endfunc |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1343 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1344 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
|
1345 \ '#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
|
1346 \ '#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
|
1347 \ '#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
|
1348 \ '#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
|
1349 \ '#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
|
1350 \ '#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
|
1351 \ '#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
|
1352 \ '#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
|
1353 \] |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1354 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1355 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
|
1356 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
|
1357 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
|
1358 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
|
1359 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
|
1360 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
|
1361 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1362 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
|
1363 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
|
1364 endfunc |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1365 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1366 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
|
1367 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
|
1368 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
|
1369 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
|
1370 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1371 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
|
1372 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
|
1373 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1374 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
|
1375 \ '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
|
1376 \ '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
|
1377 \ '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
|
1378 \ '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
|
1379 \ '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
|
1380 \ '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
|
1381 \ '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
|
1382 \ '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
|
1383 \] |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1384 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
|
1385 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1386 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
|
1387 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
|
1388 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1389 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
|
1390 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
|
1391 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
|
1392 endfunc |
13698
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1393 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1394 func Test_terminal_termwinsize_option_fixed() |
13698
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1395 if !CanRunVimInTerminal() |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1396 return |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1397 endif |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1398 set termwinsize=6x40 |
13698
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1399 let text = [] |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1400 for n in range(10) |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1401 call add(text, repeat(n, 50)) |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1402 endfor |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1403 call writefile(text, 'Xwinsize') |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1404 let buf = RunVimInTerminal('Xwinsize', {}) |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1405 let win = bufwinid(buf) |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1406 call assert_equal([6, 40], term_getsize(buf)) |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1407 call assert_equal(6, winheight(win)) |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1408 call assert_equal(40, winwidth(win)) |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1409 |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1410 " resizing the window doesn't resize the terminal. |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1411 resize 10 |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1412 vertical resize 60 |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1413 call assert_equal([6, 40], term_getsize(buf)) |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1414 call assert_equal(10, winheight(win)) |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1415 call assert_equal(60, winwidth(win)) |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1416 |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1417 call StopVimInTerminal(buf) |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1418 call delete('Xwinsize') |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1419 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1420 call assert_fails('set termwinsize=40', 'E474') |
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1421 call assert_fails('set termwinsize=10+40', 'E474') |
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1422 call assert_fails('set termwinsize=abc', 'E474') |
13698
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1423 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1424 set termwinsize= |
13698
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1425 endfunc |
13700
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1426 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1427 func Test_terminal_termwinsize_option_zero() |
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1428 set termwinsize=0x0 |
13700
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1429 let buf = Run_shell_in_terminal({}) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1430 let win = bufwinid(buf) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1431 call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1432 call Stop_shell_in_terminal(buf) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1433 call term_wait(buf) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1434 exe buf . 'bwipe' |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1435 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1436 set termwinsize=7x0 |
13700
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1437 let buf = Run_shell_in_terminal({}) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1438 let win = bufwinid(buf) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1439 call assert_equal([7, winwidth(win)], term_getsize(buf)) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1440 call Stop_shell_in_terminal(buf) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1441 call term_wait(buf) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1442 exe buf . 'bwipe' |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1443 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1444 set termwinsize=0x33 |
13700
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1445 let buf = Run_shell_in_terminal({}) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1446 let win = bufwinid(buf) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1447 call assert_equal([winheight(win), 33], term_getsize(buf)) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1448 call Stop_shell_in_terminal(buf) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1449 call term_wait(buf) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1450 exe buf . 'bwipe' |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1451 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1452 set termwinsize= |
13700
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1453 endfunc |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1454 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1455 func Test_terminal_termwinsize_mininmum() |
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1456 set termwinsize=10*50 |
13700
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1457 vsplit |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1458 let buf = Run_shell_in_terminal({}) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1459 let win = bufwinid(buf) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1460 call assert_inrange(10, 1000, winheight(win)) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1461 call assert_inrange(50, 1000, winwidth(win)) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1462 call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1463 |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1464 resize 15 |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1465 vertical resize 60 |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1466 redraw |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1467 call assert_equal([15, 60], term_getsize(buf)) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1468 call assert_equal(15, winheight(win)) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1469 call assert_equal(60, winwidth(win)) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1470 |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1471 resize 7 |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1472 vertical resize 30 |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1473 redraw |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1474 call assert_equal([10, 50], term_getsize(buf)) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1475 call assert_equal(7, winheight(win)) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1476 call assert_equal(30, winwidth(win)) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1477 |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1478 call Stop_shell_in_terminal(buf) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1479 call term_wait(buf) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1480 exe buf . 'bwipe' |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1481 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1482 set termwinsize=0*0 |
13700
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1483 let buf = Run_shell_in_terminal({}) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1484 let win = bufwinid(buf) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1485 call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1486 call Stop_shell_in_terminal(buf) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1487 call term_wait(buf) |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1488 exe buf . 'bwipe' |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1489 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1490 set termwinsize= |
13700
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1491 endfunc |
13829
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1492 |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1493 func Test_terminal_termwinkey() |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1494 call assert_equal(1, winnr('$')) |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1495 let thiswin = win_getid() |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1496 |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1497 let buf = Run_shell_in_terminal({}) |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1498 let termwin = bufwinid(buf) |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1499 set termwinkey=<C-L> |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1500 call feedkeys("\<C-L>w", 'tx') |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1501 call assert_equal(thiswin, win_getid()) |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1502 call feedkeys("\<C-W>w", 'tx') |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1503 |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1504 let job = term_getjob(buf) |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1505 call feedkeys("\<C-L>\<C-C>", 'tx') |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1506 call WaitForAssert({-> assert_equal("dead", job_status(job))}) |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1507 endfunc |
13898
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1508 |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1509 func Test_terminal_out_err() |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1510 if !has('unix') |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1511 return |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1512 endif |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1513 call writefile([ |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1514 \ '#!/bin/sh', |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1515 \ 'echo "this is standard error" >&2', |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1516 \ 'echo "this is standard out" >&1', |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1517 \ ], 'Xechoerrout.sh') |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1518 call setfperm('Xechoerrout.sh', 'rwxrwx---') |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1519 |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1520 let outfile = 'Xtermstdout' |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1521 let buf = term_start(['./Xechoerrout.sh'], {'out_io': 'file', 'out_name': outfile}) |
14141
43efca4c482f
patch 8.1.0088: terminal test for stdout and stderr is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
14139
diff
changeset
|
1522 |
43efca4c482f
patch 8.1.0088: terminal test for stdout and stderr is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
14139
diff
changeset
|
1523 call WaitFor({-> !empty(readfile(outfile)) && !empty(term_getline(buf, 1))}) |
43efca4c482f
patch 8.1.0088: terminal test for stdout and stderr is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
14139
diff
changeset
|
1524 call assert_equal(['this is standard out'], readfile(outfile)) |
13898
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1525 call assert_equal('this is standard error', term_getline(buf, 1)) |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1526 |
13904
b94a9171ec7c
patch 8.0.1823: test for terminal stdout redirection is flaky
Christian Brabandt <cb@256bit.org>
parents:
13898
diff
changeset
|
1527 call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))}) |
13898
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1528 exe buf . 'bwipe' |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1529 call delete('Xechoerrout.sh') |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1530 call delete(outfile) |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1531 endfunc |
13956
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1532 |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1533 func Test_terminwinscroll() |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1534 if !has('unix') |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1535 return |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1536 endif |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1537 |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1538 " Let the terminal output more than 'termwinscroll' lines, some at the start |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1539 " will be dropped. |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1540 exe 'set termwinscroll=' . &lines |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1541 let buf = term_start('/bin/sh') |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1542 for i in range(1, &lines) |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1543 call feedkeys("echo " . i . "\<CR>", 'xt') |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1544 call WaitForAssert({-> assert_match(string(i), term_getline(buf, term_getcursor(buf)[0] - 1))}) |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1545 endfor |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1546 " Go to Terminal-Normal mode to update the buffer. |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1547 call feedkeys("\<C-W>N", 'xt') |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1548 call assert_inrange(&lines, &lines * 110 / 100 + winheight(0), line('$')) |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1549 |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1550 " Every "echo nr" must only appear once |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1551 let lines = getline(1, line('$')) |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1552 for i in range(&lines - len(lines) / 2 + 2, &lines) |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1553 let filtered = filter(copy(lines), {idx, val -> val =~ 'echo ' . i . '\>'}) |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1554 call assert_equal(1, len(filtered), 'for "echo ' . i . '"') |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1555 endfor |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1556 |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1557 exe buf . 'bwipe!' |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1558 endfunc |
14139
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1559 |
14311
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1560 " Resizing the terminal window caused an ml_get error. |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1561 " TODO: This does not reproduce the original problem. |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1562 func Test_terminal_resize() |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1563 set statusline=x |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1564 terminal |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1565 call assert_equal(2, winnr('$')) |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1566 |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1567 " Fill the terminal with text. |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1568 if has('win32') |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1569 call feedkeys("dir\<CR>", 'xt') |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1570 else |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1571 call feedkeys("ls\<CR>", 'xt') |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1572 endif |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1573 " Go to Terminal-Normal mode for a moment. |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1574 call feedkeys("\<C-W>N", 'xt') |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1575 " Open a new window |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1576 call feedkeys("i\<C-W>n", 'xt') |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1577 call assert_equal(3, winnr('$')) |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1578 redraw |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1579 |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1580 close |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1581 call assert_equal(2, winnr('$')) |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1582 call feedkeys("exit\<CR>", 'xt') |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1583 set statusline& |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1584 endfunc |
83b870d9ac4b
patch 8.1.0171: typing CTRL-W n in a terminal window causes ml_get error
Christian Brabandt <cb@256bit.org>
parents:
14141
diff
changeset
|
1585 |
14139
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1586 " must be nearly the last, we can't go back from GUI to terminal |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1587 func Test_zz1_terminal_in_gui() |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1588 if !CanRunGui() |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1589 return |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1590 endif |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1591 |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1592 " Ignore the "failed to create input context" error. |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1593 call test_ignore_error('E285:') |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1594 |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1595 gui -f |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1596 |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1597 call assert_equal(1, winnr('$')) |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1598 let buf = Run_shell_in_terminal({'term_finish': 'close'}) |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1599 call Stop_shell_in_terminal(buf) |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1600 call term_wait(buf) |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1601 |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1602 " closing window wipes out the terminal buffer a with finished job |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1603 call WaitForAssert({-> assert_equal(1, winnr('$'))}) |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1604 call assert_equal("", bufname(buf)) |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1605 |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1606 unlet g:job |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1607 endfunc |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1608 |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1609 func Test_zz2_terminal_guioptions_bang() |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1610 if !has('gui_running') |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1611 return |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1612 endif |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1613 set guioptions+=! |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1614 |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1615 let filename = 'Xtestscript' |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1616 if has('win32') |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1617 let filename .= '.bat' |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1618 let prefix = '' |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1619 let contents = ['@echo off', 'exit %1'] |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1620 else |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1621 let filename .= '.sh' |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1622 let prefix = './' |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1623 let contents = ['#!/bin/sh', 'exit $1'] |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1624 endif |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1625 call writefile(contents, filename) |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1626 call setfperm(filename, 'rwxrwx---') |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1627 |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1628 " Check if v:shell_error is equal to the exit status. |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1629 let exitval = 0 |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1630 execute printf(':!%s%s %d', prefix, filename, exitval) |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1631 call assert_equal(exitval, v:shell_error) |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1632 |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1633 let exitval = 9 |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1634 execute printf(':!%s%s %d', prefix, filename, exitval) |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1635 call assert_equal(exitval, v:shell_error) |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1636 |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1637 set guioptions& |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1638 call delete(filename) |
4d3f6bf86bec
patch 8.1.0087: v:shell_error is always zero when using terminal for "!cmd"
Christian Brabandt <cb@256bit.org>
parents:
14063
diff
changeset
|
1639 endfunc |
14449
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1640 |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1641 func Test_terminal_hidden() |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1642 if !has('unix') |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1643 return |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1644 endif |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1645 term ++hidden cat |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1646 let bnr = bufnr('$') |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1647 call assert_equal('terminal', getbufvar(bnr, '&buftype')) |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1648 exe 'sbuf ' . bnr |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1649 call assert_equal('terminal', &buftype) |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1650 call term_sendkeys(bnr, "asdf\<CR>") |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1651 call WaitForAssert({-> assert_match('asdf', term_getline(bnr, 2))}) |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1652 call term_sendkeys(bnr, "\<C-D>") |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1653 call WaitForAssert({-> assert_equal('finished', term_getstatus(bnr))}) |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1654 bwipe! |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
1655 endfunc |
14459
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
1656 |
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
1657 func Test_terminal_hidden_and_close() |
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
1658 if !has('unix') |
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
1659 return |
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
1660 endif |
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
1661 call assert_equal(1, winnr('$')) |
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
1662 term ++hidden ++close ls |
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
1663 let bnr = bufnr('$') |
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
1664 call assert_equal('terminal', getbufvar(bnr, '&buftype')) |
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
1665 call WaitForAssert({-> assert_false(bufexists(bnr))}) |
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
1666 call assert_equal(1, winnr('$')) |
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
1667 endfunc |
15022
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1668 |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1669 func Test_terminal_does_not_truncate_last_newlines() |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1670 let contents = [ |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1671 \ [ 'One', '', 'X' ], |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1672 \ [ 'Two', '', '' ], |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1673 \ [ 'Three' ] + repeat([''], 30) |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1674 \ ] |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1675 |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1676 for c in contents |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1677 call writefile(c, 'Xfile') |
15027
efd7bace40f4
patch 8.1.0525: terminal test skips part on Windows
Bram Moolenaar <Bram@vim.org>
parents:
15026
diff
changeset
|
1678 if has('win32') |
efd7bace40f4
patch 8.1.0525: terminal test skips part on Windows
Bram Moolenaar <Bram@vim.org>
parents:
15026
diff
changeset
|
1679 term cmd /c type Xfile |
efd7bace40f4
patch 8.1.0525: terminal test skips part on Windows
Bram Moolenaar <Bram@vim.org>
parents:
15026
diff
changeset
|
1680 else |
efd7bace40f4
patch 8.1.0525: terminal test skips part on Windows
Bram Moolenaar <Bram@vim.org>
parents:
15026
diff
changeset
|
1681 term cat Xfile |
efd7bace40f4
patch 8.1.0525: terminal test skips part on Windows
Bram Moolenaar <Bram@vim.org>
parents:
15026
diff
changeset
|
1682 endif |
15022
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1683 let bnr = bufnr('$') |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1684 call assert_equal('terminal', getbufvar(bnr, '&buftype')) |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1685 call WaitForAssert({-> assert_equal('finished', term_getstatus(bnr))}) |
15027
efd7bace40f4
patch 8.1.0525: terminal test skips part on Windows
Bram Moolenaar <Bram@vim.org>
parents:
15026
diff
changeset
|
1686 sleep 100m |
15022
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1687 call assert_equal(c, getline(1, line('$'))) |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1688 quit |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1689 endfor |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1690 |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1691 call delete('Xfile') |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
1692 endfunc |
15186
2b15ee496cbd
patch 8.1.0603: the :stop command is not tested
Bram Moolenaar <Bram@vim.org>
parents:
15027
diff
changeset
|
1693 |
15217
49bc670c3ee9
patch 8.1.0618: term_getjob() does not return v:null as documented
Bram Moolenaar <Bram@vim.org>
parents:
15186
diff
changeset
|
1694 func Test_terminal_no_job() |
49bc670c3ee9
patch 8.1.0618: term_getjob() does not return v:null as documented
Bram Moolenaar <Bram@vim.org>
parents:
15186
diff
changeset
|
1695 let term = term_start('false', {'term_finish': 'close'}) |
49bc670c3ee9
patch 8.1.0618: term_getjob() does not return v:null as documented
Bram Moolenaar <Bram@vim.org>
parents:
15186
diff
changeset
|
1696 call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) }) |
49bc670c3ee9
patch 8.1.0618: term_getjob() does not return v:null as documented
Bram Moolenaar <Bram@vim.org>
parents:
15186
diff
changeset
|
1697 endfunc |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1698 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1699 func Test_term_gettitle() |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1700 if !has('title') || empty(&t_ts) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1701 return |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1702 endif |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1703 " TODO: this fails on Travis |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1704 return |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1705 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1706 " term_gettitle() returns an empty string for a non-terminal buffer |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1707 " or for a non-existing buffer. |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1708 call assert_equal('', term_gettitle(bufnr('%'))) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1709 call assert_equal('', term_gettitle(bufnr('$') + 1)) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1710 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1711 let term = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile']) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1712 call WaitForAssert({-> assert_equal('[No Name] - VIM', term_gettitle(term)) }) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1713 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1714 call term_sendkeys(term, ":e Xfoo\r") |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1715 call WaitForAssert({-> assert_match('Xfoo (.*[/\\]testdir) - VIM', term_gettitle(term)) }) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1716 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1717 call term_sendkeys(term, ":set titlestring=foo\r") |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1718 call WaitForAssert({-> assert_equal('foo', term_gettitle(term)) }) |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1719 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1720 exe term . 'bwipe!' |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
1721 endfunc |
15557
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1722 |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1723 " When drawing the statusline the cursor position may not have been updated |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1724 " yet. |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1725 " 1. create a terminal, make it show 2 lines |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1726 " 2. 0.5 sec later: leave terminal window, execute "i" |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1727 " 3. 0.5 sec later: clear terminal window, now it's 1 line |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1728 " 4. 0.5 sec later: redraw, including statusline (used to trigger bug) |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1729 " 4. 0.5 sec later: should be done, clean up |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1730 func Test_terminal_statusline() |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1731 if !has('unix') |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1732 return |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1733 endif |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1734 set statusline=x |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1735 terminal |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1736 let tbuf = bufnr('') |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1737 call term_sendkeys(tbuf, "clear; echo a; echo b; sleep 1; clear\n") |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1738 call timer_start(500, { tid -> feedkeys("\<C-w>j", 'tx') }) |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1739 call timer_start(1500, { tid -> feedkeys("\<C-l>", 'tx') }) |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1740 au BufLeave * if &buftype == 'terminal' | silent! normal i | endif |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1741 |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1742 sleep 2 |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1743 exe tbuf . 'bwipe!' |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1744 au! BufLeave |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1745 set statusline= |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1746 endfunc |