Mercurial > vim
annotate src/testdir/test_terminal.vim @ 20365:6bcd12791bf1 v8.2.0738
patch 8.2.0738: mouse handling in a terminal window not well tested
Commit: https://github.com/vim/vim/commit/91689ea8ae01acb3daf8ba0ee91acd729af7c84c
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon May 11 22:04:53 2020 +0200
patch 8.2.0738: mouse handling in a terminal window not well tested
Problem: Mouse handling in a terminal window not well tested.
Solution: Add tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6052)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 11 May 2020 22:15:04 +0200 |
parents | a85a3207679f |
children | 42ab4d40e78f |
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 |
17089
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
3 source check.vim |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
4 CheckFeature terminal |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 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
|
7 source screendump.vim |
20365
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
8 source mouse.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() |
16920
8d91579414b8
patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents:
16912
diff
changeset
|
11 let $PROMPT_COMMAND='' |
12062
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
12 |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
13 " 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
|
14 " number. |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
15 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
|
16 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
|
17 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
|
18 else |
17c257dd2438
patch 8.0.1240: MS-Windows: term_start() does not support environment
Christian Brabandt <cb@256bit.org>
parents:
12650
diff
changeset
|
19 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
|
20 endif |
19715
e73167dd8cac
patch 8.2.0414: channel connect_waittime() test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19679
diff
changeset
|
21 let g:test_is_flaky = 1 |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 let termlist = term_list() |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 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
|
25 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
|
26 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 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
|
28 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
|
29 |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
30 let string = string({'job': buf->term_getjob()}) |
11973
aec3df2af27c
patch 8.0.0867: job and channel in a dict value not quoted
Christian Brabandt <cb@256bit.org>
parents:
11957
diff
changeset
|
31 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
|
32 |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
33 return buf |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
34 endfunc |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
35 |
11912
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
36 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
|
37 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
|
38 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
|
39 |
12112
6afc7339c2ad
patch 8.0.0936: mode() returns wrong value for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12106
diff
changeset
|
40 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
|
41 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
|
42 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
|
43 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
|
44 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
|
45 call assert_notmatch('%[^\n]*running]', execute('ls ?')) |
19969
b07672d13ff9
patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
46 call assert_fails('set modifiable', 'E946:') |
12112
6afc7339c2ad
patch 8.0.0936: mode() returns wrong value for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12106
diff
changeset
|
47 |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
48 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
49 call TermWait(buf) |
12112
6afc7339c2ad
patch 8.0.0936: mode() returns wrong value for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12106
diff
changeset
|
50 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
|
51 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
|
52 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
|
53 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
|
54 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
|
55 |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
56 " 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
|
57 close |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
58 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
|
59 |
13835
8e583c52eb44
patch 8.0.1789: BufWinEnter does not work well for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13829
diff
changeset
|
60 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
|
61 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
|
62 endfunc |
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
63 |
18450
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
64 func Test_terminal_TerminalWinOpen() |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
65 au TerminalWinOpen * let b:done = 'yes' |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
66 let buf = Run_shell_in_terminal({}) |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
67 call assert_equal('yes', b:done) |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
68 call StopShellInTerminal(buf) |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
69 " closing window wipes out the terminal buffer with the finished job |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
70 close |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
71 |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
72 if has("unix") |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
73 terminal ++hidden ++open sleep 1 |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
74 sleep 1 |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
75 call assert_fails("echo b:done", 'E121:') |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
76 endif |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
77 |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
78 au! TerminalWinOpen |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
79 endfunc |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
80 |
11912
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
81 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
|
82 let buf = Run_shell_in_terminal({}) |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
83 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
84 call TermWait(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
|
85 |
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
86 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
|
87 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
|
88 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
|
89 undo |
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
90 |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 exe buf . 'bwipe' |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 unlet g:job |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 endfunc |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 |
15951
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
95 func Test_terminal_paste_register() |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
96 let @" = "text to paste" |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
97 |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
98 let buf = Run_shell_in_terminal({}) |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
99 " Wait for the shell to display a prompt |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
100 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
101 |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
102 call feedkeys("echo \<C-W>\"\" \<C-W>\"=37 + 5\<CR>\<CR>", 'xt') |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
103 call WaitForAssert({-> assert_match("echo text to paste 42$", getline(1))}) |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
104 call WaitForAssert({-> assert_equal('text to paste 42', 2->getline())}) |
15951
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
105 |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
106 exe buf . 'bwipe!' |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
107 unlet g:job |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
108 endfunc |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
109 |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
110 func Test_terminal_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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 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
|
116 |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
117 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
|
118 endfunc |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
119 |
12479
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
120 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
|
121 let buf = Run_shell_in_terminal({}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
122 call TermWait(buf) |
12479
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
123 split |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
124 quit! |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
125 call TermWait(buf) |
12479
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
126 sleep 50m |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
127 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
|
128 |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
129 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
|
130 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
|
131 |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
132 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
|
133 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
|
134 endfunc |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
135 |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
136 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
|
137 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
|
138 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
|
139 quit |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
140 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
|
141 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
|
142 endfor |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
143 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
|
144 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
|
145 |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
146 exe 'split ' . buf . 'buf' |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
147 call StopShellInTerminal(buf) |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
148 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
|
149 |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
150 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
|
151 endfunc |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
152 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
153 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
|
154 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
|
155 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
|
156 endfunc |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
157 |
12405
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
158 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
|
159 if has('win32') |
15725
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
160 if !has('conpty') |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
161 return 'cmd /c "cls && color 2 && echo 123"' |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
162 else |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
163 " When clearing twice, extra sequence is not output. |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
164 return 'cmd /c "cls && cls && color 2 && echo 123"' |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
165 endif |
12405
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
166 else |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
167 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
|
168 return "cat Xtext" |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
169 endif |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
170 endfunc |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
171 |
11939
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
172 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
|
173 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
|
174 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
|
175 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
|
176 |
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
|
177 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
|
178 call WaitForAssert({-> assert_equal(0, g:buf)}) |
15725
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
179 unlet g:job |
11939
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
180 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
|
181 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
|
182 endfunc |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
183 |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 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
|
185 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
|
186 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
|
187 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
|
188 call assert_true(len(l) == 0) |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
189 let l = a:buf->term_scrape(1) |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 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
|
191 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
|
192 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
|
193 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
|
194 call assert_equal('#00e000', l[0].fg) |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
195 call assert_equal(0, term_getattr(l[0].attr, 'bold')) |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
196 call assert_equal(0, l[0].attr->term_getattr('italic')) |
15231
42ce33efb23d
patch 8.1.0625: MS-Windows: terminal test fails in white console
Bram Moolenaar <Bram@vim.org>
parents:
15217
diff
changeset
|
197 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
|
198 " 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
|
199 " 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
|
200 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
|
201 else |
15231
42ce33efb23d
patch 8.1.0625: MS-Windows: terminal test fails in white console
Bram Moolenaar <Bram@vim.org>
parents:
15217
diff
changeset
|
202 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
|
203 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
|
204 else |
42ce33efb23d
patch 8.1.0625: MS-Windows: terminal test fails in white console
Bram Moolenaar <Bram@vim.org>
parents:
15217
diff
changeset
|
205 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
|
206 endif |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 endif |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 |
11923
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
209 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
|
210 call assert_equal('', l) |
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
211 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
|
212 call assert_equal('', l) |
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
213 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
|
214 call assert_equal('', l) |
11906
7df4afab67c7
patch 8.0.0833: terminal test fails
Christian Brabandt <cb@256bit.org>
parents:
11872
diff
changeset
|
215 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
|
216 call assert_equal('123', l) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
217 endfunc |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
218 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
219 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
|
220 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
|
221 let buf = term_start(cmd) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 let termlist = term_list() |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 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
|
225 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
|
226 |
11872
ff8122091ec6
patch 8.0.0816: crash when using invalid buffer number
Christian Brabandt <cb@256bit.org>
parents:
11846
diff
changeset
|
227 " 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
|
228 call term_wait(1234) |
ff8122091ec6
patch 8.0.0816: crash when using invalid buffer number
Christian Brabandt <cb@256bit.org>
parents:
11846
diff
changeset
|
229 |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
230 call TermWait(buf) |
12349
bb67396239a4
patch 8.0.1054: terminal test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12345
diff
changeset
|
231 " 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
|
232 " "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
|
233 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
|
234 call Check_123(buf) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
236 " 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
|
237 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
|
238 call WaitForAssert({-> assert_equal("dead", job_status(job))}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
239 call TermWait(buf) |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
240 call Check_123(buf) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
241 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
242 exe buf . 'bwipe' |
11872
ff8122091ec6
patch 8.0.0816: crash when using invalid buffer number
Christian Brabandt <cb@256bit.org>
parents:
11846
diff
changeset
|
243 call delete('Xtext') |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
244 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
|
245 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
246 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
|
247 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
|
248 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
|
249 " 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
|
250 " multibyte characters. |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
251 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
|
252 call term_sendkeys(buf, "type Xtext\<CR>") |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
253 eval buf->term_sendkeys("exit\<CR>") |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
254 let line = 4 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
255 else |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
256 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
|
257 let line = 1 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
258 endif |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
259 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
260 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
|
261 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
|
262 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
|
263 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
|
264 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
|
265 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
|
266 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
|
267 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
|
268 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
|
269 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
|
270 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
|
271 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
|
272 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
273 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
|
274 call WaitForAssert({-> assert_equal("dead", job_status(job))}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
275 call TermWait(buf) |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
276 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
277 exe buf . 'bwipe' |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
278 call delete('Xtext') |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
279 endfunc |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
280 |
12011
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
281 func Test_terminal_scroll() |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
282 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
|
283 if has('win32') |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
284 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
|
285 else |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
286 let cmd = "cat Xtext" |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
287 endif |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
288 let buf = term_start(cmd) |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
289 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
290 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
|
291 call WaitForAssert({-> assert_equal("dead", job_status(job))}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
292 call TermWait(buf) |
12011
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
293 |
19781
cadb4c1bee6e
patch 8.2.0447: terminal scroll tests fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19770
diff
changeset
|
294 " wait until the scrolling stops |
cadb4c1bee6e
patch 8.2.0447: terminal scroll tests fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19770
diff
changeset
|
295 while 1 |
cadb4c1bee6e
patch 8.2.0447: terminal scroll tests fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19770
diff
changeset
|
296 let scrolled = buf->term_getscrolled() |
cadb4c1bee6e
patch 8.2.0447: terminal scroll tests fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19770
diff
changeset
|
297 sleep 20m |
cadb4c1bee6e
patch 8.2.0447: terminal scroll tests fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19770
diff
changeset
|
298 if scrolled == buf->term_getscrolled() |
cadb4c1bee6e
patch 8.2.0447: terminal scroll tests fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19770
diff
changeset
|
299 break |
cadb4c1bee6e
patch 8.2.0447: terminal scroll tests fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19770
diff
changeset
|
300 endif |
cadb4c1bee6e
patch 8.2.0447: terminal scroll tests fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19770
diff
changeset
|
301 endwhile |
cadb4c1bee6e
patch 8.2.0447: terminal scroll tests fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19770
diff
changeset
|
302 |
12011
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
303 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
|
304 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
|
305 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
|
306 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
|
307 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
|
308 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
|
309 |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
310 exe buf . 'bwipe' |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
311 call delete('Xtext') |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
312 endfunc |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
313 |
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
|
314 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
|
315 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
|
316 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
|
317 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
|
318 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
|
319 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
|
320 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
|
321 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
|
322 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
|
323 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
|
324 " 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
|
325 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
|
326 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
|
327 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
|
328 |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
329 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
330 call TermWait(buf) |
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
|
331 exe buf . 'bwipe' |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
332 set termwinscroll& |
15826
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
333 call delete('Xtext') |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
334 endfunc |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
335 |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
336 func Test_terminal_postponed_scrollback() |
18041
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
337 " tail -f only works on Unix |
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
338 CheckUnix |
15826
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
339 |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
340 call writefile(range(50), 'Xtext') |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
341 call writefile([ |
15836
fe7e94f39e7f
patch 8.1.0925: terminal scrollback test still still flaky
Bram Moolenaar <Bram@vim.org>
parents:
15834
diff
changeset
|
342 \ 'set shell=/bin/sh noruler', |
15826
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
343 \ 'terminal', |
15836
fe7e94f39e7f
patch 8.1.0925: terminal scrollback test still still flaky
Bram Moolenaar <Bram@vim.org>
parents:
15834
diff
changeset
|
344 \ 'sleep 200m', |
15826
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
345 \ 'call feedkeys("tail -n 100 -f Xtext\<CR>", "xt")', |
15836
fe7e94f39e7f
patch 8.1.0925: terminal scrollback test still still flaky
Bram Moolenaar <Bram@vim.org>
parents:
15834
diff
changeset
|
346 \ 'sleep 100m', |
15826
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
347 \ 'call feedkeys("\<C-W>N", "xt")', |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
348 \ ], 'XTest_postponed') |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
349 let buf = RunVimInTerminal('-S XTest_postponed', {}) |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
350 " Check that the Xtext lines are displayed and in Terminal-Normal mode |
19667
a088571e1d9d
patch 8.2.0390: terminal postponed scrollback test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
351 call VerifyScreenDump(buf, 'Test_terminal_scrollback_1', {}) |
15826
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
352 |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
353 silent !echo 'one more line' >>Xtext |
16318
3019a0744c46
patch 8.1.1164: gettitle test is failing when server name differs
Bram Moolenaar <Bram@vim.org>
parents:
16314
diff
changeset
|
354 " Screen will not change, move cursor to get a different dump |
15826
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
355 call term_sendkeys(buf, "k") |
19667
a088571e1d9d
patch 8.2.0390: terminal postponed scrollback test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
356 call VerifyScreenDump(buf, 'Test_terminal_scrollback_2', {}) |
15826
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
357 |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
358 " Back to Terminal-Job mode, text will scroll and show the extra line. |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
359 call term_sendkeys(buf, "a") |
19667
a088571e1d9d
patch 8.2.0390: terminal postponed scrollback test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
360 call VerifyScreenDump(buf, 'Test_terminal_scrollback_3', {}) |
15826
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
361 |
19667
a088571e1d9d
patch 8.2.0390: terminal postponed scrollback test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
362 " stop "tail -f" |
15826
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
363 call term_sendkeys(buf, "\<C-C>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
364 call TermWait(buf, 25) |
19667
a088571e1d9d
patch 8.2.0390: terminal postponed scrollback test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
365 " stop shell |
15826
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
366 call term_sendkeys(buf, "exit\<CR>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
367 call TermWait(buf, 50) |
19667
a088571e1d9d
patch 8.2.0390: terminal postponed scrollback test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
368 " close terminal window |
19633
dd3e5533a7d2
patch 8.2.0373: type of term_sendkeys() is unknown
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
369 let tsk_ret = term_sendkeys(buf, ":q\<CR>") |
dd3e5533a7d2
patch 8.2.0373: type of term_sendkeys() is unknown
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
370 |
dd3e5533a7d2
patch 8.2.0373: type of term_sendkeys() is unknown
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
371 " check type of term_sendkeys() return value |
dd3e5533a7d2
patch 8.2.0373: type of term_sendkeys() is unknown
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
372 echo type(tsk_ret) |
dd3e5533a7d2
patch 8.2.0373: type of term_sendkeys() is unknown
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
373 |
15826
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
374 call StopVimInTerminal(buf) |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
375 call delete('XTest_postponed') |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
376 call delete('Xtext') |
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
|
377 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
|
378 |
15828
8f112782a2e9
patch 8.1.0921: terminal test sometimes fails; using memory after free
Bram Moolenaar <Bram@vim.org>
parents:
15826
diff
changeset
|
379 " Run diff on two dumps with different size. |
8f112782a2e9
patch 8.1.0921: terminal test sometimes fails; using memory after free
Bram Moolenaar <Bram@vim.org>
parents:
15826
diff
changeset
|
380 func Test_terminal_dumpdiff_size() |
8f112782a2e9
patch 8.1.0921: terminal test sometimes fails; using memory after free
Bram Moolenaar <Bram@vim.org>
parents:
15826
diff
changeset
|
381 call assert_equal(1, winnr('$')) |
8f112782a2e9
patch 8.1.0921: terminal test sometimes fails; using memory after free
Bram Moolenaar <Bram@vim.org>
parents:
15826
diff
changeset
|
382 call term_dumpdiff('dumps/Test_incsearch_search_01.dump', 'dumps/Test_popup_command_01.dump') |
8f112782a2e9
patch 8.1.0921: terminal test sometimes fails; using memory after free
Bram Moolenaar <Bram@vim.org>
parents:
15826
diff
changeset
|
383 call assert_equal(2, winnr('$')) |
8f112782a2e9
patch 8.1.0921: terminal test sometimes fails; using memory after free
Bram Moolenaar <Bram@vim.org>
parents:
15826
diff
changeset
|
384 call assert_match('Test_incsearch_search_01.dump', getline(10)) |
8f112782a2e9
patch 8.1.0921: terminal test sometimes fails; using memory after free
Bram Moolenaar <Bram@vim.org>
parents:
15826
diff
changeset
|
385 call assert_match(' +++++$', getline(11)) |
8f112782a2e9
patch 8.1.0921: terminal test sometimes fails; using memory after free
Bram Moolenaar <Bram@vim.org>
parents:
15826
diff
changeset
|
386 call assert_match('Test_popup_command_01.dump', getline(31)) |
8f112782a2e9
patch 8.1.0921: terminal test sometimes fails; using memory after free
Bram Moolenaar <Bram@vim.org>
parents:
15826
diff
changeset
|
387 call assert_equal(repeat('+', 75), getline(30)) |
8f112782a2e9
patch 8.1.0921: terminal test sometimes fails; using memory after free
Bram Moolenaar <Bram@vim.org>
parents:
15826
diff
changeset
|
388 quit |
8f112782a2e9
patch 8.1.0921: terminal test sometimes fails; using memory after free
Bram Moolenaar <Bram@vim.org>
parents:
15826
diff
changeset
|
389 endfunc |
8f112782a2e9
patch 8.1.0921: terminal test sometimes fails; using memory after free
Bram Moolenaar <Bram@vim.org>
parents:
15826
diff
changeset
|
390 |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
391 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
|
392 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
|
393 |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
394 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
|
395 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
|
396 bwipe! |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
397 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
|
398 |
12056
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
399 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
|
400 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
401 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
402 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
|
403 |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
404 vsplit |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
405 exe 'terminal ++rows=5 ++cols=33 ' . cmd |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
406 call assert_equal([5, 33], ''->term_getsize()) |
13678
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
407 |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
408 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
|
409 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
|
410 |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
411 eval ''->term_setsize(0, 35) |
13678
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
412 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
|
413 |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
414 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
|
415 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
|
416 |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
417 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
|
418 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
|
419 |
12056
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
420 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
|
421 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
422 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
423 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
|
424 |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
425 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
|
426 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
|
427 bwipe! |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
428 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
|
429 |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
430 eval cmd->term_start({'vertical': 1, 'term_cols': 26}) |
12056
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
431 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
432 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
433 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
|
434 |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
435 split |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
436 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
|
437 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
|
438 bwipe! |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
439 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
|
440 |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
441 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
|
442 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
443 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
444 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
|
445 |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
446 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
|
447 endfunc |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
448 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
449 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
|
450 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
|
451 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
|
452 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
453 split dummy |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
454 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
|
455 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
|
456 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
457 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
458 split dummy |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
459 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
|
460 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
|
461 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
462 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
463 split dummy |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
464 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
|
465 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
|
466 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
|
467 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
|
468 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
|
469 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
470 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
471 split dummy |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
472 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
|
473 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
|
474 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
|
475 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
476 |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
477 split dummy |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
478 bwipe! |
12343
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
479 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
|
480 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
|
481 |
12903
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
482 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
|
483 if s:python != '' |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
484 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
|
485 " 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
|
486 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
|
487 else |
12062
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
488 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
|
489 let waittime = 2000 |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
490 if has('win32') |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
491 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
|
492 else |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
493 let cmd = 'sleep 1' |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
494 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
|
495 endif |
12903
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
496 return [cmd, waittime] |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
497 endfunc |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
498 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
499 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
|
500 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
|
501 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
502 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
|
503 |
13476
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
504 " 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
|
505 terminal |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
506 let buf = bufnr('%') |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
507 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
|
508 " 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
|
509 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
510 call StopShellInTerminal(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
|
511 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
|
512 |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
513 " 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
|
514 terminal ++noclose |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
515 let buf = bufnr('%') |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
516 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
|
517 " 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
|
518 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
519 call StopShellInTerminal(buf) |
13476
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
520 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
|
521 quit |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
522 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
|
523 |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
524 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
|
525 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
|
526 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
|
527 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
|
528 |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
529 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
|
530 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
|
531 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
|
532 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
|
533 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
|
534 |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
535 exe 'terminal ++open ' . cmd |
12271
e4aa68825575
patch 8.0.1015: missing update to terminal test
Christian Brabandt <cb@256bit.org>
parents:
12263
diff
changeset
|
536 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
|
537 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
|
538 bwipe |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
539 |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
540 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
|
541 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
|
542 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
|
543 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
|
544 |
12064
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
545 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
|
546 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
|
547 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
|
548 bwipe |
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
549 |
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
550 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
|
551 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
|
552 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
|
553 bwipe |
12072
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
554 |
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
555 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
|
556 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
|
557 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
|
558 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
|
559 |
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
560 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
|
561 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
|
562 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
|
563 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
|
564 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
|
565 endfunc |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
566 |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
567 func Test_terminal_cwd() |
18473
0eeaa9a6e4e7
patch 8.1.2230: MS-Windows: testing external commands can be improved
Bram Moolenaar <Bram@vim.org>
parents:
18450
diff
changeset
|
568 if has('win32') |
0eeaa9a6e4e7
patch 8.1.2230: MS-Windows: testing external commands can be improved
Bram Moolenaar <Bram@vim.org>
parents:
18450
diff
changeset
|
569 let cmd = 'cmd /c cd' |
0eeaa9a6e4e7
patch 8.1.2230: MS-Windows: testing external commands can be improved
Bram Moolenaar <Bram@vim.org>
parents:
18450
diff
changeset
|
570 else |
0eeaa9a6e4e7
patch 8.1.2230: MS-Windows: testing external commands can be improved
Bram Moolenaar <Bram@vim.org>
parents:
18450
diff
changeset
|
571 CheckExecutable pwd |
0eeaa9a6e4e7
patch 8.1.2230: MS-Windows: testing external commands can be improved
Bram Moolenaar <Bram@vim.org>
parents:
18450
diff
changeset
|
572 let cmd = 'pwd' |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
573 endif |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
574 call mkdir('Xdir') |
18473
0eeaa9a6e4e7
patch 8.1.2230: MS-Windows: testing external commands can be improved
Bram Moolenaar <Bram@vim.org>
parents:
18450
diff
changeset
|
575 let buf = term_start(cmd, {'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
|
576 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
|
577 |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
578 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
|
579 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
|
580 endfunc |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
581 |
14948
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
582 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
|
583 " 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
|
584 " 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
|
585 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
|
586 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
|
587 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
|
588 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
|
589 |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
590 " 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
|
591 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
|
592 |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
593 " 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
|
594 " Skip this for root, it will be accessible anyway. |
18277
f6dcf7eabd26
patch 8.1.2133: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
18170
diff
changeset
|
595 if !IsRoot() |
14995
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
596 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
|
597 " 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
|
598 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
|
599 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
|
600 return |
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
601 endif |
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
602 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
|
603 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
|
604 endif |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
605 endfunc |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
606 |
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
|
607 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
|
608 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
|
609 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
|
610 endif |
14063
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
611 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
|
612 endfunc |
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
613 |
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
614 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
|
615 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
|
616 endfunc |
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
617 |
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
618 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
|
619 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
|
620 " 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
|
621 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
|
622 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
|
623 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
|
624 else |
14063
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
625 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
|
626 endif |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
627 call TermWait(buf) |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
628 call StopShellInTerminal(buf) |
14063
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
629 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
|
630 |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
631 exe buf . 'bwipe' |
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
632 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
|
633 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
|
634 |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
635 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
|
636 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
|
637 " 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
|
638 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
|
639 if has('win32') |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
640 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
|
641 else |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
642 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
|
643 endif |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
644 eval buf->TermWait() |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
645 call StopShellInTerminal(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
|
646 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
|
647 |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
648 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
|
649 endfunc |
12086
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
650 |
12096
0a61213afdd2
patch 8.0.0928: MS-Windows: passing arglist to job has escaping problems
Christian Brabandt <cb@256bit.org>
parents:
12086
diff
changeset
|
651 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
|
652 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
|
653 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
|
654 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
|
655 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
|
656 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
|
657 |
71e10b81226d
patch 8.0.0957: a terminal job can deadlock when sending many keys
Christian Brabandt <cb@256bit.org>
parents:
12126
diff
changeset
|
658 func Test_terminal_noblock() |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
659 let buf = term_start(&shell) |
19770
4e843fc8772f
patch 8.2.0441: terminal noblock test is still failing on BSD
Bram Moolenaar <Bram@vim.org>
parents:
19768
diff
changeset
|
660 let wait_time = 5000 |
4e843fc8772f
patch 8.2.0441: terminal noblock test is still failing on BSD
Bram Moolenaar <Bram@vim.org>
parents:
19768
diff
changeset
|
661 let letters = 'abcdefghijklmnopqrstuvwxyz' |
15677
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
662 if has('bsd') || has('mac') || has('sun') |
12339
040ec95b8647
patch 8.0.1049: shell on Mac can't handle long text
Christian Brabandt <cb@256bit.org>
parents:
12313
diff
changeset
|
663 " The shell or something else has a problem dealing with more than 1000 |
19770
4e843fc8772f
patch 8.2.0441: terminal noblock test is still failing on BSD
Bram Moolenaar <Bram@vim.org>
parents:
19768
diff
changeset
|
664 " characters at the same time. It's very slow too. |
12339
040ec95b8647
patch 8.0.1049: shell on Mac can't handle long text
Christian Brabandt <cb@256bit.org>
parents:
12313
diff
changeset
|
665 let len = 1000 |
19768
0d1088e3c53f
patch 8.2.0440: terminal noblock test is still very flaky on BSD
Bram Moolenaar <Bram@vim.org>
parents:
19764
diff
changeset
|
666 let wait_time = 15000 |
19770
4e843fc8772f
patch 8.2.0441: terminal noblock test is still failing on BSD
Bram Moolenaar <Bram@vim.org>
parents:
19768
diff
changeset
|
667 let letters = 'abcdefghijklm' |
15725
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
668 " NPFS is used in Windows, nonblocking mode does not work properly. |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
669 elseif has('win32') |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
670 let len = 1 |
12339
040ec95b8647
patch 8.0.1049: shell on Mac can't handle long text
Christian Brabandt <cb@256bit.org>
parents:
12313
diff
changeset
|
671 else |
040ec95b8647
patch 8.0.1049: shell on Mac can't handle long text
Christian Brabandt <cb@256bit.org>
parents:
12313
diff
changeset
|
672 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
|
673 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
|
674 |
19768
0d1088e3c53f
patch 8.2.0440: terminal noblock test is still very flaky on BSD
Bram Moolenaar <Bram@vim.org>
parents:
19764
diff
changeset
|
675 " Send a lot of text lines, should be buffered properly. |
19770
4e843fc8772f
patch 8.2.0441: terminal noblock test is still failing on BSD
Bram Moolenaar <Bram@vim.org>
parents:
19768
diff
changeset
|
676 for c in split(letters, '\zs') |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
677 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
|
678 endfor |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
679 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
|
680 |
65cff399750b
patch 8.0.0979: terminal noblock test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12196
diff
changeset
|
681 " 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
|
682 " 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
|
683 let lnum = term_getsize(buf)[0] - 1 |
19768
0d1088e3c53f
patch 8.2.0440: terminal noblock test is still very flaky on BSD
Bram Moolenaar <Bram@vim.org>
parents:
19764
diff
changeset
|
684 call WaitForAssert({-> assert_match('done', term_getline(buf, lnum - 1) .. '//' .. term_getline(buf, lnum))}, wait_time) |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
685 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
|
686 if line !~ 'done' |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
687 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
|
688 endif |
65cff399750b
patch 8.0.0979: terminal noblock test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12196
diff
changeset
|
689 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
|
690 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
691 let g:job = term_getjob(buf) |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
692 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
693 call TermWait(buf) |
12166
f512c507b061
patch 8.0.0963: terminal test fails on MacOS
Christian Brabandt <cb@256bit.org>
parents:
12156
diff
changeset
|
694 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
|
695 bwipe |
71e10b81226d
patch 8.0.0957: a terminal job can deadlock when sending many keys
Christian Brabandt <cb@256bit.org>
parents:
12126
diff
changeset
|
696 endfunc |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
697 |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
698 func Test_terminal_write_stdin() |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
699 " TODO: enable once writing to stdin works on MS-Windows |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
700 CheckNotMSWindows |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
701 CheckExecutable wc |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
702 |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
703 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
|
704 %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
|
705 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
|
706 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
|
707 call assert_equal(['3', '3', '14'], nrs) |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
708 %bwipe! |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
709 |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
710 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
|
711 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
|
712 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
|
713 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
|
714 call assert_equal(['2', '2', '10'], nrs) |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
715 %bwipe! |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
716 endfunc |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
717 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
718 func Test_terminal_eof_arg() |
20219
820f24dc1e3e
patch 8.2.0665: wrongly assuming Python executable is called "python"
Bram Moolenaar <Bram@vim.org>
parents:
20178
diff
changeset
|
719 call CheckPython(s:python) |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
720 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
721 call setline(1, ['print("hello")']) |
20219
820f24dc1e3e
patch 8.2.0665: wrongly assuming Python executable is called "python"
Bram Moolenaar <Bram@vim.org>
parents:
20178
diff
changeset
|
722 exe '1term ++eof=exit(123) ' .. s:python |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
723 " MS-Windows echoes the input, Unix doesn't. |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
724 if has('win32') |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
725 call WaitFor({-> getline('$') =~ 'exit(123)'}) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
726 call assert_equal('hello', getline(line('$') - 1)) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
727 else |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
728 call WaitFor({-> getline('$') =~ 'hello'}) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
729 call assert_equal('hello', getline('$')) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
730 endif |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
731 call assert_equal(123, bufnr()->term_getjob()->job_info().exitval) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
732 %bwipe! |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
733 endfunc |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
734 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
735 func Test_terminal_eof_arg_win32_ctrl_z() |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
736 CheckMSWindows |
20219
820f24dc1e3e
patch 8.2.0665: wrongly assuming Python executable is called "python"
Bram Moolenaar <Bram@vim.org>
parents:
20178
diff
changeset
|
737 call CheckPython(s:python) |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
738 |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
739 call setline(1, ['print("hello")']) |
20219
820f24dc1e3e
patch 8.2.0665: wrongly assuming Python executable is called "python"
Bram Moolenaar <Bram@vim.org>
parents:
20178
diff
changeset
|
740 exe '1term ++eof=<C-Z> ' .. s:python |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
741 call WaitForAssert({-> assert_match('\^Z', getline(line('$') - 1))}) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
742 call assert_match('\^Z', getline(line('$') - 1)) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
743 %bwipe! |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
744 endfunc |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
745 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
746 func Test_terminal_duplicate_eof_arg() |
20219
820f24dc1e3e
patch 8.2.0665: wrongly assuming Python executable is called "python"
Bram Moolenaar <Bram@vim.org>
parents:
20178
diff
changeset
|
747 call CheckPython(s:python) |
12313
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
748 |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
749 " Check the last specified ++eof arg is used and should not memory leak. |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
750 new |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
751 call setline(1, ['print("hello")']) |
20219
820f24dc1e3e
patch 8.2.0665: wrongly assuming Python executable is called "python"
Bram Moolenaar <Bram@vim.org>
parents:
20178
diff
changeset
|
752 exe '1term ++eof=<C-Z> ++eof=exit(123) ' .. s:python |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
753 " MS-Windows echoes the input, Unix doesn't. |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
754 if has('win32') |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
755 call WaitFor({-> getline('$') =~ 'exit(123)'}) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
756 call assert_equal('hello', getline(line('$') - 1)) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
757 else |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
758 call WaitFor({-> getline('$') =~ 'hello'}) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
759 call assert_equal('hello', 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
|
760 endif |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
761 call assert_equal(123, bufnr()->term_getjob()->job_info().exitval) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
762 %bwipe! |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
763 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
|
764 |
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
765 func Test_terminal_no_cmd() |
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
766 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
|
767 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
|
768 |
12389
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
769 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
|
770 call assert_notequal('', pty) |
15583
3137345451a4
patch 8.1.0799: calling deleted function; test doesn't work on Mac
Bram Moolenaar <Bram@vim.org>
parents:
15577
diff
changeset
|
771 if has('gui_running') && !has('win32') |
3137345451a4
patch 8.1.0799: calling deleted function; test doesn't work on Mac
Bram Moolenaar <Bram@vim.org>
parents:
15577
diff
changeset
|
772 " In the GUI job_start() doesn't work, it does not read from the pty. |
3137345451a4
patch 8.1.0799: calling deleted function; test doesn't work on Mac
Bram Moolenaar <Bram@vim.org>
parents:
15577
diff
changeset
|
773 call system('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
|
774 else |
15583
3137345451a4
patch 8.1.0799: calling deleted function; test doesn't work on Mac
Bram Moolenaar <Bram@vim.org>
parents:
15577
diff
changeset
|
775 " Otherwise using a job works on all systems. |
3137345451a4
patch 8.1.0799: calling deleted function; test doesn't work on Mac
Bram Moolenaar <Bram@vim.org>
parents:
15577
diff
changeset
|
776 call job_start([&shell, &shellcmdflag, '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
|
777 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
|
778 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
|
779 |
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
|
780 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
|
781 endfunc |
12343
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
782 |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
783 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
|
784 " this file name only works on Unix |
18041
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
785 CheckUnix |
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
786 |
12343
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
787 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
|
788 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
|
789 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
|
790 call WaitForAssert({-> assert_match('quoted"file', term_getline('', 1))}) |
19493
74add0046945
patch 8.2.0304: terminal test if failing on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
791 " make sure the job has finished |
74add0046945
patch 8.2.0304: terminal test if failing on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19457
diff
changeset
|
792 call WaitForAssert({-> assert_match('finish', term_getstatus(bufnr()))}) |
12343
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
793 |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
794 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
|
795 bwipe |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
796 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
|
797 |
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
|
798 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
|
799 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
|
800 \ "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
|
801 \ "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
|
802 \ "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
|
803 \ "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
|
804 \ "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
|
805 \ "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
|
806 \ })', '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
|
807 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
|
808 \ "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
|
809 \ })', '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
|
810 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
|
811 \ "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
|
812 \ })', '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
|
813 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
|
814 |
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
|
815 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
|
816 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
|
817 let buf = term_start(cmd, {'out_io': 'file', 'out_name': 'Xfile'}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
818 call TermWait(buf) |
15725
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
819 " ConPTY may precede escape sequence. There are things that are not so. |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
820 if !has('conpty') |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
821 call WaitForAssert({-> assert_notequal(0, len(readfile("Xfile")))}) |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
822 call assert_match('123', readfile('Xfile')[0]) |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
823 endif |
13860
7f892e37b017
patch 8.0.1801: MS-Windows: redirecting terminal output does not work
Christian Brabandt <cb@256bit.org>
parents:
13835
diff
changeset
|
824 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
|
825 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
|
826 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
|
827 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
|
828 |
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
|
829 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
|
830 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
|
831 let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xfile'}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
832 call TermWait(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
|
833 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
|
834 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
|
835 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
|
836 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
|
837 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
|
838 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
|
839 endfunc |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
840 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
841 func TerminalTmap(remap) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
842 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
|
843 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
|
844 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
845 if a:remap |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
846 tmap 123 456 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
847 else |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
848 tnoremap 123 456 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
849 endif |
12983
7a9c4a8b1ceb
patch 8.0.1367: terminal test hangs, executing abcde
Christian Brabandt <cb@256bit.org>
parents:
12907
diff
changeset
|
850 " 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
|
851 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
|
852 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
|
853 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
|
854 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
|
855 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
|
856 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
|
857 if a:remap |
12983
7a9c4a8b1ceb
patch 8.0.1367: terminal test hangs, executing abcde
Christian Brabandt <cb@256bit.org>
parents:
12907
diff
changeset
|
858 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
|
859 else |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
860 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
|
861 endif |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
862 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
863 call term_sendkeys(buf, "\r") |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
864 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
865 call TermWait(buf) |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
866 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
867 tunmap 123 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
868 tunmap 456 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
869 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
|
870 close |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
871 unlet g:job |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
872 endfunc |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
873 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
874 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
|
875 call TerminalTmap(1) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
876 call TerminalTmap(0) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
877 endfunc |
12648
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
878 |
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
879 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
|
880 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
|
881 wall |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
882 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
883 call TermWait(buf) |
12648
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
884 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
|
885 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
|
886 endfunc |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
887 |
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
|
888 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
|
889 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
|
890 call assert_fails('wqall', 'E948') |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
891 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
892 call TermWait(buf) |
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
|
893 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
|
894 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
|
895 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
|
896 |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
897 func Test_terminal_composing_unicode() |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
898 let save_enc = &encoding |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
899 set encoding=utf-8 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
900 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
901 if has('win32') |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
902 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
|
903 let lnum = [3, 6, 9] |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
904 else |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
905 let cmd = &shell |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
906 let lnum = [1, 3, 5] |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
907 endif |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
908 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
909 enew |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
910 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
|
911 let g:job = term_getjob(buf) |
20263
a85a3207679f
patch 8.2.0687: some tests do not work on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
20219
diff
changeset
|
912 call WaitFor({-> term_getline(buf, 1) !=# ''}, 1000) |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
913 |
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
|
914 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
|
915 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
|
916 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
|
917 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
|
918 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
|
919 |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
920 " ascii + composing |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
921 let txt = "a\u0308bc" |
20263
a85a3207679f
patch 8.2.0687: some tests do not work on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
20219
diff
changeset
|
922 call term_sendkeys(buf, "echo " . txt) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
923 call TermWait(buf, 25) |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
924 call assert_match("echo " . txt, term_getline(buf, lnum[0])) |
20263
a85a3207679f
patch 8.2.0687: some tests do not work on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
20219
diff
changeset
|
925 call term_sendkeys(buf, "\<cr>") |
a85a3207679f
patch 8.2.0687: some tests do not work on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
20219
diff
changeset
|
926 call WaitForAssert({-> assert_equal(txt, term_getline(buf, lnum[0] + 1))}, 1000) |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
927 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
|
928 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
|
929 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
|
930 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
|
931 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
932 " multibyte + composing |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
933 let txt = "\u304b\u3099\u304e\u304f\u3099\u3052\u3053\u3099" |
20263
a85a3207679f
patch 8.2.0687: some tests do not work on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
20219
diff
changeset
|
934 call term_sendkeys(buf, "echo " . txt) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
935 call TermWait(buf, 25) |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
936 call assert_match("echo " . txt, term_getline(buf, lnum[1])) |
20263
a85a3207679f
patch 8.2.0687: some tests do not work on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
20219
diff
changeset
|
937 call term_sendkeys(buf, "\<cr>") |
a85a3207679f
patch 8.2.0687: some tests do not work on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
20219
diff
changeset
|
938 call WaitForAssert({-> assert_equal(txt, term_getline(buf, lnum[1] + 1))}, 1000) |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
939 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
|
940 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
|
941 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
|
942 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
|
943 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
|
944 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
|
945 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
946 " \u00a0 + composing |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
947 let txt = "abc\u00a0\u0308" |
20263
a85a3207679f
patch 8.2.0687: some tests do not work on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
20219
diff
changeset
|
948 call term_sendkeys(buf, "echo " . txt) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
949 call TermWait(buf, 25) |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
950 call assert_match("echo " . txt, term_getline(buf, lnum[2])) |
20263
a85a3207679f
patch 8.2.0687: some tests do not work on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
20219
diff
changeset
|
951 call term_sendkeys(buf, "\<cr>") |
a85a3207679f
patch 8.2.0687: some tests do not work on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
20219
diff
changeset
|
952 call WaitForAssert({-> assert_equal(txt, term_getline(buf, lnum[2] + 1))}, 1000) |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
953 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
|
954 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
|
955 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
956 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
|
957 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
|
958 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
|
959 unlet g:job |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
960 let &encoding = save_enc |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
961 endfunc |
12903
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
962 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
963 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
|
964 fun Nop() |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
965 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
|
966 endfun |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
967 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
968 aug repro |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
969 au! |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
970 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
|
971 aug END |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
972 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
973 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
|
974 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
975 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
|
976 new |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
977 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
|
978 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
|
979 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
|
980 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
|
981 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
|
982 bwipe! |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
983 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
984 unlet s:called |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
985 au! repro |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
986 delfunc Nop |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
987 endfunc |
13109
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
988 |
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
989 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
|
990 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
|
991 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
|
992 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
|
993 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
|
994 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
|
995 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
|
996 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
|
997 call assert_fails(cmd, 'E474') |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
998 let cmd = "call term_start('', {'term_name' : []})" |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
999 call assert_fails(cmd, 'E475') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1000 let cmd = "call term_start('', {'term_finish' : 'axby'})" |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1001 call assert_fails(cmd, 'E475') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1002 let cmd = "call term_start('', {'eof_chars' : []})" |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1003 call assert_fails(cmd, 'E475:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1004 let cmd = "call term_start('', {'term_kill' : []})" |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1005 call assert_fails(cmd, 'E475:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1006 let cmd = "call term_start('', {'tty_type' : []})" |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1007 call assert_fails(cmd, 'E475:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1008 let cmd = "call term_start('', {'tty_type' : 'abc'})" |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1009 call assert_fails(cmd, 'E475:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1010 let cmd = "call term_start('', {'term_highlight' : []})" |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1011 call assert_fails(cmd, 'E475:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1012 if has('gui') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1013 let cmd = "call term_start('', {'ansi_colors' : 'abc'})" |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1014 call assert_fails(cmd, 'E475:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1015 let cmd = "call term_start('', {'ansi_colors' : [[]]})" |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1016 call assert_fails(cmd, 'E730:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1017 let cmd = "call term_start('', {'ansi_colors' : repeat(['blue'], 18)})" |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1018 call assert_fails(cmd, 'E475:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1019 endif |
13109
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
1020 endfunc |
13132
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
1021 |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
1022 func Test_terminal_response_to_control_sequence() |
18041
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
1023 CheckUnix |
13132
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
1024 |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
1025 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
|
1026 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
|
1027 |
13543
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
1028 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
|
1029 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
|
1030 |
13543
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
1031 " 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
|
1032 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
|
1033 |
36c503100cb3
patch 8.0.1452: terminal test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
13132
diff
changeset
|
1034 " 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
|
1035 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
|
1036 |
13543
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
1037 " 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
|
1038 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
|
1039 |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1040 call StopShellInTerminal(buf) |
13132
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
1041 exe buf . 'bwipe' |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
1042 unlet g:job |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
1043 endfunc |
13438
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
1044 |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1045 " 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
|
1046 " :qall works. |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1047 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
|
1048 " 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
|
1049 " 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
|
1050 " 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
|
1051 let after = [ |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1052 \ a:line1, |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1053 \ 'let buf = bufnr("%")', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1054 \ '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
|
1055 \ ' sleep 10m', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1056 \ 'endwhile', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1057 \ a:line2, |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1058 \ '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
|
1059 \ 'qall', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1060 \ ] |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1061 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
|
1062 return |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
1063 endif |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1064 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
|
1065 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
|
1066 endfunc |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
1067 |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
1068 " 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
|
1069 " 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
|
1070 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
|
1071 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
|
1072 endfunc |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1073 |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1074 " 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
|
1075 " 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
|
1076 func Test_terminal_qall_kill_func() |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
1077 call Run_terminal_qall_kill('term', 'eval buf->term_setkill("kill")') |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1078 endfunc |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1079 |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1080 " 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
|
1081 " 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
|
1082 func Test_terminal_qall_exit() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16656
diff
changeset
|
1083 let after =<< trim [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16656
diff
changeset
|
1084 term |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16656
diff
changeset
|
1085 let buf = bufnr("%") |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16656
diff
changeset
|
1086 while term_getline(buf, 1) =~ "^\\s*$" |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16656
diff
changeset
|
1087 sleep 10m |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16656
diff
changeset
|
1088 endwhile |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16656
diff
changeset
|
1089 set nomore |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16656
diff
changeset
|
1090 au VimLeavePre * call writefile(["too early"], "Xdone") |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16656
diff
changeset
|
1091 qall |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16656
diff
changeset
|
1092 au! VimLeavePre * exe buf . "bwipe!" | call writefile(["done"], "Xdone") |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16656
diff
changeset
|
1093 cquit |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16656
diff
changeset
|
1094 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16656
diff
changeset
|
1095 |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1096 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
|
1097 return |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
1098 endif |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1099 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
|
1100 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
|
1101 endfunc |
13440
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
1102 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
1103 " 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
|
1104 " 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
|
1105 func Test_terminal_qall_prompt() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1106 CheckRunVimInTerminal |
13440
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
1107 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
|
1108 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
1109 " 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
|
1110 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
|
1111 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
|
1112 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
|
1113 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
1114 " 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
|
1115 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
|
1116 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
|
1117 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
|
1118 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
|
1119 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
1120 " 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
|
1121 quit |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
1122 endfunc |
13444
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1123 |
18402
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1124 " Run Vim in a terminal, then start a terminal window with a shell and check |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1125 " that Vim exits if it is closed. |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1126 func Test_terminal_exit() |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1127 CheckRunVimInTerminal |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1128 |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1129 let lines =<< trim END |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1130 let winid = win_getid() |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1131 help |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1132 term |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1133 let termid = win_getid() |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1134 call win_gotoid(winid) |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1135 close |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1136 call win_gotoid(termid) |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1137 END |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1138 call writefile(lines, 'XtermExit') |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1139 let buf = RunVimInTerminal('-S XtermExit', #{rows: 10}) |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1140 let job = term_getjob(buf) |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1141 call WaitForAssert({-> assert_equal("run", job_status(job))}) |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1142 |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1143 " quit the shell, it will make Vim exit |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1144 call term_sendkeys(buf, "exit\<CR>") |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1145 call WaitForAssert({-> assert_equal("dead", job_status(job))}) |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1146 |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1147 call delete('XtermExit') |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1148 endfunc |
527b7084c556
patch 8.1.2195: Vim does not exit when the terminal window is last window
Bram Moolenaar <Bram@vim.org>
parents:
18327
diff
changeset
|
1149 |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
1150 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
|
1151 augroup repro |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1152 au! |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1153 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
|
1154 augroup END |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1155 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1156 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
|
1157 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1158 " 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
|
1159 terminal |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1160 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
|
1161 bwipe! |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1162 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1163 " 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
|
1164 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
|
1165 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
|
1166 bwipe! |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1167 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1168 " 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
|
1169 terminal ++hidden |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1170 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
|
1171 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
|
1172 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
|
1173 endfor |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1174 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1175 " 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
|
1176 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
|
1177 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
|
1178 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
|
1179 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1180 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
|
1181 au! repro |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1182 endfunction |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1183 |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1184 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
|
1185 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
|
1186 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
|
1187 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
|
1188 endfunc |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1189 |
13557
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1190 func Test_terminal_dumpwrite_composing() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1191 CheckRunVimInTerminal |
13557
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1192 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
|
1193 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
|
1194 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
|
1195 |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1196 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
|
1197 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
|
1198 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
|
1199 call WaitForAssert({-> assert_match(text, term_getline(buf, 1))}) |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
1200 eval 'Xdump'->term_dumpwrite(buf) |
13557
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1201 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
|
1202 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
|
1203 |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1204 call StopVimInTerminal(buf) |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1205 call delete('Xcomposing') |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1206 call delete('Xdump') |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1207 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
|
1208 endfunc |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1209 |
20365
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1210 " Tests for failures in the term_dumpwrite() function |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1211 func Test_terminal_dumpwrite_errors() |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1212 CheckRunVimInTerminal |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1213 call assert_fails("call term_dumpwrite({}, 'Xtest.dump')", 'E728:') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1214 let buf = RunVimInTerminal('', {}) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1215 call term_wait(buf) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1216 call assert_fails("call term_dumpwrite(buf, 'Xtest.dump', '')", 'E715:') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1217 call assert_fails("call term_dumpwrite(buf, [])", 'E730:') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1218 call writefile([], 'Xtest.dump') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1219 call assert_fails("call term_dumpwrite(buf, 'Xtest.dump')", 'E953:') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1220 call delete('Xtest.dump') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1221 call assert_fails("call term_dumpwrite(buf, '')", 'E482:') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1222 call assert_fails("call term_dumpwrite(buf, test_null_string())", 'E482:') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1223 call StopVimInTerminal(buf) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1224 call term_wait(buf) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1225 call assert_fails("call term_dumpwrite(buf, 'Xtest.dump')", 'E958:') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1226 call assert_fails('call term_sendkeys([], ":q\<CR>")', 'E745:') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1227 call assert_equal(0, term_sendkeys(buf, ":q\<CR>")) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1228 endfunc |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1229 |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1230 " 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
|
1231 func Test_terminal_dumpload() |
16912
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1232 let curbuf = winbufnr('') |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1233 call assert_equal(1, winnr('$')) |
16912
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1234 let buf = term_dumpload('dumps/Test_popup_command_01.dump') |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1235 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
|
1236 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
|
1237 call Check_dump01(0) |
16912
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1238 |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1239 " Load another dump in the same window |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
1240 let buf2 = 'dumps/Test_diff_01.dump'->term_dumpload({'bufnr': buf}) |
16912
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1241 call assert_equal(buf, buf2) |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1242 call assert_notequal('one two three four five', trim(getline(1))) |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1243 |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1244 " Load the first dump again in the same window |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1245 let buf2 = term_dumpload('dumps/Test_popup_command_01.dump', {'bufnr': buf}) |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1246 call assert_equal(buf, buf2) |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1247 call Check_dump01(0) |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1248 |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1249 call assert_fails("call term_dumpload('dumps/Test_popup_command_01.dump', {'bufnr': curbuf})", 'E475:') |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1250 call assert_fails("call term_dumpload('dumps/Test_popup_command_01.dump', {'bufnr': 9999})", 'E86:') |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1251 new |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1252 let closedbuf = winbufnr('') |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1253 quit |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1254 call assert_fails("call term_dumpload('dumps/Test_popup_command_01.dump', {'bufnr': closedbuf})", 'E475:') |
20365
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1255 call assert_fails('call term_dumpload([])', 'E474:') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1256 call assert_fails('call term_dumpload("xabcy.dump")', 'E485:') |
16912
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1257 |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1258 quit |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1259 endfunc |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1260 |
18327
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1261 func Test_terminal_dumpload_dump() |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1262 CheckRunVimInTerminal |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1263 |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1264 let lines =<< trim END |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1265 call term_dumpload('dumps/Test_popupwin_22.dump', #{term_rows: 12}) |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1266 END |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1267 call writefile(lines, 'XtermDumpload') |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1268 let buf = RunVimInTerminal('-S XtermDumpload', #{rows: 15}) |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1269 call VerifyScreenDump(buf, 'Test_terminal_dumpload', {}) |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1270 |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1271 call StopVimInTerminal(buf) |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1272 call delete('XtermDumpload') |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1273 endfunc |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1274 |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1275 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
|
1276 call assert_equal(1, winnr('$')) |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
1277 eval 'dumps/Test_popup_command_01.dump'->term_dumpdiff('dumps/Test_popup_command_02.dump') |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1278 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
|
1279 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
|
1280 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
|
1281 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
|
1282 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
|
1283 quit |
20365
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1284 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1285 call assert_fails('call term_dumpdiff("X1.dump", [])', 'E474:') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1286 call assert_fails('call term_dumpdiff("X1.dump", "X2.dump")', 'E485:') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1287 call writefile([], 'X1.dump') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1288 call assert_fails('call term_dumpdiff("X1.dump", "X2.dump")', 'E485:') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1289 call delete('X1.dump') |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1290 endfunc |
13527
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1291 |
15832
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1292 func Test_terminal_dumpdiff_swap() |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1293 call assert_equal(1, winnr('$')) |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1294 call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_03.dump') |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1295 call assert_equal(2, winnr('$')) |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1296 call assert_equal(62, line('$')) |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1297 call assert_match('Test_popup_command_01.dump', getline(21)) |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1298 call assert_match('Test_popup_command_03.dump', getline(42)) |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1299 call assert_match('Undo', getline(3)) |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1300 call assert_match('three four five', getline(45)) |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1301 |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1302 normal s |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1303 call assert_match('Test_popup_command_03.dump', getline(21)) |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1304 call assert_match('Test_popup_command_01.dump', getline(42)) |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1305 call assert_match('three four five', getline(3)) |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1306 call assert_match('Undo', getline(45)) |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1307 quit |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1308 endfunc |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1309 |
13527
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1310 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
|
1311 set laststatus=0 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1312 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
|
1313 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
|
1314 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
|
1315 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
|
1316 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
|
1317 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
|
1318 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
|
1319 quit |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1320 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1321 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
|
1322 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
|
1323 call assert_equal(2, winnr('$')) |
17262
041156ce1d22
patch 8.1.1630: various small problems
Bram Moolenaar <Bram@vim.org>
parents:
17164
diff
changeset
|
1324 call assert_equal(&columns, winwidth(0)) |
041156ce1d22
patch 8.1.1630: various small problems
Bram Moolenaar <Bram@vim.org>
parents:
17164
diff
changeset
|
1325 call assert_equal(13, winheight(0)) |
13527
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1326 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
|
1327 quit |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1328 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1329 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
|
1330 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
|
1331 call assert_equal(1, winnr('$')) |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1332 call assert_fails("call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_popup_command_02.dump', {'bufnr': -1})", 'E475:') |
13527
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1333 bwipe |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1334 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1335 set laststatus& |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1336 endfunc |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1337 |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1338 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
|
1339 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
|
1340 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1341 " 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
|
1342 call writefile([ |
13541
296d02b0637f
patch 8.0.1644: terminal API tests still fail
Christian Brabandt <cb@256bit.org>
parents:
13539
diff
changeset
|
1343 \ '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
|
1344 \ '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
|
1345 \ '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
|
1346 \ 'redraw', |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1347 \ "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
|
1348 \ ], 'Xscript') |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1349 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
|
1350 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
|
1351 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
|
1352 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
|
1353 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
|
1354 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1355 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1356 func Test_terminal_api_drop_newwin() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1357 CheckRunVimInTerminal |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1358 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
|
1359 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
|
1360 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
|
1361 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1362 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
|
1363 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
|
1364 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
|
1365 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1366 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1367 func Test_terminal_api_drop_newwin_bin() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1368 CheckRunVimInTerminal |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1369 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
|
1370 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
|
1371 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1372 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
|
1373 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
|
1374 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
|
1375 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1376 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1377 func Test_terminal_api_drop_newwin_binary() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1378 CheckRunVimInTerminal |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1379 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
|
1380 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
|
1381 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1382 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
|
1383 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
|
1384 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
|
1385 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1386 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1387 func Test_terminal_api_drop_newwin_nobin() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1388 CheckRunVimInTerminal |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1389 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
|
1390 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
|
1391 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
|
1392 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1393 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
|
1394 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
|
1395 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
|
1396 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
|
1397 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1398 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1399 func Test_terminal_api_drop_newwin_nobinary() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1400 CheckRunVimInTerminal |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1401 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
|
1402 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
|
1403 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
|
1404 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1405 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
|
1406 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
|
1407 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
|
1408 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
|
1409 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1410 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1411 func Test_terminal_api_drop_newwin_ff() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1412 CheckRunVimInTerminal |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1413 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
|
1414 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
|
1415 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1416 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
|
1417 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
|
1418 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
|
1419 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1420 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1421 func Test_terminal_api_drop_newwin_fileformat() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1422 CheckRunVimInTerminal |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1423 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
|
1424 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
|
1425 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1426 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
|
1427 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
|
1428 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
|
1429 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1430 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1431 func Test_terminal_api_drop_newwin_enc() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1432 CheckRunVimInTerminal |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1433 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
|
1434 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
|
1435 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1436 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
|
1437 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
|
1438 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
|
1439 endfunc |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1440 |
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1441 func Test_terminal_api_drop_newwin_encoding() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1442 CheckRunVimInTerminal |
13575
4df23d9bad47
patch 8.0.1660: the terminal API "drop" command doesn't support options
Christian Brabandt <cb@256bit.org>
parents:
13559
diff
changeset
|
1443 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
|
1444 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
|
1445 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1446 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
|
1447 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
|
1448 bwipe Xtextfile |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1449 endfunc |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1450 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1451 func Test_terminal_api_drop_oldwin() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1452 CheckRunVimInTerminal |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1453 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
|
1454 split Xtextfile |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1455 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
|
1456 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
|
1457 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
|
1458 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1459 " 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
|
1460 call writefile([ |
13541
296d02b0637f
patch 8.0.1644: terminal API tests still fail
Christian Brabandt <cb@256bit.org>
parents:
13539
diff
changeset
|
1461 \ '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
|
1462 \ '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
|
1463 \ '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
|
1464 \ 'redraw', |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1465 \ "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
|
1466 \ ], 'Xscript') |
13537
3fa880445c99
patch 8.0.1642: running Vim in terminal fails with two windows
Christian Brabandt <cb@256bit.org>
parents:
13535
diff
changeset
|
1467 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
|
1468 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
|
1469 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
|
1470 |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1471 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
|
1472 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
|
1473 bwipe Xtextfile |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1474 endfunc |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1475 |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1476 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
|
1477 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
|
1478 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
|
1479 endfunc |
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1480 |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1481 func WriteApiCall(funcname) |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1482 " 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
|
1483 call writefile([ |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1484 \ 'set title', |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1485 \ '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
|
1486 \ '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
|
1487 \ 'redraw', |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1488 \ "set t_ts=", |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1489 \ ], 'Xscript') |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1490 endfunc |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1491 |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1492 func Test_terminal_api_call() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1493 CheckRunVimInTerminal |
13539
5f543bce50e8
patch 8.0.1643: terminal API tests fail
Christian Brabandt <cb@256bit.org>
parents:
13537
diff
changeset
|
1494 |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1495 unlet! g:called_bufnum |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1496 unlet! g:called_arg |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1497 |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1498 call WriteApiCall('Tapi_TryThis') |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1499 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1500 " Default |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1501 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
|
1502 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
|
1503 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
|
1504 call assert_equal(['hello', 123], g:called_arg) |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1505 call StopVimInTerminal(buf) |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1506 |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1507 unlet! g:called_bufnum |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1508 unlet! g:called_arg |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1509 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1510 " Enable explicitly |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1511 let buf = RunVimInTerminal('-S Xscript', {'term_api': 'Tapi_Try'}) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1512 call WaitFor({-> exists('g:called_bufnum')}) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1513 call assert_equal(buf, g:called_bufnum) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1514 call assert_equal(['hello', 123], g:called_arg) |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1515 call StopVimInTerminal(buf) |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1516 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1517 unlet! g:called_bufnum |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1518 unlet! g:called_arg |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1519 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1520 func! ApiCall_TryThis(bufnum, arg) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1521 let g:called_bufnum2 = a:bufnum |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1522 let g:called_arg2 = a:arg |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1523 endfunc |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1524 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1525 call WriteApiCall('ApiCall_TryThis') |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1526 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1527 " Use prefix match |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1528 let buf = RunVimInTerminal('-S Xscript', {'term_api': 'ApiCall_'}) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1529 call WaitFor({-> exists('g:called_bufnum2')}) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1530 call assert_equal(buf, g:called_bufnum2) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1531 call assert_equal(['hello', 123], g:called_arg2) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1532 call StopVimInTerminal(buf) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1533 |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1534 call assert_fails("call term_start('ls', {'term_api' : []})", 'E475:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1535 |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1536 unlet! g:called_bufnum2 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1537 unlet! g:called_arg2 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1538 |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1539 call delete('Xscript') |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1540 delfunction! ApiCall_TryThis |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1541 unlet! g:called_bufnum2 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1542 unlet! g:called_arg2 |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1543 endfunc |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1544 |
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1545 func Test_terminal_api_call_fails() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1546 CheckRunVimInTerminal |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1547 |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1548 func! TryThis(bufnum, arg) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1549 let g:called_bufnum3 = a:bufnum |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1550 let g:called_arg3 = a:arg |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1551 endfunc |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1552 |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1553 call WriteApiCall('TryThis') |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1554 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1555 unlet! g:called_bufnum3 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1556 unlet! g:called_arg3 |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1557 |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1558 " Not permitted |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1559 call ch_logfile('Xlog', 'w') |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1560 let buf = RunVimInTerminal('-S Xscript', {'term_api': ''}) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1561 call WaitForAssert({-> assert_match('Unpermitted function: TryThis', string(readfile('Xlog')))}) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1562 call assert_false(exists('g:called_bufnum3')) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1563 call assert_false(exists('g:called_arg3')) |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1564 call StopVimInTerminal(buf) |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1565 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1566 " No match |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1567 call ch_logfile('Xlog', 'w') |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1568 let buf = RunVimInTerminal('-S Xscript', {'term_api': 'TryThat'}) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1569 call WaitFor({-> string(readfile('Xlog')) =~ 'Unpermitted function: TryThis'}) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1570 call assert_false(exists('g:called_bufnum3')) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1571 call assert_false(exists('g:called_arg3')) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1572 call StopVimInTerminal(buf) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1573 |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1574 call delete('Xscript') |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1575 call ch_logfile('') |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1576 call delete('Xlog') |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1577 delfunction! TryThis |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1578 unlet! g:called_bufnum3 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
1579 unlet! g:called_arg3 |
13547
87a9c1be0ae3
patch 8.0.1647: terminal API may call any user function
Christian Brabandt <cb@256bit.org>
parents:
13543
diff
changeset
|
1580 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
|
1581 |
13720
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1582 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
|
1583 |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1584 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
|
1585 try |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1586 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
|
1587 catch /E937:/ |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1588 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
|
1589 endtry |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1590 endfunc |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1591 |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1592 func Test_terminal_api_call_fail_delete() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1593 CheckRunVimInTerminal |
13720
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1594 |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1595 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
|
1596 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
|
1597 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
|
1598 |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1599 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
|
1600 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
|
1601 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
|
1602 endfunc |
7d2039b2ecc8
patch 8.0.1732: crash when terminal API call deletes the buffer
Christian Brabandt <cb@256bit.org>
parents:
13700
diff
changeset
|
1603 |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1604 func Test_terminal_ansicolors_default() |
20219
820f24dc1e3e
patch 8.2.0665: wrongly assuming Python executable is called "python"
Bram Moolenaar <Bram@vim.org>
parents:
20178
diff
changeset
|
1605 CheckFunction term_getansicolors |
820f24dc1e3e
patch 8.2.0665: wrongly assuming Python executable is called "python"
Bram Moolenaar <Bram@vim.org>
parents:
20178
diff
changeset
|
1606 |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1607 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
|
1608 \ '#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
|
1609 \ '#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
|
1610 \ '#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
|
1611 \ '#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
|
1612 \ '#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
|
1613 \ '#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
|
1614 \ '#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
|
1615 \ '#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
|
1616 \] |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1617 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1618 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
|
1619 call assert_equal(colors, term_getansicolors(buf)) |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1620 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
1621 call TermWait(buf) |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1622 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1623 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
|
1624 endfunc |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1625 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1626 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
|
1627 \ '#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
|
1628 \ '#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
|
1629 \ '#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
|
1630 \ '#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
|
1631 \ '#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
|
1632 \ '#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
|
1633 \ '#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
|
1634 \ '#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
|
1635 \] |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1636 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1637 func Test_terminal_ansicolors_global() |
18137
5a5e9eed6029
patch 8.1.2063: some tests fail when +balloon_eval_term is missing
Bram Moolenaar <Bram@vim.org>
parents:
18070
diff
changeset
|
1638 CheckFeature termguicolors |
20219
820f24dc1e3e
patch 8.2.0665: wrongly assuming Python executable is called "python"
Bram Moolenaar <Bram@vim.org>
parents:
20178
diff
changeset
|
1639 CheckFunction term_getansicolors |
820f24dc1e3e
patch 8.2.0665: wrongly assuming Python executable is called "python"
Bram Moolenaar <Bram@vim.org>
parents:
20178
diff
changeset
|
1640 |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1641 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
|
1642 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
|
1643 call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf)) |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1644 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
1645 call TermWait(buf) |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1646 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1647 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
|
1648 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
|
1649 endfunc |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1650 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1651 func Test_terminal_ansicolors_func() |
18137
5a5e9eed6029
patch 8.1.2063: some tests fail when +balloon_eval_term is missing
Bram Moolenaar <Bram@vim.org>
parents:
18070
diff
changeset
|
1652 CheckFeature termguicolors |
20219
820f24dc1e3e
patch 8.2.0665: wrongly assuming Python executable is called "python"
Bram Moolenaar <Bram@vim.org>
parents:
20178
diff
changeset
|
1653 CheckFunction term_getansicolors |
820f24dc1e3e
patch 8.2.0665: wrongly assuming Python executable is called "python"
Bram Moolenaar <Bram@vim.org>
parents:
20178
diff
changeset
|
1654 |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1655 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
|
1656 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
|
1657 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
|
1658 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1659 call term_setansicolors(buf, g:terminal_ansi_colors) |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
1660 call assert_equal(g:terminal_ansi_colors, buf->term_getansicolors()) |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1661 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1662 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
|
1663 \ '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
|
1664 \ '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
|
1665 \ '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
|
1666 \ '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
|
1667 \ '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
|
1668 \ '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
|
1669 \ '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
|
1670 \ '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
|
1671 \] |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
1672 eval buf->term_setansicolors(colors) |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1673 |
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1674 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
|
1675 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
|
1676 |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1677 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
1678 call TermWait(buf) |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13602
diff
changeset
|
1679 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
|
1680 endfunc |
13698
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1681 |
16312
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1682 func Test_terminal_all_ansi_colors() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1683 CheckRunVimInTerminal |
16312
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1684 |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1685 " Use all the ANSI colors. |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1686 call writefile([ |
16656
e8c081146788
patch 8.1.1330: using bold attribute in terminal changes the color
Bram Moolenaar <Bram@vim.org>
parents:
16334
diff
changeset
|
1687 \ 'call setline(1, "AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPP XXYYZZ")', |
16330
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1688 \ 'hi Tblack ctermfg=0 ctermbg=8', |
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1689 \ 'hi Tdarkred ctermfg=1 ctermbg=9', |
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1690 \ 'hi Tdarkgreen ctermfg=2 ctermbg=10', |
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1691 \ 'hi Tbrown ctermfg=3 ctermbg=11', |
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1692 \ 'hi Tdarkblue ctermfg=4 ctermbg=12', |
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1693 \ 'hi Tdarkmagenta ctermfg=5 ctermbg=13', |
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1694 \ 'hi Tdarkcyan ctermfg=6 ctermbg=14', |
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1695 \ 'hi Tlightgrey ctermfg=7 ctermbg=15', |
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1696 \ 'hi Tdarkgrey ctermfg=8 ctermbg=0', |
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1697 \ 'hi Tred ctermfg=9 ctermbg=1', |
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1698 \ 'hi Tgreen ctermfg=10 ctermbg=2', |
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1699 \ 'hi Tyellow ctermfg=11 ctermbg=3', |
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1700 \ 'hi Tblue ctermfg=12 ctermbg=4', |
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1701 \ 'hi Tmagenta ctermfg=13 ctermbg=5', |
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1702 \ 'hi Tcyan ctermfg=14 ctermbg=6', |
789a207c475f
patch 8.1.1170: terminal ANSI color test does not cover all colors
Bram Moolenaar <Bram@vim.org>
parents:
16322
diff
changeset
|
1703 \ 'hi Twhite ctermfg=15 ctermbg=7', |
16656
e8c081146788
patch 8.1.1330: using bold attribute in terminal changes the color
Bram Moolenaar <Bram@vim.org>
parents:
16334
diff
changeset
|
1704 \ 'hi TdarkredBold ctermfg=1 cterm=bold', |
e8c081146788
patch 8.1.1330: using bold attribute in terminal changes the color
Bram Moolenaar <Bram@vim.org>
parents:
16334
diff
changeset
|
1705 \ 'hi TgreenBold ctermfg=10 cterm=bold', |
e8c081146788
patch 8.1.1330: using bold attribute in terminal changes the color
Bram Moolenaar <Bram@vim.org>
parents:
16334
diff
changeset
|
1706 \ 'hi TmagentaBold ctermfg=13 cterm=bold ctermbg=5', |
16312
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1707 \ '', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1708 \ 'call matchadd("Tblack", "A")', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1709 \ 'call matchadd("Tdarkred", "B")', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1710 \ 'call matchadd("Tdarkgreen", "C")', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1711 \ 'call matchadd("Tbrown", "D")', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1712 \ 'call matchadd("Tdarkblue", "E")', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1713 \ 'call matchadd("Tdarkmagenta", "F")', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1714 \ 'call matchadd("Tdarkcyan", "G")', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1715 \ 'call matchadd("Tlightgrey", "H")', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1716 \ 'call matchadd("Tdarkgrey", "I")', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1717 \ 'call matchadd("Tred", "J")', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1718 \ 'call matchadd("Tgreen", "K")', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1719 \ 'call matchadd("Tyellow", "L")', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1720 \ 'call matchadd("Tblue", "M")', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1721 \ 'call matchadd("Tmagenta", "N")', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1722 \ 'call matchadd("Tcyan", "O")', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1723 \ 'call matchadd("Twhite", "P")', |
16656
e8c081146788
patch 8.1.1330: using bold attribute in terminal changes the color
Bram Moolenaar <Bram@vim.org>
parents:
16334
diff
changeset
|
1724 \ 'call matchadd("TdarkredBold", "X")', |
e8c081146788
patch 8.1.1330: using bold attribute in terminal changes the color
Bram Moolenaar <Bram@vim.org>
parents:
16334
diff
changeset
|
1725 \ 'call matchadd("TgreenBold", "Y")', |
e8c081146788
patch 8.1.1330: using bold attribute in terminal changes the color
Bram Moolenaar <Bram@vim.org>
parents:
16334
diff
changeset
|
1726 \ 'call matchadd("TmagentaBold", "Z")', |
16312
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1727 \ 'redraw', |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1728 \ ], 'Xcolorscript') |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1729 let buf = RunVimInTerminal('-S Xcolorscript', {'rows': 10}) |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1730 call VerifyScreenDump(buf, 'Test_terminal_all_ansi_colors', {}) |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1731 |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1732 call term_sendkeys(buf, ":q\<CR>") |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1733 call StopVimInTerminal(buf) |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1734 call delete('Xcolorscript') |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1735 endfunc |
46e8430738fa
patch 8.1.1161: unreachable code
Bram Moolenaar <Bram@vim.org>
parents:
16273
diff
changeset
|
1736 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1737 func Test_terminal_termwinsize_option_fixed() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1738 CheckRunVimInTerminal |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1739 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
|
1740 let text = [] |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1741 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
|
1742 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
|
1743 endfor |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1744 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
|
1745 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
|
1746 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
|
1747 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
|
1748 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
|
1749 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
|
1750 |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1751 " 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
|
1752 resize 10 |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1753 vertical resize 60 |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1754 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
|
1755 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
|
1756 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
|
1757 |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1758 call StopVimInTerminal(buf) |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1759 call delete('Xwinsize') |
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1760 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1761 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
|
1762 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
|
1763 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
|
1764 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1765 set termwinsize= |
13698
404b89cb1e2a
patch 8.0.1721: no test for using the 'termsize' option
Christian Brabandt <cb@256bit.org>
parents:
13692
diff
changeset
|
1766 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
|
1767 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1768 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
|
1769 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
|
1770 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
|
1771 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
|
1772 call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1773 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
1774 call TermWait(buf) |
13700
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1775 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
|
1776 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1777 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
|
1778 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
|
1779 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
|
1780 call assert_equal([7, winwidth(win)], term_getsize(buf)) |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1781 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
1782 call TermWait(buf) |
13700
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1783 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
|
1784 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1785 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
|
1786 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
|
1787 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
|
1788 call assert_equal([winheight(win), 33], term_getsize(buf)) |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1789 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
1790 call TermWait(buf) |
13700
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1791 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
|
1792 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1793 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
|
1794 endfunc |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1795 |
16318
3019a0744c46
patch 8.1.1164: gettitle test is failing when server name differs
Bram Moolenaar <Bram@vim.org>
parents:
16314
diff
changeset
|
1796 func Test_terminal_termwinsize_minimum() |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1797 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
|
1798 vsplit |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1799 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
|
1800 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
|
1801 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
|
1802 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
|
1803 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
|
1804 |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1805 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
|
1806 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
|
1807 redraw |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1808 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
|
1809 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
|
1810 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
|
1811 |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1812 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
|
1813 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
|
1814 redraw |
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1815 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
|
1816 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
|
1817 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
|
1818 |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1819 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
1820 call TermWait(buf) |
13700
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1821 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
|
1822 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1823 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
|
1824 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
|
1825 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
|
1826 call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1827 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
1828 call TermWait(buf) |
13700
b28d679b1843
patch 8.0.1722: cannot specify a minimal size for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13698
diff
changeset
|
1829 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
|
1830 |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
1831 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
|
1832 endfunc |
13829
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1833 |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1834 func Test_terminal_termwinkey() |
15937
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1835 " make three tabpages, terminal in the middle |
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1836 0tabnew |
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1837 tabnext |
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1838 tabnew |
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1839 tabprev |
13829
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1840 call assert_equal(1, winnr('$')) |
15937
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1841 call assert_equal(2, tabpagenr()) |
13829
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1842 let thiswin = win_getid() |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1843 |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1844 let buf = Run_shell_in_terminal({}) |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1845 let termwin = bufwinid(buf) |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1846 set termwinkey=<C-L> |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1847 call feedkeys("\<C-L>w", 'tx') |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1848 call assert_equal(thiswin, win_getid()) |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1849 call feedkeys("\<C-W>w", 'tx') |
15933
b2423b31266f
patch 8.1.0972: cannot switch from terminal window to next tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15836
diff
changeset
|
1850 call assert_equal(termwin, win_getid()) |
b2423b31266f
patch 8.1.0972: cannot switch from terminal window to next tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15836
diff
changeset
|
1851 |
18070
873068e19e1f
patch 8.1.2030: tests fail when build with normal features and terminal
Bram Moolenaar <Bram@vim.org>
parents:
18041
diff
changeset
|
1852 if has('langmap') |
873068e19e1f
patch 8.1.2030: tests fail when build with normal features and terminal
Bram Moolenaar <Bram@vim.org>
parents:
18041
diff
changeset
|
1853 set langmap=xjyk |
873068e19e1f
patch 8.1.2030: tests fail when build with normal features and terminal
Bram Moolenaar <Bram@vim.org>
parents:
18041
diff
changeset
|
1854 call feedkeys("\<C-L>x", 'tx') |
873068e19e1f
patch 8.1.2030: tests fail when build with normal features and terminal
Bram Moolenaar <Bram@vim.org>
parents:
18041
diff
changeset
|
1855 call assert_equal(thiswin, win_getid()) |
873068e19e1f
patch 8.1.2030: tests fail when build with normal features and terminal
Bram Moolenaar <Bram@vim.org>
parents:
18041
diff
changeset
|
1856 call feedkeys("\<C-W>y", 'tx') |
873068e19e1f
patch 8.1.2030: tests fail when build with normal features and terminal
Bram Moolenaar <Bram@vim.org>
parents:
18041
diff
changeset
|
1857 call assert_equal(termwin, win_getid()) |
873068e19e1f
patch 8.1.2030: tests fail when build with normal features and terminal
Bram Moolenaar <Bram@vim.org>
parents:
18041
diff
changeset
|
1858 set langmap= |
873068e19e1f
patch 8.1.2030: tests fail when build with normal features and terminal
Bram Moolenaar <Bram@vim.org>
parents:
18041
diff
changeset
|
1859 endif |
17702
ba18f78c8529
patch 8.1.1848: 'langmap' is not used for CTRL-W command in terminal
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
1860 |
15933
b2423b31266f
patch 8.1.0972: cannot switch from terminal window to next tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15836
diff
changeset
|
1861 call feedkeys("\<C-L>gt", "xt") |
15937
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1862 call assert_equal(3, tabpagenr()) |
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1863 tabprev |
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1864 call assert_equal(2, tabpagenr()) |
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1865 call assert_equal(termwin, win_getid()) |
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1866 |
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1867 call feedkeys("\<C-L>gT", "xt") |
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1868 call assert_equal(1, tabpagenr()) |
15933
b2423b31266f
patch 8.1.0972: cannot switch from terminal window to next tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15836
diff
changeset
|
1869 tabnext |
15937
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1870 call assert_equal(2, tabpagenr()) |
15933
b2423b31266f
patch 8.1.0972: cannot switch from terminal window to next tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15836
diff
changeset
|
1871 call assert_equal(termwin, win_getid()) |
13829
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1872 |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1873 let job = term_getjob(buf) |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1874 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
|
1875 call WaitForAssert({-> assert_equal("dead", job_status(job))}) |
15826
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1876 |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
1877 set termwinkey& |
15933
b2423b31266f
patch 8.1.0972: cannot switch from terminal window to next tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15836
diff
changeset
|
1878 tabnext |
b2423b31266f
patch 8.1.0972: cannot switch from terminal window to next tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15836
diff
changeset
|
1879 tabclose |
15937
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1880 tabprev |
c38fb03a6055
patch 8.1.0974: cannot switch from terminal window to previous tabpage
Bram Moolenaar <Bram@vim.org>
parents:
15933
diff
changeset
|
1881 tabclose |
13829
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13816
diff
changeset
|
1882 endfunc |
13898
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1883 |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1884 func Test_terminal_out_err() |
18041
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
1885 CheckUnix |
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
1886 |
13898
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1887 call writefile([ |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1888 \ '#!/bin/sh', |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1889 \ '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
|
1890 \ '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
|
1891 \ ], 'Xechoerrout.sh') |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1892 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
|
1893 |
ea0e6c71ba51
patch 8.0.1820: terminal window redirecting stdout does not show stderr
Christian Brabandt <cb@256bit.org>
parents:
13860
diff
changeset
|
1894 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
|
1895 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
|
1896 |
43efca4c482f
patch 8.1.0088: terminal test for stdout and stderr is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
14139
diff
changeset
|
1897 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
|
1898 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
|
1899 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
|
1900 |
13904
b94a9171ec7c
patch 8.0.1823: test for terminal stdout redirection is flaky
Christian Brabandt <cb@256bit.org>
parents:
13898
diff
changeset
|
1901 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
|
1902 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
|
1903 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
|
1904 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
|
1905 endfunc |
13956
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1906 |
18748
c7b16393c248
patch 8.1.2364: termwinscroll test is flaky on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents:
18736
diff
changeset
|
1907 func Test_termwinscroll() |
18041
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
1908 CheckUnix |
13956
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1909 |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1910 " 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
|
1911 " will be dropped. |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1912 exe 'set termwinscroll=' . &lines |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1913 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
|
1914 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
|
1915 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
|
1916 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
|
1917 endfor |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1918 " 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
|
1919 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
|
1920 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
|
1921 |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1922 " 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
|
1923 let lines = getline(1, line('$')) |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1924 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
|
1925 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
|
1926 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
|
1927 endfor |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1928 |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1929 exe buf . 'bwipe!' |
300aab3275c0
patch 8.0.1848: 'termwinscroll' does not work properly
Christian Brabandt <cb@256bit.org>
parents:
13904
diff
changeset
|
1930 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
|
1931 |
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
|
1932 " 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
|
1933 " 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
|
1934 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
|
1935 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
|
1936 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
|
1937 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
|
1938 |
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
|
1939 " 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
|
1940 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
|
1941 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
|
1942 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
|
1943 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
|
1944 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
|
1945 " 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
|
1946 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
|
1947 " 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
|
1948 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
|
1949 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
|
1950 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
|
1951 |
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
|
1952 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
|
1953 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
|
1954 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
|
1955 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
|
1956 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
|
1957 |
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
|
1958 " 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
|
1959 func Test_zz1_terminal_in_gui() |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17270
diff
changeset
|
1960 CheckCanRunGui |
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
|
1961 |
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
|
1962 " 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
|
1963 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
|
1964 |
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
|
1965 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
|
1966 |
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
|
1967 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
|
1968 let buf = Run_shell_in_terminal({'term_finish': 'close'}) |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1969 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
1970 call TermWait(buf) |
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
|
1971 |
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
|
1972 " 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
|
1973 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
|
1974 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
|
1975 |
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
|
1976 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
|
1977 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
|
1978 |
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
|
1979 func Test_zz2_terminal_guioptions_bang() |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17270
diff
changeset
|
1980 CheckGui |
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
|
1981 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
|
1982 |
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
|
1983 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
|
1984 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
|
1985 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
|
1986 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
|
1987 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
|
1988 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
|
1989 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
|
1990 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
|
1991 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
|
1992 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
|
1993 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
|
1994 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
|
1995 |
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
|
1996 " 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
|
1997 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
|
1998 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
|
1999 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
|
2000 |
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
|
2001 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
|
2002 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
|
2003 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
|
2004 |
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
|
2005 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
|
2006 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
|
2007 endfunc |
14449
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
2008 |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
2009 func Test_terminal_hidden() |
18041
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
2010 CheckUnix |
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
2011 |
14449
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
2012 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
|
2013 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
|
2014 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
|
2015 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
|
2016 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
|
2017 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
|
2018 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
|
2019 call term_sendkeys(bnr, "\<C-D>") |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
2020 call WaitForAssert({-> assert_equal('finished', bnr->term_getstatus())}) |
14449
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
2021 bwipe! |
5faab0545f3c
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Christian Brabandt <cb@256bit.org>
parents:
14311
diff
changeset
|
2022 endfunc |
14459
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
2023 |
16093
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2024 func Test_terminal_switch_mode() |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2025 term |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2026 let bnr = bufnr('$') |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2027 call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))}) |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2028 call feedkeys("\<C-W>N", 'xt') |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2029 call WaitForAssert({-> assert_equal('running,normal', term_getstatus(bnr))}) |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2030 call feedkeys("A", 'xt') |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2031 call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))}) |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2032 call feedkeys("\<C-W>N", 'xt') |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2033 call WaitForAssert({-> assert_equal('running,normal', term_getstatus(bnr))}) |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2034 call feedkeys("I", 'xt') |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2035 call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))}) |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2036 call feedkeys("\<C-W>Nv", 'xt') |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2037 call WaitForAssert({-> assert_equal('running,normal', term_getstatus(bnr))}) |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2038 call feedkeys("I", 'xt') |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2039 call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))}) |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2040 call feedkeys("\<C-W>Nv", 'xt') |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2041 call WaitForAssert({-> assert_equal('running,normal', term_getstatus(bnr))}) |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2042 call feedkeys("A", 'xt') |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2043 call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))}) |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2044 bwipe! |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2045 endfunc |
3da6df816d8a
patch 8.1.1051: not all ways to switch terminal mode are tested
Bram Moolenaar <Bram@vim.org>
parents:
15951
diff
changeset
|
2046 |
18321
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2047 func Test_terminal_normal_mode() |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2048 CheckRunVimInTerminal |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2049 |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2050 " Run Vim in a terminal and open a terminal window to run Vim in. |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2051 let lines =<< trim END |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2052 call setline(1, range(11111, 11122)) |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2053 3 |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2054 END |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2055 call writefile(lines, 'XtermNormal') |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2056 let buf = RunVimInTerminal('-S XtermNormal', {'rows': 8}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2057 call TermWait(buf) |
18321
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2058 |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2059 call term_sendkeys(buf, "\<C-W>N") |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2060 call term_sendkeys(buf, ":set number cursorline culopt=both\r") |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2061 call VerifyScreenDump(buf, 'Test_terminal_normal_1', {}) |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2062 |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2063 call term_sendkeys(buf, ":set culopt=number\r") |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2064 call VerifyScreenDump(buf, 'Test_terminal_normal_2', {}) |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2065 |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2066 call term_sendkeys(buf, ":set culopt=line\r") |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2067 call VerifyScreenDump(buf, 'Test_terminal_normal_3', {}) |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2068 |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2069 call term_sendkeys(buf, "a:q!\<CR>:q\<CR>:q\<CR>") |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2070 call StopVimInTerminal(buf) |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2071 call delete('XtermNormal') |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2072 endfunc |
2ffe3309958c
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
18277
diff
changeset
|
2073 |
14459
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
2074 func Test_terminal_hidden_and_close() |
18041
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
2075 CheckUnix |
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
2076 |
14459
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
2077 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
|
2078 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
|
2079 let bnr = bufnr('$') |
ecf6c05d8ac3
patch 8.1.0243: using :term ++close ++hidden closes a window
Christian Brabandt <cb@256bit.org>
parents:
14449
diff
changeset
|
2080 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
|
2081 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
|
2082 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
|
2083 endfunc |
15022
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2084 |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2085 func Test_terminal_does_not_truncate_last_newlines() |
15725
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
2086 " This test does not pass through ConPTY. |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
2087 if has('conpty') |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
2088 return |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
2089 endif |
15022
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2090 let contents = [ |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2091 \ [ 'One', '', 'X' ], |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2092 \ [ 'Two', '', '' ], |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2093 \ [ 'Three' ] + repeat([''], 30) |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2094 \ ] |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2095 |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2096 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
|
2097 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
|
2098 if has('win32') |
efd7bace40f4
patch 8.1.0525: terminal test skips part on Windows
Bram Moolenaar <Bram@vim.org>
parents:
15026
diff
changeset
|
2099 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
|
2100 else |
efd7bace40f4
patch 8.1.0525: terminal test skips part on Windows
Bram Moolenaar <Bram@vim.org>
parents:
15026
diff
changeset
|
2101 term cat Xfile |
efd7bace40f4
patch 8.1.0525: terminal test skips part on Windows
Bram Moolenaar <Bram@vim.org>
parents:
15026
diff
changeset
|
2102 endif |
15022
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2103 let bnr = bufnr('$') |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2104 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
|
2105 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
|
2106 sleep 100m |
15022
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2107 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
|
2108 quit |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2109 endfor |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2110 |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2111 call delete('Xfile') |
f3b4cd98944c
patch 8.1.0522: :terminal does not show trailing empty lines
Bram Moolenaar <Bram@vim.org>
parents:
14995
diff
changeset
|
2112 endfunc |
15186
2b15ee496cbd
patch 8.1.0603: the :stop command is not tested
Bram Moolenaar <Bram@vim.org>
parents:
15027
diff
changeset
|
2113 |
15217
49bc670c3ee9
patch 8.1.0618: term_getjob() does not return v:null as documented
Bram Moolenaar <Bram@vim.org>
parents:
15186
diff
changeset
|
2114 func Test_terminal_no_job() |
18473
0eeaa9a6e4e7
patch 8.1.2230: MS-Windows: testing external commands can be improved
Bram Moolenaar <Bram@vim.org>
parents:
18450
diff
changeset
|
2115 if has('win32') |
0eeaa9a6e4e7
patch 8.1.2230: MS-Windows: testing external commands can be improved
Bram Moolenaar <Bram@vim.org>
parents:
18450
diff
changeset
|
2116 let cmd = 'cmd /c ""' |
0eeaa9a6e4e7
patch 8.1.2230: MS-Windows: testing external commands can be improved
Bram Moolenaar <Bram@vim.org>
parents:
18450
diff
changeset
|
2117 else |
0eeaa9a6e4e7
patch 8.1.2230: MS-Windows: testing external commands can be improved
Bram Moolenaar <Bram@vim.org>
parents:
18450
diff
changeset
|
2118 CheckExecutable false |
0eeaa9a6e4e7
patch 8.1.2230: MS-Windows: testing external commands can be improved
Bram Moolenaar <Bram@vim.org>
parents:
18450
diff
changeset
|
2119 let cmd = 'false' |
0eeaa9a6e4e7
patch 8.1.2230: MS-Windows: testing external commands can be improved
Bram Moolenaar <Bram@vim.org>
parents:
18450
diff
changeset
|
2120 endif |
0eeaa9a6e4e7
patch 8.1.2230: MS-Windows: testing external commands can be improved
Bram Moolenaar <Bram@vim.org>
parents:
18450
diff
changeset
|
2121 let term = term_start(cmd, {'term_finish': 'close'}) |
15217
49bc670c3ee9
patch 8.1.0618: term_getjob() does not return v:null as documented
Bram Moolenaar <Bram@vim.org>
parents:
15186
diff
changeset
|
2122 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
|
2123 endfunc |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
2124 |
16334
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2125 func Test_term_getcursor() |
18041
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
2126 CheckUnix |
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
2127 |
16334
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2128 let buf = Run_shell_in_terminal({}) |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2129 |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2130 " Wait for the shell to display a prompt. |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2131 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2132 |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2133 " Hide the cursor. |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2134 call term_sendkeys(buf, "echo -e '\\033[?25l'\r") |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2135 call WaitForAssert({-> assert_equal(0, term_getcursor(buf)[2].visible)}) |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2136 |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2137 " Show the cursor. |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2138 call term_sendkeys(buf, "echo -e '\\033[?25h'\r") |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
2139 call WaitForAssert({-> assert_equal(1, buf->term_getcursor()[2].visible)}) |
16334
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2140 |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2141 " Change color of cursor. |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2142 call WaitForAssert({-> assert_equal('', term_getcursor(buf)[2].color)}) |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2143 call term_sendkeys(buf, "echo -e '\\033]12;blue\\007'\r") |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2144 call WaitForAssert({-> assert_equal('blue', term_getcursor(buf)[2].color)}) |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2145 call term_sendkeys(buf, "echo -e '\\033]12;green\\007'\r") |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2146 call WaitForAssert({-> assert_equal('green', term_getcursor(buf)[2].color)}) |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2147 |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2148 " Make cursor a blinking block. |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2149 call term_sendkeys(buf, "echo -e '\\033[1 q'\r") |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2150 call WaitForAssert({-> assert_equal([1, 1], |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2151 \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])}) |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2152 |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2153 " Make cursor a steady block. |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2154 call term_sendkeys(buf, "echo -e '\\033[2 q'\r") |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2155 call WaitForAssert({-> assert_equal([0, 1], |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2156 \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])}) |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2157 |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2158 " Make cursor a blinking underline. |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2159 call term_sendkeys(buf, "echo -e '\\033[3 q'\r") |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2160 call WaitForAssert({-> assert_equal([1, 2], |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2161 \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])}) |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2162 |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2163 " Make cursor a steady underline. |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2164 call term_sendkeys(buf, "echo -e '\\033[4 q'\r") |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2165 call WaitForAssert({-> assert_equal([0, 2], |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2166 \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])}) |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2167 |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2168 " Make cursor a blinking vertical bar. |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2169 call term_sendkeys(buf, "echo -e '\\033[5 q'\r") |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2170 call WaitForAssert({-> assert_equal([1, 3], |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2171 \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])}) |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2172 |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2173 " Make cursor a steady vertical bar. |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2174 call term_sendkeys(buf, "echo -e '\\033[6 q'\r") |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2175 call WaitForAssert({-> assert_equal([0, 3], |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2176 \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])}) |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2177 |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
2178 call StopShellInTerminal(buf) |
16334
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2179 endfunc |
52ebcf772310
patch 8.1.1172: cursor properties were not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
16330
diff
changeset
|
2180 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
2181 func Test_term_gettitle() |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
2182 " term_gettitle() returns an empty string for a non-terminal buffer |
16233
59177d9466aa
patch 8.1.1121: test for term_gettitle() was disabled
Bram Moolenaar <Bram@vim.org>
parents:
16093
diff
changeset
|
2183 " and for a non-existing buffer. |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
2184 call assert_equal('', bufnr('%')->term_gettitle()) |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
2185 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
|
2186 |
16233
59177d9466aa
patch 8.1.1121: test for term_gettitle() was disabled
Bram Moolenaar <Bram@vim.org>
parents:
16093
diff
changeset
|
2187 if !has('title') || &title == 0 || empty(&t_ts) |
59177d9466aa
patch 8.1.1121: test for term_gettitle() was disabled
Bram Moolenaar <Bram@vim.org>
parents:
16093
diff
changeset
|
2188 throw "Skipped: can't get/set title" |
59177d9466aa
patch 8.1.1121: test for term_gettitle() was disabled
Bram Moolenaar <Bram@vim.org>
parents:
16093
diff
changeset
|
2189 endif |
59177d9466aa
patch 8.1.1121: test for term_gettitle() was disabled
Bram Moolenaar <Bram@vim.org>
parents:
16093
diff
changeset
|
2190 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
2191 let term = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile']) |
16318
3019a0744c46
patch 8.1.1164: gettitle test is failing when server name differs
Bram Moolenaar <Bram@vim.org>
parents:
16314
diff
changeset
|
2192 if has('autoservername') |
16322
eb2fd769175f
patch 8.1.1166: gettitle test can still fail when another Vim is running
Bram Moolenaar <Bram@vim.org>
parents:
16318
diff
changeset
|
2193 call WaitForAssert({-> assert_match('^\[No Name\] - VIM\d\+$', term_gettitle(term)) }) |
eb2fd769175f
patch 8.1.1166: gettitle test can still fail when another Vim is running
Bram Moolenaar <Bram@vim.org>
parents:
16318
diff
changeset
|
2194 call term_sendkeys(term, ":e Xfoo\r") |
eb2fd769175f
patch 8.1.1166: gettitle test can still fail when another Vim is running
Bram Moolenaar <Bram@vim.org>
parents:
16318
diff
changeset
|
2195 call WaitForAssert({-> assert_match('^Xfoo (.*[/\\]testdir) - VIM\d\+$', term_gettitle(term)) }) |
16318
3019a0744c46
patch 8.1.1164: gettitle test is failing when server name differs
Bram Moolenaar <Bram@vim.org>
parents:
16314
diff
changeset
|
2196 else |
3019a0744c46
patch 8.1.1164: gettitle test is failing when server name differs
Bram Moolenaar <Bram@vim.org>
parents:
16314
diff
changeset
|
2197 call WaitForAssert({-> assert_equal('[No Name] - VIM', term_gettitle(term)) }) |
16322
eb2fd769175f
patch 8.1.1166: gettitle test can still fail when another Vim is running
Bram Moolenaar <Bram@vim.org>
parents:
16318
diff
changeset
|
2198 call term_sendkeys(term, ":e Xfoo\r") |
eb2fd769175f
patch 8.1.1166: gettitle test can still fail when another Vim is running
Bram Moolenaar <Bram@vim.org>
parents:
16318
diff
changeset
|
2199 call WaitForAssert({-> assert_match('^Xfoo (.*[/\\]testdir) - VIM$', term_gettitle(term)) }) |
16318
3019a0744c46
patch 8.1.1164: gettitle test is failing when server name differs
Bram Moolenaar <Bram@vim.org>
parents:
16314
diff
changeset
|
2200 endif |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
2201 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
2202 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
|
2203 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
|
2204 |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
2205 exe term . 'bwipe!' |
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
2206 endfunc |
15557
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
2207 |
19898
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2208 func Test_term_gettty() |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2209 let buf = Run_shell_in_terminal({}) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2210 let gettty = term_gettty(buf) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2211 |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2212 if has('unix') && executable('tty') |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2213 " Find tty using the tty shell command. |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2214 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2215 call term_sendkeys(buf, "tty\r") |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2216 call WaitForAssert({-> assert_notequal('', term_getline(buf, 3))}) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2217 let tty = term_getline(buf, 2) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2218 call assert_equal(tty, gettty) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2219 endif |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2220 |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2221 let gettty0 = term_gettty(buf, 0) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2222 let gettty1 = term_gettty(buf, 1) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2223 |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2224 call assert_equal(gettty, gettty0) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2225 call assert_equal(job_info(g:job).tty_out, gettty0) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2226 call assert_equal(job_info(g:job).tty_in, gettty1) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2227 |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2228 if has('unix') |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2229 " For unix, term_gettty(..., 0) and term_gettty(..., 1) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2230 " are identical according to :help term_gettty() |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2231 call assert_equal(gettty0, gettty1) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2232 call assert_match('^/dev/', gettty) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2233 else |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2234 " ConPTY works on anonymous pipe. |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2235 if !has('conpty') |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2236 call assert_match('^\\\\.\\pipe\\', gettty0) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2237 call assert_match('^\\\\.\\pipe\\', gettty1) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2238 endif |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2239 endif |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2240 |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2241 call assert_fails('call term_gettty(buf, 2)', 'E475:') |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2242 call assert_fails('call term_gettty(buf, -1)', 'E475:') |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2243 |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2244 call assert_equal('', term_gettty(buf + 1)) |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2245 |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2246 call StopShellInTerminal(buf) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2247 call TermWait(buf) |
19898
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2248 exe buf . 'bwipe' |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2249 endfunc |
648752e0d579
patch 8.2.0505: term_getty() not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
2250 |
15557
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
2251 " 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
|
2252 " yet. |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
2253 " 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
|
2254 " 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
|
2255 " 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
|
2256 " 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
|
2257 " 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
|
2258 func Test_terminal_statusline() |
18041
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
2259 CheckUnix |
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
2260 |
15557
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
2261 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
|
2262 terminal |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
2263 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
|
2264 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
|
2265 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
|
2266 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
|
2267 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
|
2268 |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
2269 sleep 2 |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
2270 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
|
2271 au! BufLeave |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
2272 set statusline= |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
2273 endfunc |
16241
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2274 |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2275 func Test_terminal_getwinpos() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
2276 CheckRunVimInTerminal |
16255
d0fef9cb6a9b
patch 8.1.1132: getwinpos() test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
16253
diff
changeset
|
2277 |
16241
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2278 " split, go to the bottom-right window |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2279 split |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2280 wincmd j |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2281 set splitright |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2282 |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2283 call writefile([ |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2284 \ 'echo getwinpos()', |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2285 \ ], 'XTest_getwinpos') |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2286 let buf = RunVimInTerminal('-S XTest_getwinpos', {'cols': 60}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2287 call TermWait(buf) |
16241
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2288 |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2289 " Find the output of getwinpos() in the bottom line. |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2290 let rows = term_getsize(buf)[0] |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2291 call WaitForAssert({-> assert_match('\[\d\+, \d\+\]', term_getline(buf, rows))}) |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2292 let line = term_getline(buf, rows) |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2293 let xpos = str2nr(substitute(line, '\[\(\d\+\), \d\+\]', '\1', '')) |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2294 let ypos = str2nr(substitute(line, '\[\d\+, \(\d\+\)\]', '\1', '')) |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2295 |
16255
d0fef9cb6a9b
patch 8.1.1132: getwinpos() test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
16253
diff
changeset
|
2296 " Position must be bigger than the getwinpos() result of Vim itself. |
16318
3019a0744c46
patch 8.1.1164: gettitle test is failing when server name differs
Bram Moolenaar <Bram@vim.org>
parents:
16314
diff
changeset
|
2297 " The calculation in the console assumes a 10 x 7 character cell. |
16273
397ab6afe01b
patch 8.1.1141: terminal winpos test fails with very large terminal
Bram Moolenaar <Bram@vim.org>
parents:
16255
diff
changeset
|
2298 " In the GUI it can be more, let's assume a 20 x 14 cell. |
397ab6afe01b
patch 8.1.1141: terminal winpos test fails with very large terminal
Bram Moolenaar <Bram@vim.org>
parents:
16255
diff
changeset
|
2299 " And then add 100 / 200 tolerance. |
16255
d0fef9cb6a9b
patch 8.1.1132: getwinpos() test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
16253
diff
changeset
|
2300 let [xroot, yroot] = getwinpos() |
17912
9fac6d0de69a
patch 8.1.1952: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17702
diff
changeset
|
2301 let winpos = 50->getwinpos() |
9fac6d0de69a
patch 8.1.1952: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17702
diff
changeset
|
2302 call assert_equal(xroot, winpos[0]) |
9fac6d0de69a
patch 8.1.1952: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17702
diff
changeset
|
2303 call assert_equal(yroot, winpos[1]) |
16273
397ab6afe01b
patch 8.1.1141: terminal winpos test fails with very large terminal
Bram Moolenaar <Bram@vim.org>
parents:
16255
diff
changeset
|
2304 let [winrow, wincol] = win_screenpos('.') |
397ab6afe01b
patch 8.1.1141: terminal winpos test fails with very large terminal
Bram Moolenaar <Bram@vim.org>
parents:
16255
diff
changeset
|
2305 let xoff = wincol * (has('gui_running') ? 14 : 7) + 100 |
397ab6afe01b
patch 8.1.1141: terminal winpos test fails with very large terminal
Bram Moolenaar <Bram@vim.org>
parents:
16255
diff
changeset
|
2306 let yoff = winrow * (has('gui_running') ? 20 : 10) + 200 |
397ab6afe01b
patch 8.1.1141: terminal winpos test fails with very large terminal
Bram Moolenaar <Bram@vim.org>
parents:
16255
diff
changeset
|
2307 call assert_inrange(xroot + 2, xroot + xoff, xpos) |
397ab6afe01b
patch 8.1.1141: terminal winpos test fails with very large terminal
Bram Moolenaar <Bram@vim.org>
parents:
16255
diff
changeset
|
2308 call assert_inrange(yroot + 2, yroot + yoff, ypos) |
16241
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2309 |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2310 call TermWait(buf) |
16241
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2311 call term_sendkeys(buf, ":q\<CR>") |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2312 call StopVimInTerminal(buf) |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2313 call delete('XTest_getwinpos') |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2314 exe buf . 'bwipe!' |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2315 set splitright& |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2316 only! |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
2317 endfunc |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
2318 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
2319 func Test_terminal_altscreen() |
18041
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
2320 " somehow doesn't work on MS-Windows |
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
2321 CheckUnix |
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
2322 let cmd = "cat Xtext\<CR>" |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
2323 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
2324 let buf = term_start(&shell, {}) |
18039
ef5720fb6f41
patch 8.1.2015: terminal altscreen test still fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
18037
diff
changeset
|
2325 call writefile(["\<Esc>[?1047h"], 'Xtext') |
ef5720fb6f41
patch 8.1.2015: terminal altscreen test still fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
18037
diff
changeset
|
2326 call term_sendkeys(buf, cmd) |
18037
6a7b778119f1
patch 8.1.2014: terminal altscreen test fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
2327 call WaitForAssert({-> assert_equal(1, term_getaltscreen(buf))}) |
6a7b778119f1
patch 8.1.2014: terminal altscreen test fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
2328 |
18039
ef5720fb6f41
patch 8.1.2015: terminal altscreen test still fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
18037
diff
changeset
|
2329 call writefile(["\<Esc>[?1047l"], 'Xtext') |
ef5720fb6f41
patch 8.1.2015: terminal altscreen test still fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
18037
diff
changeset
|
2330 call term_sendkeys(buf, cmd) |
18037
6a7b778119f1
patch 8.1.2014: terminal altscreen test fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
2331 call WaitForAssert({-> assert_equal(0, term_getaltscreen(buf))}) |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
2332 |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
2333 call term_sendkeys(buf, "exit\r") |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
2334 exe buf . "bwipe!" |
18039
ef5720fb6f41
patch 8.1.2015: terminal altscreen test still fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
18037
diff
changeset
|
2335 call delete('Xtext') |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
2336 endfunc |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2337 |
18514
39b0c28fe495
patch 8.1.2251: ":term command" may not work without a shell
Bram Moolenaar <Bram@vim.org>
parents:
18473
diff
changeset
|
2338 func Test_terminal_shell_option() |
18522
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2339 if has('unix') |
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2340 " exec is a shell builtin command, should fail without a shell. |
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2341 term exec ls runtest.vim |
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2342 call WaitForAssert({-> assert_match('job failed', term_getline(bufnr(), 1))}) |
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2343 bwipe! |
18514
39b0c28fe495
patch 8.1.2251: ":term command" may not work without a shell
Bram Moolenaar <Bram@vim.org>
parents:
18473
diff
changeset
|
2344 |
18522
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2345 term ++shell exec ls runtest.vim |
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2346 call WaitForAssert({-> assert_match('runtest.vim', term_getline(bufnr(), 1))}) |
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2347 bwipe! |
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2348 elseif has('win32') |
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2349 " dir is a shell builtin command, should fail without a shell. |
18532
6fe1d322710d
patch 8.1.2260: terminal test may fail on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18524
diff
changeset
|
2350 try |
6fe1d322710d
patch 8.1.2260: terminal test may fail on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18524
diff
changeset
|
2351 term dir /b runtest.vim |
6fe1d322710d
patch 8.1.2260: terminal test may fail on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18524
diff
changeset
|
2352 call WaitForAssert({-> assert_match('job failed\|cannot access .*: No such file or directory', term_getline(bufnr(), 1))}) |
6fe1d322710d
patch 8.1.2260: terminal test may fail on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18524
diff
changeset
|
2353 catch /CreateProcess/ |
6fe1d322710d
patch 8.1.2260: terminal test may fail on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18524
diff
changeset
|
2354 " ignore |
6fe1d322710d
patch 8.1.2260: terminal test may fail on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18524
diff
changeset
|
2355 endtry |
18522
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2356 bwipe! |
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2357 |
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2358 term ++shell dir /b runtest.vim |
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2359 call WaitForAssert({-> assert_match('runtest.vim', term_getline(bufnr(), 1))}) |
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2360 bwipe! |
dfdc29643c91
patch 8.1.2255: ":term ++shell" does not work on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18514
diff
changeset
|
2361 endif |
18514
39b0c28fe495
patch 8.1.2251: ":term command" may not work without a shell
Bram Moolenaar <Bram@vim.org>
parents:
18473
diff
changeset
|
2362 endfunc |
39b0c28fe495
patch 8.1.2251: ":term command" may not work without a shell
Bram Moolenaar <Bram@vim.org>
parents:
18473
diff
changeset
|
2363 |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2364 func Test_terminal_setapi_and_call() |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2365 CheckRunVimInTerminal |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2366 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2367 call WriteApiCall('Tapi_TryThis') |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2368 call ch_logfile('Xlog', 'w') |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2369 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2370 unlet! g:called_bufnum |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2371 unlet! g:called_arg |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2372 |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2373 let buf = RunVimInTerminal('-S Xscript', {'term_api': ''}) |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2374 call WaitForAssert({-> assert_match('Unpermitted function: Tapi_TryThis', string(readfile('Xlog')))}) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2375 call assert_false(exists('g:called_bufnum')) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2376 call assert_false(exists('g:called_arg')) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2377 |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2378 eval buf->term_setapi('Tapi_') |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2379 call term_sendkeys(buf, ":set notitle\<CR>") |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2380 call term_sendkeys(buf, ":source Xscript\<CR>") |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2381 call WaitFor({-> exists('g:called_bufnum')}) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2382 call assert_equal(buf, g:called_bufnum) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2383 call assert_equal(['hello', 123], g:called_arg) |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2384 |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2385 call StopVimInTerminal(buf) |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2386 |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2387 call delete('Xscript') |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2388 call ch_logfile('') |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2389 call delete('Xlog') |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2390 unlet! g:called_bufnum |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2391 unlet! g:called_arg |
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18143
diff
changeset
|
2392 endfunc |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2393 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2394 func Test_terminal_api_arg() |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2395 CheckRunVimInTerminal |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2396 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2397 call WriteApiCall('Tapi_TryThis') |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2398 call ch_logfile('Xlog', 'w') |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2399 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2400 unlet! g:called_bufnum |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2401 unlet! g:called_arg |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2402 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2403 execute 'term ++api= ' .. GetVimCommandCleanTerm() .. '-S Xscript' |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2404 let buf = bufnr('%') |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2405 call WaitForAssert({-> assert_match('Unpermitted function: Tapi_TryThis', string(readfile('Xlog')))}) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2406 call assert_false(exists('g:called_bufnum')) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2407 call assert_false(exists('g:called_arg')) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2408 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2409 call StopVimInTerminal(buf) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2410 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2411 call ch_logfile('Xlog', 'w') |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2412 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2413 execute 'term ++api=Tapi_ ' .. GetVimCommandCleanTerm() .. '-S Xscript' |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2414 let buf = bufnr('%') |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2415 call WaitFor({-> exists('g:called_bufnum')}) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2416 call assert_equal(buf, g:called_bufnum) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2417 call assert_equal(['hello', 123], g:called_arg) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2418 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2419 call StopVimInTerminal(buf) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2420 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2421 call delete('Xscript') |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2422 call ch_logfile('') |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2423 call delete('Xlog') |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2424 unlet! g:called_bufnum |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2425 unlet! g:called_arg |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
2426 endfunc |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2427 |
19740
a653d1a165ef
patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19715
diff
changeset
|
2428 func Test_terminal_invalid_arg() |
a653d1a165ef
patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19715
diff
changeset
|
2429 call assert_fails('terminal ++xyz', 'E181:') |
a653d1a165ef
patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19715
diff
changeset
|
2430 endfunc |
a653d1a165ef
patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19715
diff
changeset
|
2431 |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2432 func Test_terminal_in_popup() |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2433 CheckRunVimInTerminal |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2434 |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2435 let text =<< trim END |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2436 some text |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2437 to edit |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2438 in a popup window |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2439 END |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2440 call writefile(text, 'Xtext') |
19273
a4b65930a0dc
patch 8.2.0195: some tests fail when run in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
19271
diff
changeset
|
2441 let cmd = GetVimCommandCleanTerm() |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2442 let lines = [ |
19398
f0033a10b613
patch 8.2.0257: cannot recognize a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19358
diff
changeset
|
2443 \ 'set t_u7=', |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2444 \ 'call setline(1, range(20))', |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2445 \ 'hi PopTerm ctermbg=grey', |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2446 \ 'func OpenTerm(setColor)', |
19651
283c8bc6a8e2
patch 8.2.0382: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
2447 \ " set noruler", |
19457
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19417
diff
changeset
|
2448 \ " let s:buf = term_start('" .. cmd .. " Xtext', #{hidden: 1, term_finish: 'close'})", |
19552
d9b365f791d5
patch 8.2.0333: terminal in popup test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19542
diff
changeset
|
2449 \ ' let g:winid = popup_create(s:buf, #{minwidth: 45, minheight: 7, border: [], drag: 1, resize: 1})', |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2450 \ ' if a:setColor', |
19552
d9b365f791d5
patch 8.2.0333: terminal in popup test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19542
diff
changeset
|
2451 \ ' call win_execute(g:winid, "set wincolor=PopTerm")', |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2452 \ ' endif', |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2453 \ 'endfunc', |
19312
18fc30542bf5
patch 8.2.0214: a popup window with a terminal can be made hidden
Bram Moolenaar <Bram@vim.org>
parents:
19273
diff
changeset
|
2454 \ 'func HidePopup()', |
19552
d9b365f791d5
patch 8.2.0333: terminal in popup test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19542
diff
changeset
|
2455 \ ' call popup_hide(g:winid)', |
19312
18fc30542bf5
patch 8.2.0214: a popup window with a terminal can be made hidden
Bram Moolenaar <Bram@vim.org>
parents:
19273
diff
changeset
|
2456 \ 'endfunc', |
19457
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19417
diff
changeset
|
2457 \ 'func ClosePopup()', |
19552
d9b365f791d5
patch 8.2.0333: terminal in popup test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19542
diff
changeset
|
2458 \ ' call popup_close(g:winid)', |
19457
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19417
diff
changeset
|
2459 \ 'endfunc', |
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19417
diff
changeset
|
2460 \ 'func ReopenPopup()', |
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19417
diff
changeset
|
2461 \ ' call popup_create(s:buf, #{minwidth: 40, minheight: 6, border: []})', |
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19417
diff
changeset
|
2462 \ 'endfunc', |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2463 \ ] |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2464 call writefile(lines, 'XtermPopup') |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2465 let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2466 call TermWait(buf, 100) |
19552
d9b365f791d5
patch 8.2.0333: terminal in popup test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19542
diff
changeset
|
2467 call term_sendkeys(buf, ":call OpenTerm(0)\<CR>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2468 call TermWait(buf, 100) |
19402
763775897f2e
patch 8.2.0259: terminal in popup test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
19398
diff
changeset
|
2469 call term_sendkeys(buf, ":\<CR>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2470 call TermWait(buf, 100) |
19552
d9b365f791d5
patch 8.2.0333: terminal in popup test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19542
diff
changeset
|
2471 call term_sendkeys(buf, "\<C-W>:echo getwinvar(g:winid, \"&buftype\") win_gettype(g:winid)\<CR>") |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2472 call VerifyScreenDump(buf, 'Test_terminal_popup_1', {}) |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2473 |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2474 call term_sendkeys(buf, ":q\<CR>") |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2475 call VerifyScreenDump(buf, 'Test_terminal_popup_2', {}) |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2476 |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2477 call term_sendkeys(buf, ":call OpenTerm(1)\<CR>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2478 call TermWait(buf, 150) |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2479 call term_sendkeys(buf, ":set hlsearch\<CR>") |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2480 call term_sendkeys(buf, "/edit\<CR>") |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2481 call VerifyScreenDump(buf, 'Test_terminal_popup_3', {}) |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2482 |
19324
276e24e916d5
patch 8.2.0220: terminal test did pass on Mac
Bram Moolenaar <Bram@vim.org>
parents:
19322
diff
changeset
|
2483 call term_sendkeys(buf, "\<C-W>:call HidePopup()\<CR>") |
276e24e916d5
patch 8.2.0220: terminal test did pass on Mac
Bram Moolenaar <Bram@vim.org>
parents:
19322
diff
changeset
|
2484 call VerifyScreenDump(buf, 'Test_terminal_popup_4', {}) |
276e24e916d5
patch 8.2.0220: terminal test did pass on Mac
Bram Moolenaar <Bram@vim.org>
parents:
19322
diff
changeset
|
2485 call term_sendkeys(buf, "\<CR>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2486 call TermWait(buf, 50) |
19312
18fc30542bf5
patch 8.2.0214: a popup window with a terminal can be made hidden
Bram Moolenaar <Bram@vim.org>
parents:
19273
diff
changeset
|
2487 |
19457
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19417
diff
changeset
|
2488 call term_sendkeys(buf, "\<C-W>:call ClosePopup()\<CR>") |
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19417
diff
changeset
|
2489 call VerifyScreenDump(buf, 'Test_terminal_popup_5', {}) |
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19417
diff
changeset
|
2490 |
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19417
diff
changeset
|
2491 call term_sendkeys(buf, "\<C-W>:call ReopenPopup()\<CR>") |
b70fbf3f0e0b
patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
19417
diff
changeset
|
2492 call VerifyScreenDump(buf, 'Test_terminal_popup_6', {}) |
19542
9e428147e4ee
patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents:
19540
diff
changeset
|
2493 |
9e428147e4ee
patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents:
19540
diff
changeset
|
2494 " Go to terminal-Normal mode and visually select text. |
9e428147e4ee
patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents:
19540
diff
changeset
|
2495 call term_sendkeys(buf, "\<C-W>Ngg/in\<CR>vww") |
9e428147e4ee
patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents:
19540
diff
changeset
|
2496 call VerifyScreenDump(buf, 'Test_terminal_popup_7', {}) |
9e428147e4ee
patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents:
19540
diff
changeset
|
2497 |
9e428147e4ee
patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents:
19540
diff
changeset
|
2498 " Back to job mode, redraws |
9e428147e4ee
patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents:
19540
diff
changeset
|
2499 call term_sendkeys(buf, "A") |
9e428147e4ee
patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents:
19540
diff
changeset
|
2500 call VerifyScreenDump(buf, 'Test_terminal_popup_8', {}) |
9e428147e4ee
patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents:
19540
diff
changeset
|
2501 |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2502 call TermWait(buf, 50) |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2503 call term_sendkeys(buf, ":q\<CR>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2504 call TermWait(buf, 100) " wait for terminal to vanish |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2505 |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2506 call StopVimInTerminal(buf) |
19647
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2507 call delete('Xtext') |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2508 call delete('XtermPopup') |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2509 endfunc |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2510 |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2511 " Check a terminal in popup window uses the default mininum size. |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2512 func Test_terminal_in_popup_min_size() |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2513 CheckRunVimInTerminal |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2514 |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2515 let text =<< trim END |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2516 another text |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2517 to show |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2518 in a popup window |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2519 END |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2520 call writefile(text, 'Xtext') |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2521 let lines = [ |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2522 \ 'set t_u7=', |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2523 \ 'call setline(1, range(20))', |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2524 \ 'func OpenTerm()', |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2525 \ " let s:buf = term_start('cat Xtext', #{hidden: 1})", |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2526 \ ' let g:winid = popup_create(s:buf, #{ border: []})', |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2527 \ 'endfunc', |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2528 \ ] |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2529 call writefile(lines, 'XtermPopup') |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2530 let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2531 call TermWait(buf, 100) |
19651
283c8bc6a8e2
patch 8.2.0382: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents:
19647
diff
changeset
|
2532 call term_sendkeys(buf, ":set noruler\<CR>") |
19647
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2533 call term_sendkeys(buf, ":call OpenTerm()\<CR>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2534 call TermWait(buf, 50) |
19647
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2535 call term_sendkeys(buf, ":\<CR>") |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2536 call VerifyScreenDump(buf, 'Test_terminal_popup_m1', {}) |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2537 |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2538 call TermWait(buf, 50) |
19647
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2539 call term_sendkeys(buf, ":q\<CR>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2540 call TermWait(buf, 50) " wait for terminal to vanish |
19647
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2541 call StopVimInTerminal(buf) |
c8cb1a41f64c
patch 8.2.0380: tiny popup when creating a terminal popup without minwidth
Bram Moolenaar <Bram@vim.org>
parents:
19639
diff
changeset
|
2542 call delete('Xtext') |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2543 call delete('XtermPopup') |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19245
diff
changeset
|
2544 endfunc |
19358
734ca70c1f12
patch 8.2.0237: crash when setting 'wincolor' on finished terminal window
Bram Moolenaar <Bram@vim.org>
parents:
19344
diff
changeset
|
2545 |
19797
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2546 " Check a terminal in popup window with different colors |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2547 func Terminal_in_popup_colored(group_name, highlight_cmd, highlight_opt) |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2548 CheckRunVimInTerminal |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2549 CheckUnix |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2550 |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2551 let lines = [ |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2552 \ 'set t_u7=', |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2553 \ 'call setline(1, range(20))', |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2554 \ 'func OpenTerm()', |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2555 \ " let s:buf = term_start('cat', #{hidden: 1, " |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2556 \ .. a:highlight_opt .. "})", |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2557 \ ' let g:winid = popup_create(s:buf, #{ border: []})', |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2558 \ 'endfunc', |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2559 \ a:highlight_cmd, |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2560 \ ] |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2561 call writefile(lines, 'XtermPopup') |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2562 let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2563 call TermWait(buf, 100) |
19797
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2564 call term_sendkeys(buf, ":set noruler\<CR>") |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2565 call term_sendkeys(buf, ":call OpenTerm()\<CR>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2566 call TermWait(buf, 50) |
19797
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2567 call term_sendkeys(buf, "hello\<CR>") |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2568 call VerifyScreenDump(buf, 'Test_terminal_popup_' .. a:group_name, {}) |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2569 |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2570 call term_sendkeys(buf, "\<C-D>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2571 call TermWait(buf, 50) |
19797
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2572 call term_sendkeys(buf, ":q\<CR>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2573 call TermWait(buf, 50) " wait for terminal to vanish |
19797
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2574 call StopVimInTerminal(buf) |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2575 call delete('XtermPopup') |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2576 endfunc |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2577 |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2578 func Test_terminal_in_popup_colored_Terminal() |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2579 call Terminal_in_popup_colored("Terminal", "highlight Terminal ctermfg=blue ctermbg=yellow", "") |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2580 endfunc |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2581 |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2582 func Test_terminal_in_popup_colored_group() |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2583 call Terminal_in_popup_colored("MyTermCol", "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue", "term_highlight: 'MyTermCol',") |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2584 endfunc |
d73d982499ae
patch 8.2.0455: cannot set the highlight group for a specific terminal
Bram Moolenaar <Bram@vim.org>
parents:
19781
diff
changeset
|
2585 |
19540
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19513
diff
changeset
|
2586 func Test_double_popup_terminal() |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19513
diff
changeset
|
2587 let buf1 = term_start(&shell, #{hidden: 1}) |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19513
diff
changeset
|
2588 let win1 = popup_create(buf1, {}) |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19513
diff
changeset
|
2589 let buf2 = term_start(&shell, #{hidden: 1}) |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19513
diff
changeset
|
2590 let win2 = popup_create(buf2, {}) |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19513
diff
changeset
|
2591 call popup_close(win1) |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19513
diff
changeset
|
2592 call popup_close(win2) |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19513
diff
changeset
|
2593 exe buf1 .. 'bwipe!' |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19513
diff
changeset
|
2594 exe buf2 .. 'bwipe!' |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19513
diff
changeset
|
2595 endfunc |
9f07a6c172f2
patch 8.2.0327: crash when opening and closing two popup terminal windows
Bram Moolenaar <Bram@vim.org>
parents:
19513
diff
changeset
|
2596 |
19358
734ca70c1f12
patch 8.2.0237: crash when setting 'wincolor' on finished terminal window
Bram Moolenaar <Bram@vim.org>
parents:
19344
diff
changeset
|
2597 func Test_issue_5607() |
734ca70c1f12
patch 8.2.0237: crash when setting 'wincolor' on finished terminal window
Bram Moolenaar <Bram@vim.org>
parents:
19344
diff
changeset
|
2598 let wincount = winnr('$') |
734ca70c1f12
patch 8.2.0237: crash when setting 'wincolor' on finished terminal window
Bram Moolenaar <Bram@vim.org>
parents:
19344
diff
changeset
|
2599 exe 'terminal' &shell &shellcmdflag 'exit' |
734ca70c1f12
patch 8.2.0237: crash when setting 'wincolor' on finished terminal window
Bram Moolenaar <Bram@vim.org>
parents:
19344
diff
changeset
|
2600 let job = term_getjob(bufnr()) |
734ca70c1f12
patch 8.2.0237: crash when setting 'wincolor' on finished terminal window
Bram Moolenaar <Bram@vim.org>
parents:
19344
diff
changeset
|
2601 call WaitForAssert({-> assert_equal("dead", job_status(job))}) |
734ca70c1f12
patch 8.2.0237: crash when setting 'wincolor' on finished terminal window
Bram Moolenaar <Bram@vim.org>
parents:
19344
diff
changeset
|
2602 |
734ca70c1f12
patch 8.2.0237: crash when setting 'wincolor' on finished terminal window
Bram Moolenaar <Bram@vim.org>
parents:
19344
diff
changeset
|
2603 let old_wincolor = &wincolor |
734ca70c1f12
patch 8.2.0237: crash when setting 'wincolor' on finished terminal window
Bram Moolenaar <Bram@vim.org>
parents:
19344
diff
changeset
|
2604 try |
734ca70c1f12
patch 8.2.0237: crash when setting 'wincolor' on finished terminal window
Bram Moolenaar <Bram@vim.org>
parents:
19344
diff
changeset
|
2605 set wincolor= |
734ca70c1f12
patch 8.2.0237: crash when setting 'wincolor' on finished terminal window
Bram Moolenaar <Bram@vim.org>
parents:
19344
diff
changeset
|
2606 finally |
734ca70c1f12
patch 8.2.0237: crash when setting 'wincolor' on finished terminal window
Bram Moolenaar <Bram@vim.org>
parents:
19344
diff
changeset
|
2607 let &wincolor = old_wincolor |
734ca70c1f12
patch 8.2.0237: crash when setting 'wincolor' on finished terminal window
Bram Moolenaar <Bram@vim.org>
parents:
19344
diff
changeset
|
2608 bw! |
734ca70c1f12
patch 8.2.0237: crash when setting 'wincolor' on finished terminal window
Bram Moolenaar <Bram@vim.org>
parents:
19344
diff
changeset
|
2609 endtry |
734ca70c1f12
patch 8.2.0237: crash when setting 'wincolor' on finished terminal window
Bram Moolenaar <Bram@vim.org>
parents:
19344
diff
changeset
|
2610 endfunc |
19513
274052873790
patch 8.2.0314: short name not set for terminal buffer
Bram Moolenaar <Bram@vim.org>
parents:
19493
diff
changeset
|
2611 |
274052873790
patch 8.2.0314: short name not set for terminal buffer
Bram Moolenaar <Bram@vim.org>
parents:
19493
diff
changeset
|
2612 func Test_hidden_terminal() |
274052873790
patch 8.2.0314: short name not set for terminal buffer
Bram Moolenaar <Bram@vim.org>
parents:
19493
diff
changeset
|
2613 let buf = term_start(&shell, #{hidden: 1}) |
274052873790
patch 8.2.0314: short name not set for terminal buffer
Bram Moolenaar <Bram@vim.org>
parents:
19493
diff
changeset
|
2614 call assert_equal('', bufname('^$')) |
274052873790
patch 8.2.0314: short name not set for terminal buffer
Bram Moolenaar <Bram@vim.org>
parents:
19493
diff
changeset
|
2615 call StopShellInTerminal(buf) |
274052873790
patch 8.2.0314: short name not set for terminal buffer
Bram Moolenaar <Bram@vim.org>
parents:
19493
diff
changeset
|
2616 endfunc |
19629
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2617 |
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2618 func Test_term_nasty_callback() |
20219
820f24dc1e3e
patch 8.2.0665: wrongly assuming Python executable is called "python"
Bram Moolenaar <Bram@vim.org>
parents:
20178
diff
changeset
|
2619 CheckExecutable sh |
19629
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2620 func OpenTerms() |
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2621 set hidden |
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2622 let g:buf0 = term_start('sh', #{hidden: 1}) |
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2623 call popup_create(g:buf0, {}) |
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2624 let g:buf1 = term_start('sh', #{hidden: 1, term_finish: 'close'}) |
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2625 call popup_create(g:buf1, {}) |
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2626 let g:buf2 = term_start(['sh', '-c'], #{curwin: 1, exit_cb: function('TermExit')}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2627 call TermWait(g:buf2, 50) |
19629
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2628 call popup_close(win_getid()) |
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2629 endfunc |
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2630 func TermExit(...) |
19840
9981509b665f
patch 8.2.0476: terminal nasty callback test fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
19797
diff
changeset
|
2631 let altbuf = bufnr('#') |
9981509b665f
patch 8.2.0476: terminal nasty callback test fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
19797
diff
changeset
|
2632 call term_sendkeys(altbuf, "exit\<CR>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2633 call TermWait(altbuf) |
19629
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2634 call popup_close(win_getid()) |
19752
0927df746554
patch 8.2.0432: a few tests fail in a huge terminal
Bram Moolenaar <Bram@vim.org>
parents:
19740
diff
changeset
|
2635 endfunc |
19629
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2636 call OpenTerms() |
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2637 |
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2638 call term_sendkeys(g:buf0, "exit\<CR>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
2639 call TermWait(g:buf0, 50) |
19679
9199f34d838e
patch 8.2.0396: cmdexpand.c insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19667
diff
changeset
|
2640 exe g:buf0 .. 'bwipe!' |
19629
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2641 set hidden& |
804322d6c6ba
patch 8.2.0371: crash with combination of terminal popup and autocmd
Bram Moolenaar <Bram@vim.org>
parents:
19589
diff
changeset
|
2642 endfunc |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
2643 |
20097
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2644 func Test_term_and_startinsert() |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2645 CheckRunVimInTerminal |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2646 CheckUnix |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2647 |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2648 let lines =<< trim EOL |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2649 put='some text' |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2650 term |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2651 startinsert |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2652 EOL |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2653 call writefile(lines, 'XTest_startinsert') |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2654 let buf = RunVimInTerminal('-S XTest_startinsert', {}) |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2655 |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2656 call term_sendkeys(buf, "exit\r") |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2657 call WaitForAssert({-> assert_equal("some text", term_getline(buf, 1))}) |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2658 call term_sendkeys(buf, "0l") |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2659 call term_sendkeys(buf, "A<\<Esc>") |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2660 call WaitForAssert({-> assert_equal("some text<", term_getline(buf, 1))}) |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2661 |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2662 call StopVimInTerminal(buf) |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2663 call delete('XTest_startinsert') |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2664 endfunc |
165ec447ca77
patch 8.2.0604: :startinsert in a terminal window used later
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
2665 |
20178
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2666 " Test for passing invalid arguments to terminal functions |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2667 func Test_term_func_invalid_arg() |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2668 call assert_fails('let b = term_getaltscreen([])', 'E745:') |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2669 call assert_fails('let p = term_getansicolors([])', 'E745:') |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2670 call assert_fails('let a = term_getattr(1, [])', 'E730:') |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2671 call assert_fails('let c = term_getcursor([])', 'E745:') |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2672 call assert_fails('let l = term_getline([], 1)', 'E745:') |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2673 call assert_fails('let l = term_getscrolled([])', 'E745:') |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2674 call assert_fails('let s = term_getsize([])', 'E745:') |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2675 call assert_fails('let s = term_getstatus([])', 'E745:') |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2676 call assert_fails('let s = term_scrape([], 1)', 'E745:') |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2677 call assert_fails('call term_sendkeys([], "a")', 'E745:') |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2678 call assert_fails('call term_setansicolors([], [])', 'E745:') |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2679 call assert_fails('call term_setapi([], "")', 'E745:') |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2680 call assert_fails('call term_setrestore([], "")', 'E745:') |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2681 call assert_fails('call term_setkill([], "")', 'E745:') |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2682 endfunc |
2fb397573541
patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents:
20097
diff
changeset
|
2683 |
20365
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2684 " Test for sending various special keycodes to a terminal |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2685 func Test_term_keycode_translation() |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2686 CheckRunVimInTerminal |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2687 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2688 let buf = RunVimInTerminal('', {}) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2689 call term_sendkeys(buf, ":set nocompatible\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2690 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2691 let keys = ["\<F1>", "\<F2>", "\<F3>", "\<F4>", "\<F5>", "\<F6>", "\<F7>", |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2692 \ "\<F8>", "\<F9>", "\<F10>", "\<F11>", "\<F12>", "\<Home>", |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2693 \ "\<S-Home>", "\<C-Home>", "\<End>", "\<S-End>", "\<C-End>", |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2694 \ "\<Ins>", "\<Del>", "\<Left>", "\<S-Left>", "\<C-Left>", "\<Right>", |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2695 \ "\<S-Right>", "\<C-Right>", "\<Up>", "\<S-Up>", "\<Down>", |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2696 \ "\<S-Down>"] |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2697 let output = ['<F1>', '<F2>', '<F3>', '<F4>', '<F5>', '<F6>', '<F7>', |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2698 \ '<F8>', '<F9>', '<F10>', '<F11>', '<F12>', '<Home>', '<S-Home>', |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2699 \ '<C-Home>', '<End>', '<S-End>', '<C-End>', '<Insert>', '<Del>', |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2700 \ '<Left>', '<S-Left>', '<C-Left>', '<Right>', '<S-Right>', |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2701 \ '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2702 \ '0123456789', "\t\t.+-*/"] |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2703 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2704 for k in keys |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2705 call term_sendkeys(buf, "i\<C-K>" .. k .. "\<CR>\<C-\>\<C-N>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2706 endfor |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2707 call term_sendkeys(buf, "i\<K0>\<K1>\<K2>\<K3>\<K4>\<K5>\<K6>\<K7>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2708 call term_sendkeys(buf, "\<K8>\<K9>\<kEnter>\<kPoint>\<kPlus>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2709 call term_sendkeys(buf, "\<kMinus>\<kMultiply>\<kDivide>\<C-\>\<C-N>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2710 call term_sendkeys(buf, "\<Home>\<Ins>\<Tab>\<S-Tab>\<C-\>\<C-N>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2711 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2712 call term_sendkeys(buf, ":write Xkeycodes\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2713 call term_wait(buf) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2714 call StopVimInTerminal(buf) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2715 call assert_equal(output, readfile('Xkeycodes')) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2716 call delete('Xkeycodes') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2717 endfunc |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2718 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2719 " Test for using the mouse in a terminal |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2720 func Test_term_mouse() |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2721 CheckNotGui |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2722 CheckRunVimInTerminal |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2723 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2724 let save_mouse = &mouse |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2725 let save_term = &term |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2726 let save_ttymouse = &ttymouse |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2727 let save_clipboard = &clipboard |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2728 call test_override('no_query_mouse', 1) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2729 set mouse=a term=xterm ttymouse=sgr mousetime=200 clipboard= |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2730 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2731 let lines =<< trim END |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2732 one two three four five |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2733 red green yellow red blue |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2734 vim emacs sublime nano |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2735 END |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2736 call writefile(lines, 'Xtest_mouse') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2737 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2738 let buf = RunVimInTerminal('Xtest_mouse -n', {}) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2739 call term_sendkeys(buf, ":set nocompatible\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2740 call term_sendkeys(buf, ":set mouse=a term=xterm ttymouse=sgr\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2741 call term_sendkeys(buf, ":set clipboard=\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2742 call term_sendkeys(buf, ":set mousemodel=extend\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2743 call term_wait(buf) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2744 redraw! |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2745 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2746 " Test for <LeftMouse> click/release |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2747 call test_setmouse(2, 5) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2748 call feedkeys("\<LeftMouse>\<LeftRelease>", 'xt') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2749 call test_setmouse(3, 8) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2750 call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2751 call term_wait(buf, 50) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2752 call term_sendkeys(buf, ":call writefile([json_encode(getpos('.'))], 'Xbuf')\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2753 call term_wait(buf, 50) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2754 let pos = json_decode(readfile('Xbuf')[0]) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2755 call assert_equal([3, 8], pos[1:2]) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2756 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2757 " Test for selecting text using mouse |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2758 call delete('Xbuf') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2759 call test_setmouse(2, 11) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2760 call term_sendkeys(buf, "\<LeftMouse>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2761 call test_setmouse(2, 16) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2762 call term_sendkeys(buf, "\<LeftRelease>y") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2763 call term_wait(buf, 50) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2764 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2765 call term_wait(buf, 50) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2766 call assert_equal('yellow', readfile('Xbuf')[0]) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2767 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2768 " Test for selecting text using doubleclick |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2769 call delete('Xbuf') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2770 call test_setmouse(1, 11) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2771 call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>\<LeftMouse>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2772 call test_setmouse(1, 17) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2773 call term_sendkeys(buf, "\<LeftRelease>y") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2774 call term_wait(buf, 50) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2775 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2776 call term_wait(buf, 50) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2777 call assert_equal('three four', readfile('Xbuf')[0]) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2778 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2779 " Test for selecting a line using triple click |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2780 call delete('Xbuf') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2781 call test_setmouse(3, 2) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2782 call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>y") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2783 call term_wait(buf, 50) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2784 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2785 call term_wait(buf, 50) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2786 call assert_equal("vim emacs sublime nano\n", readfile('Xbuf')[0]) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2787 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2788 " Test for selecting a block using qudraple click |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2789 call delete('Xbuf') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2790 call test_setmouse(1, 11) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2791 call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>\<LeftMouse>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2792 call test_setmouse(3, 13) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2793 call term_sendkeys(buf, "\<LeftRelease>y") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2794 call term_wait(buf, 50) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2795 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2796 call term_wait(buf, 50) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2797 call assert_equal("ree\nyel\nsub", readfile('Xbuf')[0]) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2798 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2799 " Test for extending a selection using right click |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2800 call delete('Xbuf') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2801 call test_setmouse(2, 9) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2802 call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2803 call test_setmouse(2, 16) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2804 call term_sendkeys(buf, "\<RightMouse>\<RightRelease>y") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2805 call term_wait(buf, 50) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2806 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2807 call term_wait(buf, 50) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2808 call assert_equal("n yellow", readfile('Xbuf')[0]) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2809 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2810 " Test for pasting text using middle click |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2811 call delete('Xbuf') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2812 call term_sendkeys(buf, ":let @r='bright '\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2813 call test_setmouse(2, 22) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2814 call term_sendkeys(buf, "\"r\<MiddleMouse>\<MiddleRelease>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2815 call term_wait(buf, 50) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2816 call term_sendkeys(buf, ":call writefile([getline(2)], 'Xbuf')\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2817 call term_wait(buf, 50) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2818 call assert_equal("red bright blue", readfile('Xbuf')[0][-15:]) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2819 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2820 " cleanup |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2821 call term_wait(buf) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2822 call StopVimInTerminal(buf) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2823 let &mouse = save_mouse |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2824 let &term = save_term |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2825 let &ttymouse = save_ttymouse |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2826 let &clipboard = save_clipboard |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2827 set mousetime& |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2828 call test_override('no_query_mouse', 0) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2829 call delete('Xtest_mouse') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2830 call delete('Xbuf') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2831 endfunc |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2832 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2833 " Test for modeless selection in a terminal |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2834 func Test_term_modeless_selection() |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2835 CheckUnix |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2836 CheckNotGui |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2837 CheckRunVimInTerminal |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2838 CheckFeature clipboard_working |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2839 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2840 let save_mouse = &mouse |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2841 let save_term = &term |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2842 let save_ttymouse = &ttymouse |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2843 call test_override('no_query_mouse', 1) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2844 set mouse=a term=xterm ttymouse=sgr mousetime=200 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2845 set clipboard=autoselectml |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2846 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2847 let lines =<< trim END |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2848 one two three four five |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2849 red green yellow red blue |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2850 vim emacs sublime nano |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2851 END |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2852 call writefile(lines, 'Xtest_modeless') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2853 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2854 let buf = RunVimInTerminal('Xtest_modeless -n', {}) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2855 call term_sendkeys(buf, ":set nocompatible\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2856 call term_sendkeys(buf, ":set mouse=\<CR>") |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2857 call term_wait(buf) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2858 redraw! |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2859 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2860 " Test for copying a modeless selection to clipboard |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2861 let @* = 'clean' |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2862 " communicating with X server may take a little time |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2863 sleep 100m |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2864 call feedkeys(MouseLeftClickCode(2, 3), 'x') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2865 call feedkeys(MouseLeftDragCode(2, 11), 'x') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2866 call feedkeys(MouseLeftReleaseCode(2, 11), 'x') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2867 call assert_equal("d green y", @*) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2868 |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2869 " cleanup |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2870 call term_wait(buf) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2871 call StopVimInTerminal(buf) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2872 let &mouse = save_mouse |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2873 let &term = save_term |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2874 let &ttymouse = save_ttymouse |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2875 set mousetime& clipboard& |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2876 call test_override('no_query_mouse', 0) |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2877 call delete('Xtest_modeless') |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2878 endfunc |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2879 |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
2880 " vim: shiftwidth=2 sts=2 expandtab |