Mercurial > vim
annotate src/testdir/test_terminal.vim @ 29903:08cbdf656975
Added tag v9.0.0289 for changeset ab2d83e147ca5f32fada66dcf5a3b69bfd033abf
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 27 Aug 2022 23:00:03 +0200 |
parents | 25480d36bff5 |
children | d891115c0aea |
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. |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
20768
diff
changeset
|
2 " This is split in two, because it can take a lot of time. |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
3 " See test_terminal2.vim and test_terminal3.vim for further tests. |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 |
17089
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
5 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
|
6 CheckFeature terminal |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 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
|
9 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
|
10 source mouse.vim |
21126
a35036006352
patch 8.2.1114: terminal test sometimes times out
Bram Moolenaar <Bram@vim.org>
parents:
20768
diff
changeset
|
11 source term_util.vim |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 |
12062
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
13 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
|
14 let $PROMPT_COMMAND='' |
12062
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
15 |
11912
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
16 func Test_terminal_basic() |
27257
68c33419fdc6
patch 8.2.4157: terminal test fails because Windows sets the title
Bram Moolenaar <Bram@vim.org>
parents:
27098
diff
changeset
|
17 call test_override('vterm_title', 1) |
13835
8e583c52eb44
patch 8.0.1789: BufWinEnter does not work well for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13829
diff
changeset
|
18 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
|
19 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
|
20 |
12112
6afc7339c2ad
patch 8.0.0936: mode() returns wrong value for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12106
diff
changeset
|
21 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
|
22 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
|
23 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
|
24 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
|
25 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
|
26 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
|
27 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
|
28 |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
29 call StopShellInTerminal(buf) |
12112
6afc7339c2ad
patch 8.0.0936: mode() returns wrong value for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12106
diff
changeset
|
30 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
|
31 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
|
32 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
|
33 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
|
34 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
|
35 |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
36 " 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
|
37 close |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
38 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
|
39 |
13835
8e583c52eb44
patch 8.0.1789: BufWinEnter does not work well for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13829
diff
changeset
|
40 au! TerminalOpen |
27257
68c33419fdc6
patch 8.2.4157: terminal test fails because Windows sets the title
Bram Moolenaar <Bram@vim.org>
parents:
27098
diff
changeset
|
41 call test_override('ALL', 0) |
11912
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
42 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
|
43 endfunc |
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
44 |
22822
0b4658e030cb
patch 8.2.1959: crash when terminal buffer name is made empty
Bram Moolenaar <Bram@vim.org>
parents:
22780
diff
changeset
|
45 func Test_terminal_no_name() |
0b4658e030cb
patch 8.2.1959: crash when terminal buffer name is made empty
Bram Moolenaar <Bram@vim.org>
parents:
22780
diff
changeset
|
46 let buf = Run_shell_in_terminal({}) |
0b4658e030cb
patch 8.2.1959: crash when terminal buffer name is made empty
Bram Moolenaar <Bram@vim.org>
parents:
22780
diff
changeset
|
47 call assert_match('^!', bufname(buf)) |
0b4658e030cb
patch 8.2.1959: crash when terminal buffer name is made empty
Bram Moolenaar <Bram@vim.org>
parents:
22780
diff
changeset
|
48 0file |
0b4658e030cb
patch 8.2.1959: crash when terminal buffer name is made empty
Bram Moolenaar <Bram@vim.org>
parents:
22780
diff
changeset
|
49 call assert_equal("", bufname(buf)) |
0b4658e030cb
patch 8.2.1959: crash when terminal buffer name is made empty
Bram Moolenaar <Bram@vim.org>
parents:
22780
diff
changeset
|
50 call assert_match('\[No Name\]', execute('file')) |
0b4658e030cb
patch 8.2.1959: crash when terminal buffer name is made empty
Bram Moolenaar <Bram@vim.org>
parents:
22780
diff
changeset
|
51 call StopShellInTerminal(buf) |
0b4658e030cb
patch 8.2.1959: crash when terminal buffer name is made empty
Bram Moolenaar <Bram@vim.org>
parents:
22780
diff
changeset
|
52 endfunc |
0b4658e030cb
patch 8.2.1959: crash when terminal buffer name is made empty
Bram Moolenaar <Bram@vim.org>
parents:
22780
diff
changeset
|
53 |
18450
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
54 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
|
55 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
|
56 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
|
57 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
|
58 call StopShellInTerminal(buf) |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
59 " 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
|
60 close |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
61 |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
62 if has("unix") |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
63 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
|
64 sleep 1 |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
65 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
|
66 endif |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
67 |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
68 au! TerminalWinOpen |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
69 endfunc |
507348b211b4
patch 8.1.2219: no autocommand for open window with terminal
Bram Moolenaar <Bram@vim.org>
parents:
18402
diff
changeset
|
70 |
11912
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
71 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
|
72 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
|
73 call StopShellInTerminal(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
|
74 |
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
75 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
|
76 exe "normal Axxx\<Esc>" |
22742
f7f2d73ff85e
patch 8.2.1919: assert_fails() setting emsg_silent changes normal execution
Bram Moolenaar <Bram@vim.org>
parents:
22448
diff
changeset
|
77 call assert_fails(buf . 'bwipe', 'E89:') |
11912
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
78 undo |
22658e33203f
patch 8.0.0836: can abandon a terminal buffer after making a change
Christian Brabandt <cb@256bit.org>
parents:
11906
diff
changeset
|
79 |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 exe buf . 'bwipe' |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 unlet g:job |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 endfunc |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 |
15951
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
84 func Test_terminal_paste_register() |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
85 let @" = "text to paste" |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
86 |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
87 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
|
88 " 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
|
89 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
|
90 |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
91 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
|
92 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
|
93 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
|
94 |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
95 exe buf . 'bwipe!' |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
96 unlet g:job |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
97 endfunc |
2c18aaf66e77
patch 8.1.0981: pasting in terminal insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
15937
diff
changeset
|
98 |
11917
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
99 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
|
100 let buf = Run_shell_in_terminal({}) |
22742
f7f2d73ff85e
patch 8.2.1919: assert_fails() setting emsg_silent changes normal execution
Bram Moolenaar <Bram@vim.org>
parents:
22448
diff
changeset
|
101 call assert_fails(buf . 'bwipe', 'E89:') |
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
|
102 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
|
103 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
|
104 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
|
105 |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
106 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
|
107 endfunc |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
108 |
12479
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
109 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
|
110 let buf = Run_shell_in_terminal({}) |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
111 split |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
112 quit! |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
113 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
|
114 sleep 50m |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
115 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
|
116 |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
117 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
|
118 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
|
119 |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
120 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
|
121 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
|
122 endfunc |
65c7769ef6d1
patch 8.0.1119: quitting a split terminal window kills the job
Christian Brabandt <cb@256bit.org>
parents:
12475
diff
changeset
|
123 |
22987
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
124 func Test_terminal_hide_buffer_job_running() |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
125 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
|
126 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
|
127 quit |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
128 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
|
129 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
|
130 endfor |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
131 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
|
132 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
|
133 |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
134 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
|
135 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
|
136 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
|
137 |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
138 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
|
139 endfunc |
00836eb177cb
patch 8.0.0838: buffer hangs around whem terminal window is closed
Christian Brabandt <cb@256bit.org>
parents:
11912
diff
changeset
|
140 |
22987
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
141 func Test_terminal_hide_buffer_job_finished() |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
142 term echo hello |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
143 let buf = bufnr() |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
144 setlocal bufhidden=hide |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
145 call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))}) |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
146 call assert_true(bufloaded(buf)) |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
147 call assert_true(buflisted(buf)) |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
148 edit Xasdfasdf |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
149 call assert_true(bufloaded(buf)) |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
150 call assert_true(buflisted(buf)) |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
151 exe buf .. 'buf' |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
152 call assert_equal(buf, bufnr()) |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
153 setlocal bufhidden= |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
154 edit Xasdfasdf |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
155 call assert_false(bufloaded(buf)) |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
156 call assert_false(buflisted(buf)) |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
157 bwipe Xasdfasdf |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
158 endfunc |
1456b8e4d489
patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Bram Moolenaar <Bram@vim.org>
parents:
22920
diff
changeset
|
159 |
26185
582218dbc6b3
patch 8.2.3624: when renaming a terminal buffer status text is not updated
Bram Moolenaar <Bram@vim.org>
parents:
26113
diff
changeset
|
160 func Test_terminal_rename_buffer() |
582218dbc6b3
patch 8.2.3624: when renaming a terminal buffer status text is not updated
Bram Moolenaar <Bram@vim.org>
parents:
26113
diff
changeset
|
161 let cmd = Get_cat_123_cmd() |
582218dbc6b3
patch 8.2.3624: when renaming a terminal buffer status text is not updated
Bram Moolenaar <Bram@vim.org>
parents:
26113
diff
changeset
|
162 let buf = term_start(cmd, {'term_name': 'foo'}) |
582218dbc6b3
patch 8.2.3624: when renaming a terminal buffer status text is not updated
Bram Moolenaar <Bram@vim.org>
parents:
26113
diff
changeset
|
163 call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))}) |
582218dbc6b3
patch 8.2.3624: when renaming a terminal buffer status text is not updated
Bram Moolenaar <Bram@vim.org>
parents:
26113
diff
changeset
|
164 call assert_equal('foo', bufname()) |
582218dbc6b3
patch 8.2.3624: when renaming a terminal buffer status text is not updated
Bram Moolenaar <Bram@vim.org>
parents:
26113
diff
changeset
|
165 call assert_match('foo.*finished', execute('ls')) |
582218dbc6b3
patch 8.2.3624: when renaming a terminal buffer status text is not updated
Bram Moolenaar <Bram@vim.org>
parents:
26113
diff
changeset
|
166 file bar |
582218dbc6b3
patch 8.2.3624: when renaming a terminal buffer status text is not updated
Bram Moolenaar <Bram@vim.org>
parents:
26113
diff
changeset
|
167 call assert_equal('bar', bufname()) |
582218dbc6b3
patch 8.2.3624: when renaming a terminal buffer status text is not updated
Bram Moolenaar <Bram@vim.org>
parents:
26113
diff
changeset
|
168 call assert_match('bar.*finished', execute('ls')) |
582218dbc6b3
patch 8.2.3624: when renaming a terminal buffer status text is not updated
Bram Moolenaar <Bram@vim.org>
parents:
26113
diff
changeset
|
169 exe 'bwipe! ' .. buf |
582218dbc6b3
patch 8.2.3624: when renaming a terminal buffer status text is not updated
Bram Moolenaar <Bram@vim.org>
parents:
26113
diff
changeset
|
170 endfunc |
582218dbc6b3
patch 8.2.3624: when renaming a terminal buffer status text is not updated
Bram Moolenaar <Bram@vim.org>
parents:
26113
diff
changeset
|
171 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15245
diff
changeset
|
172 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
|
173 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
|
174 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
|
175 endfunc |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
176 |
12405
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
177 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
|
178 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
|
179 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
|
180 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
|
181 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
|
182 " 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
|
183 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
|
184 endif |
12405
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
185 else |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
186 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
|
187 return "cat Xtext" |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
188 endif |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
189 endfunc |
6ef5e636f246
patch 8.0.1082: tests fail when run under valgrind
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
190 |
11939
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
191 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
|
192 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
|
193 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
|
194 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
|
195 |
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
|
196 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 endfunc |
ef1febf04d03
patch 8.0.0849: crash when job exit callback wipes the terminal
Christian Brabandt <cb@256bit.org>
parents:
11933
diff
changeset
|
202 |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 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
|
204 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
|
205 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
|
206 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
|
207 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
|
208 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
|
209 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
|
210 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
|
211 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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 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
|
217 " 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
|
218 " 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
|
219 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
|
220 else |
15231
42ce33efb23d
patch 8.1.0625: MS-Windows: terminal test fails in white console
Bram Moolenaar <Bram@vim.org>
parents:
15217
diff
changeset
|
221 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
|
222 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
|
223 else |
42ce33efb23d
patch 8.1.0625: MS-Windows: terminal test fails in white console
Bram Moolenaar <Bram@vim.org>
parents:
15217
diff
changeset
|
224 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
|
225 endif |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 endif |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 |
11923
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
228 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
|
229 call assert_equal('', l) |
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
230 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
|
231 call assert_equal('', l) |
c9da7b42fdf5
patch 8.0.0841: term_getline() may cause a crash
Christian Brabandt <cb@256bit.org>
parents:
11917
diff
changeset
|
232 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
|
233 call assert_equal('', l) |
11906
7df4afab67c7
patch 8.0.0833: terminal test fails
Christian Brabandt <cb@256bit.org>
parents:
11872
diff
changeset
|
234 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
|
235 call assert_equal('123', l) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
236 endfunc |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
237 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
238 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
|
239 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
|
240 let buf = term_start(cmd) |
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 let termlist = term_list() |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
243 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
|
244 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
|
245 |
11872
ff8122091ec6
patch 8.0.0816: crash when using invalid buffer number
Christian Brabandt <cb@256bit.org>
parents:
11846
diff
changeset
|
246 " 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
|
247 call term_wait(1234) |
ff8122091ec6
patch 8.0.0816: crash when using invalid buffer number
Christian Brabandt <cb@256bit.org>
parents:
11846
diff
changeset
|
248 |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
249 call TermWait(buf) |
12349
bb67396239a4
patch 8.0.1054: terminal test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12345
diff
changeset
|
250 " 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
|
251 " "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
|
252 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
|
253 call Check_123(buf) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
254 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
255 " 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
|
256 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
|
257 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
|
258 call TermWait(buf) |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
259 call Check_123(buf) |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
260 |
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
261 exe buf . 'bwipe' |
11872
ff8122091ec6
patch 8.0.0816: crash when using invalid buffer number
Christian Brabandt <cb@256bit.org>
parents:
11846
diff
changeset
|
262 call delete('Xtext') |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
263 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
|
264 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
265 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
|
266 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
|
267 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
|
268 " 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
|
269 " multibyte characters. |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
270 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
|
271 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
|
272 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
|
273 let line = 4 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
274 else |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
275 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
|
276 let line = 1 |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
277 endif |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
278 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
279 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
|
280 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
|
281 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
|
282 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
|
283 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
|
284 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
|
285 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
|
286 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
|
287 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
|
288 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
|
289 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
|
290 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
|
291 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
292 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
|
293 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
|
294 call TermWait(buf) |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
295 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
296 exe buf . 'bwipe' |
12009
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
297 call delete('Xtext') |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
298 endfunc |
0d9bfdb3f6f7
patch 8.0.0885: terminal window scrollback is stored inefficiently
Christian Brabandt <cb@256bit.org>
parents:
11975
diff
changeset
|
299 |
21606
66618893eb2a
patch 8.2.1353: crash when drawing double-wide character in terminal window
Bram Moolenaar <Bram@vim.org>
parents:
21445
diff
changeset
|
300 func Test_terminal_one_column() |
66618893eb2a
patch 8.2.1353: crash when drawing double-wide character in terminal window
Bram Moolenaar <Bram@vim.org>
parents:
21445
diff
changeset
|
301 " This creates a terminal, displays a double-wide character and makes the |
66618893eb2a
patch 8.2.1353: crash when drawing double-wide character in terminal window
Bram Moolenaar <Bram@vim.org>
parents:
21445
diff
changeset
|
302 " window one column wide. This used to cause a crash. |
66618893eb2a
patch 8.2.1353: crash when drawing double-wide character in terminal window
Bram Moolenaar <Bram@vim.org>
parents:
21445
diff
changeset
|
303 let width = &columns |
66618893eb2a
patch 8.2.1353: crash when drawing double-wide character in terminal window
Bram Moolenaar <Bram@vim.org>
parents:
21445
diff
changeset
|
304 botright vert term |
66618893eb2a
patch 8.2.1353: crash when drawing double-wide character in terminal window
Bram Moolenaar <Bram@vim.org>
parents:
21445
diff
changeset
|
305 let buf = bufnr('$') |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
306 call TermWait(buf, 100) |
21606
66618893eb2a
patch 8.2.1353: crash when drawing double-wide character in terminal window
Bram Moolenaar <Bram@vim.org>
parents:
21445
diff
changeset
|
307 exe "set columns=" .. (width / 2) |
66618893eb2a
patch 8.2.1353: crash when drawing double-wide character in terminal window
Bram Moolenaar <Bram@vim.org>
parents:
21445
diff
changeset
|
308 redraw |
66618893eb2a
patch 8.2.1353: crash when drawing double-wide character in terminal window
Bram Moolenaar <Bram@vim.org>
parents:
21445
diff
changeset
|
309 call term_sendkeys(buf, "キ") |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
310 call TermWait(buf, 10) |
21606
66618893eb2a
patch 8.2.1353: crash when drawing double-wide character in terminal window
Bram Moolenaar <Bram@vim.org>
parents:
21445
diff
changeset
|
311 exe "set columns=" .. width |
66618893eb2a
patch 8.2.1353: crash when drawing double-wide character in terminal window
Bram Moolenaar <Bram@vim.org>
parents:
21445
diff
changeset
|
312 exe buf . 'bwipe!' |
66618893eb2a
patch 8.2.1353: crash when drawing double-wide character in terminal window
Bram Moolenaar <Bram@vim.org>
parents:
21445
diff
changeset
|
313 endfunc |
66618893eb2a
patch 8.2.1353: crash when drawing double-wide character in terminal window
Bram Moolenaar <Bram@vim.org>
parents:
21445
diff
changeset
|
314 |
12011
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
315 func Test_terminal_scroll() |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
316 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
|
317 if has('win32') |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
318 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
|
319 else |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
320 let cmd = "cat Xtext" |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
321 endif |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
322 let buf = term_start(cmd) |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
323 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
324 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
|
325 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
|
326 call TermWait(buf) |
12011
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
327 |
19781
cadb4c1bee6e
patch 8.2.0447: terminal scroll tests fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19770
diff
changeset
|
328 " 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
|
329 while 1 |
cadb4c1bee6e
patch 8.2.0447: terminal scroll tests fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19770
diff
changeset
|
330 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
|
331 sleep 20m |
cadb4c1bee6e
patch 8.2.0447: terminal scroll tests fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19770
diff
changeset
|
332 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
|
333 break |
cadb4c1bee6e
patch 8.2.0447: terminal scroll tests fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19770
diff
changeset
|
334 endif |
cadb4c1bee6e
patch 8.2.0447: terminal scroll tests fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19770
diff
changeset
|
335 endwhile |
cadb4c1bee6e
patch 8.2.0447: terminal scroll tests fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
19770
diff
changeset
|
336 |
12011
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
337 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
|
338 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
|
339 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
|
340 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
|
341 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
|
342 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
|
343 |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
344 exe buf . 'bwipe' |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
345 call delete('Xtext') |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
346 endfunc |
1f4e7361ce89
patch 8.0.0886: crash when using ":term ls"
Christian Brabandt <cb@256bit.org>
parents:
12009
diff
changeset
|
347 |
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
|
348 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
|
349 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
|
350 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
|
351 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
|
352 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
|
353 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
|
354 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
|
355 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
|
356 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
|
357 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
|
358 " 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
|
359 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
|
360 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
|
361 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
|
362 |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
363 call StopShellInTerminal(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
|
364 exe buf . 'bwipe' |
13742
a34b1323286c
patch 8.0.1743: terminal window options are named inconsistently
Christian Brabandt <cb@256bit.org>
parents:
13720
diff
changeset
|
365 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
|
366 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
|
367 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
|
368 |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
369 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
|
370 " 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
|
371 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
|
372 |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
373 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
|
374 call writefile([ |
15836
fe7e94f39e7f
patch 8.1.0925: terminal scrollback test still still flaky
Bram Moolenaar <Bram@vim.org>
parents:
15834
diff
changeset
|
375 \ '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
|
376 \ 'terminal', |
15836
fe7e94f39e7f
patch 8.1.0925: terminal scrollback test still still flaky
Bram Moolenaar <Bram@vim.org>
parents:
15834
diff
changeset
|
377 \ '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
|
378 \ '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
|
379 \ '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
|
380 \ '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
|
381 \ ], '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
|
382 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
|
383 " 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
|
384 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
|
385 |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
386 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
|
387 " 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
|
388 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
|
389 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
|
390 |
1f2edc01e7ed
patch 8.1.0920: in Terminal-Normal mode job output messes up the window
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
391 " 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
|
392 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
|
393 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
|
394 |
19667
a088571e1d9d
patch 8.2.0390: terminal postponed scrollback test is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19651
diff
changeset
|
395 " 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
|
396 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
|
397 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
|
398 " 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
|
399 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
|
400 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
|
401 " close terminal window |
19633
dd3e5533a7d2
patch 8.2.0373: type of term_sendkeys() is unknown
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
402 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
|
403 |
dd3e5533a7d2
patch 8.2.0373: type of term_sendkeys() is unknown
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
404 " 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
|
405 echo type(tsk_ret) |
dd3e5533a7d2
patch 8.2.0373: type of term_sendkeys() is unknown
Bram Moolenaar <Bram@vim.org>
parents:
19629
diff
changeset
|
406 |
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
|
407 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
|
408 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
|
409 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
|
410 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
|
411 |
15828
8f112782a2e9
patch 8.1.0921: terminal test sometimes fails; using memory after free
Bram Moolenaar <Bram@vim.org>
parents:
15826
diff
changeset
|
412 " 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
|
413 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
|
414 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
|
415 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
|
416 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
|
417 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
|
418 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
|
419 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
|
420 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
|
421 quit |
8f112782a2e9
patch 8.1.0921: terminal test sometimes fails; using memory after free
Bram Moolenaar <Bram@vim.org>
parents:
15826
diff
changeset
|
422 endfunc |
8f112782a2e9
patch 8.1.0921: terminal test sometimes fails; using memory after free
Bram Moolenaar <Bram@vim.org>
parents:
15826
diff
changeset
|
423 |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
424 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
|
425 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
|
426 |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
427 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
|
428 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
|
429 bwipe! |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
430 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
|
431 |
12056
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
432 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
|
433 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
434 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
435 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
|
436 |
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 vsplit |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
438 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
|
439 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
|
440 |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
441 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
|
442 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
|
443 |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
444 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
|
445 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
|
446 |
39fcaaa973db
patch 8.0.1711: term_setsize() is not implemented yet
Christian Brabandt <cb@256bit.org>
parents:
13650
diff
changeset
|
447 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
|
448 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
|
449 |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
450 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
|
451 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
|
452 |
12056
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
453 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
|
454 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
455 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
456 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
|
457 |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
458 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
|
459 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
|
460 bwipe! |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
461 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
|
462 |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
463 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
|
464 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
465 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
466 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
|
467 |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
468 split |
12192
6947d5bcf57f
patch 8.0.0976: cannot send lines to a terminal job
Christian Brabandt <cb@256bit.org>
parents:
12166
diff
changeset
|
469 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
|
470 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
|
471 bwipe! |
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
472 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
|
473 |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
474 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
|
475 let size = term_getsize('') |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
476 bwipe! |
0498547dace0
patch 8.0.0908: cannot set terminal size with options
Christian Brabandt <cb@256bit.org>
parents:
12046
diff
changeset
|
477 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
|
478 |
26113
c421c9599d83
patch 8.2.3589: failure when "term_rows" of term_start() is an unusual value
Bram Moolenaar <Bram@vim.org>
parents:
26105
diff
changeset
|
479 call assert_fails("call term_start(cmd, {'term_rows': -1})", 'E475:') |
c421c9599d83
patch 8.2.3589: failure when "term_rows" of term_start() is an unusual value
Bram Moolenaar <Bram@vim.org>
parents:
26105
diff
changeset
|
480 call assert_fails("call term_start(cmd, {'term_rows': 1001})", 'E475:') |
26105
fd1cbe72815a
patch 8.2.3585: crash when passing float to "term_rows" of term_start()
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
481 if has('float') |
fd1cbe72815a
patch 8.2.3585: crash when passing float to "term_rows" of term_start()
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
482 call assert_fails("call term_start(cmd, {'term_rows': 10.0})", 'E805:') |
fd1cbe72815a
patch 8.2.3585: crash when passing float to "term_rows" of term_start()
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
483 endif |
fd1cbe72815a
patch 8.2.3585: crash when passing float to "term_rows" of term_start()
Bram Moolenaar <Bram@vim.org>
parents:
25969
diff
changeset
|
484 |
12343
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
485 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
|
486 endfunc |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
487 |
24006
d9afd9008910
patch 8.2.2545: errors and crash when terminal window is zero height
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
488 func Test_terminal_zero_height() |
d9afd9008910
patch 8.2.2545: errors and crash when terminal window is zero height
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
489 split |
d9afd9008910
patch 8.2.2545: errors and crash when terminal window is zero height
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
490 wincmd j |
d9afd9008910
patch 8.2.2545: errors and crash when terminal window is zero height
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
491 anoremenu 1.1 WinBar.test : |
d9afd9008910
patch 8.2.2545: errors and crash when terminal window is zero height
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
492 terminal ++curwin |
d9afd9008910
patch 8.2.2545: errors and crash when terminal window is zero height
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
493 wincmd k |
d9afd9008910
patch 8.2.2545: errors and crash when terminal window is zero height
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
494 wincmd _ |
d9afd9008910
patch 8.2.2545: errors and crash when terminal window is zero height
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
495 redraw |
d9afd9008910
patch 8.2.2545: errors and crash when terminal window is zero height
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
496 |
d9afd9008910
patch 8.2.2545: errors and crash when terminal window is zero height
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
497 call term_sendkeys(bufnr(), "exit\r") |
d9afd9008910
patch 8.2.2545: errors and crash when terminal window is zero height
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
498 bwipe! |
d9afd9008910
patch 8.2.2545: errors and crash when terminal window is zero height
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
499 endfunc |
d9afd9008910
patch 8.2.2545: errors and crash when terminal window is zero height
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
500 |
12060
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
501 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
|
502 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
|
503 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
|
504 |
20617
c81f61e3b508
patch 8.2.0862: ":term ++curwin" makes the current buffer hidden
Bram Moolenaar <Bram@vim.org>
parents:
20524
diff
changeset
|
505 split Xdummy |
c81f61e3b508
patch 8.2.0862: ":term ++curwin" makes the current buffer hidden
Bram Moolenaar <Bram@vim.org>
parents:
20524
diff
changeset
|
506 call setline(1, 'dummy') |
c81f61e3b508
patch 8.2.0862: ":term ++curwin" makes the current buffer hidden
Bram Moolenaar <Bram@vim.org>
parents:
20524
diff
changeset
|
507 write |
c81f61e3b508
patch 8.2.0862: ":term ++curwin" makes the current buffer hidden
Bram Moolenaar <Bram@vim.org>
parents:
20524
diff
changeset
|
508 call assert_equal(1, getbufinfo('Xdummy')[0].loaded) |
12060
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
509 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
|
510 call assert_equal(2, winnr('$')) |
20617
c81f61e3b508
patch 8.2.0862: ":term ++curwin" makes the current buffer hidden
Bram Moolenaar <Bram@vim.org>
parents:
20524
diff
changeset
|
511 call assert_equal(0, getbufinfo('Xdummy')[0].loaded) |
12060
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
512 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
513 |
20617
c81f61e3b508
patch 8.2.0862: ":term ++curwin" makes the current buffer hidden
Bram Moolenaar <Bram@vim.org>
parents:
20524
diff
changeset
|
514 split Xdummy |
12060
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
515 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
|
516 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
|
517 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
518 |
20617
c81f61e3b508
patch 8.2.0862: ":term ++curwin" makes the current buffer hidden
Bram Moolenaar <Bram@vim.org>
parents:
20524
diff
changeset
|
519 split Xdummy |
12060
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
520 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
|
521 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
|
522 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
|
523 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
|
524 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
|
525 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
526 |
20617
c81f61e3b508
patch 8.2.0862: ":term ++curwin" makes the current buffer hidden
Bram Moolenaar <Bram@vim.org>
parents:
20524
diff
changeset
|
527 split Xdummy |
12060
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
528 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
|
529 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
|
530 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
|
531 bwipe! |
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
532 |
20617
c81f61e3b508
patch 8.2.0862: ":term ++curwin" makes the current buffer hidden
Bram Moolenaar <Bram@vim.org>
parents:
20524
diff
changeset
|
533 split Xdummy |
12060
a879814b8a37
patch 8.0.0910: cannot create a terminal in the current window
Christian Brabandt <cb@256bit.org>
parents:
12056
diff
changeset
|
534 bwipe! |
12343
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
535 call delete('Xtext') |
20617
c81f61e3b508
patch 8.2.0862: ":term ++curwin" makes the current buffer hidden
Bram Moolenaar <Bram@vim.org>
parents:
20524
diff
changeset
|
536 call delete('Xdummy') |
11975
5cc005cf312f
patch 8.0.0868: cannot specify the terminal size on the command line
Christian Brabandt <cb@256bit.org>
parents:
11973
diff
changeset
|
537 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
|
538 |
12903
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
539 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
|
540 if s:python != '' |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
541 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
|
542 " 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
|
543 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
|
544 else |
12062
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
545 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
|
546 let waittime = 2000 |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
547 if has('win32') |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
548 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
|
549 else |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
550 let cmd = 'sleep 1' |
191ccece2f5d
patch 8.0.0911: terminal test takes too long
Christian Brabandt <cb@256bit.org>
parents:
12060
diff
changeset
|
551 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
|
552 endif |
12903
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
553 return [cmd, waittime] |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
554 endfunc |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
555 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
556 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
|
557 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
|
558 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
559 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
|
560 |
13476
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
561 " 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
|
562 terminal |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
563 let buf = bufnr('%') |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
564 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
|
565 " 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
|
566 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
|
567 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
|
568 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
|
569 |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
570 " 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
|
571 terminal ++noclose |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
572 let buf = bufnr('%') |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
573 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
|
574 " 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
|
575 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
|
576 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
|
577 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
|
578 quit |
d130044d4f1f
patch 8.0.1612: need to close terminal after shell stopped
Christian Brabandt <cb@256bit.org>
parents:
13462
diff
changeset
|
579 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
|
580 |
12031
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
581 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
|
582 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
|
583 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
|
584 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
|
585 |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
586 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
|
587 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
|
588 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
|
589 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
|
590 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
|
591 |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
592 exe 'terminal ++open ' . cmd |
12271
e4aa68825575
patch 8.0.1015: missing update to terminal test
Christian Brabandt <cb@256bit.org>
parents:
12263
diff
changeset
|
593 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
|
594 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
|
595 bwipe |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
596 |
9897241c08b5
patch 8.0.0896: cannot close a terminal window when the job ends
Christian Brabandt <cb@256bit.org>
parents:
12025
diff
changeset
|
597 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
|
598 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
|
599 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
|
600 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
|
601 |
12064
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
602 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
|
603 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
|
604 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
|
605 bwipe |
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
606 |
407a475c67fd
patch 8.0.0912: cannot run a job in a hidden terminal
Christian Brabandt <cb@256bit.org>
parents:
12062
diff
changeset
|
607 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
|
608 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
|
609 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
|
610 bwipe |
12072
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
611 |
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
612 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
|
613 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
|
614 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
|
615 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
|
616 |
22864
b825d8ec9a76
patch 8.2.1979: "term_opencmd" option of term_start() is truncated
Bram Moolenaar <Bram@vim.org>
parents:
22822
diff
changeset
|
617 call term_start(cmd, {'term_finish': 'open', 'term_opencmd': '4split | buffer %d | let g:result = "opened the buffer in a window"'}) |
12271
e4aa68825575
patch 8.0.1015: missing update to terminal test
Christian Brabandt <cb@256bit.org>
parents:
12263
diff
changeset
|
618 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
|
619 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
|
620 call assert_equal(4, winheight(0)) |
22864
b825d8ec9a76
patch 8.2.1979: "term_opencmd" option of term_start() is truncated
Bram Moolenaar <Bram@vim.org>
parents:
22822
diff
changeset
|
621 call assert_equal('opened the buffer in a window', g:result) |
b825d8ec9a76
patch 8.2.1979: "term_opencmd" option of term_start() is truncated
Bram Moolenaar <Bram@vim.org>
parents:
22822
diff
changeset
|
622 unlet g:result |
12072
f4e1e1e6886b
patch 8.0.0916: cannot specify properties of window for terminal open
Christian Brabandt <cb@256bit.org>
parents:
12064
diff
changeset
|
623 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
|
624 endfunc |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
625 |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
626 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
|
627 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
|
628 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
|
629 else |
0eeaa9a6e4e7
patch 8.1.2230: MS-Windows: testing external commands can be improved
Bram Moolenaar <Bram@vim.org>
parents:
18450
diff
changeset
|
630 CheckExecutable pwd |
0eeaa9a6e4e7
patch 8.1.2230: MS-Windows: testing external commands can be improved
Bram Moolenaar <Bram@vim.org>
parents:
18450
diff
changeset
|
631 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
|
632 endif |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
633 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
|
634 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
|
635 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
|
636 |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
637 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
|
638 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
|
639 endfunc |
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
640 |
14948
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
641 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
|
642 " 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
|
643 " 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
|
644 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
|
645 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
|
646 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
|
647 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
|
648 |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
649 " 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
|
650 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
|
651 |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
652 " 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
|
653 " 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
|
654 if !IsRoot() |
14995
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
655 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
|
656 " 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
|
657 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
|
658 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
|
659 return |
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
660 endif |
bc0f3c4fb992
patch 8.1.0509: checking cwd not accessible fails for root
Bram Moolenaar <Bram@vim.org>
parents:
14948
diff
changeset
|
661 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
|
662 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
|
663 endif |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
664 endfunc |
cb07193c6257
patch 8.1.0485: term_start() does not check if directory is accessible
Bram Moolenaar <Bram@vim.org>
parents:
14459
diff
changeset
|
665 |
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
|
666 func Test_terminal_servername() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21606
diff
changeset
|
667 CheckFeature clientserver |
14063
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
668 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
|
669 endfunc |
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
670 |
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
671 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
|
672 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
|
673 endfunc |
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
674 |
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
675 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
|
676 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
|
677 " 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
|
678 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
|
679 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
|
680 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
|
681 else |
14063
f39150ec146e
patch 8.1.0049: shell cannot tell running in a terminal window
Christian Brabandt <cb@256bit.org>
parents:
14027
diff
changeset
|
682 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
|
683 endif |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
684 call TermWait(buf) |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
685 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
|
686 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
|
687 |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
688 exe buf . 'bwipe' |
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
689 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
|
690 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
|
691 |
12043
2796a2c9fc17
patch 8.0.0902: cannot specify directory or environment for a job
Christian Brabandt <cb@256bit.org>
parents:
12031
diff
changeset
|
692 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
|
693 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
|
694 " 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
|
695 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
|
696 if has('win32') |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
697 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
|
698 else |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
699 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
|
700 endif |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19898
diff
changeset
|
701 eval buf->TermWait() |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
702 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
|
703 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
|
704 |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
705 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
|
706 endfunc |
12086
69f2392e6cfb
patch 8.0.0923: crash in GUI when terminal job exits
Christian Brabandt <cb@256bit.org>
parents:
12072
diff
changeset
|
707 |
12096
0a61213afdd2
patch 8.0.0928: MS-Windows: passing arglist to job has escaping problems
Christian Brabandt <cb@256bit.org>
parents:
12086
diff
changeset
|
708 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
|
709 let buf = term_start([&shell, &shellcmdflag, 'echo "123"']) |
22742
f7f2d73ff85e
patch 8.2.1919: assert_fails() setting emsg_silent changes normal execution
Bram Moolenaar <Bram@vim.org>
parents:
22448
diff
changeset
|
710 call assert_fails(buf . 'bwipe', 'E89:') |
12096
0a61213afdd2
patch 8.0.0928: MS-Windows: passing arglist to job has escaping problems
Christian Brabandt <cb@256bit.org>
parents:
12086
diff
changeset
|
711 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
|
712 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
|
713 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
|
714 |
71e10b81226d
patch 8.0.0957: a terminal job can deadlock when sending many keys
Christian Brabandt <cb@256bit.org>
parents:
12126
diff
changeset
|
715 func Test_terminal_noblock() |
25969
a5a772dace5b
patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
24557
diff
changeset
|
716 let g:test_is_flaky = 1 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
717 let buf = term_start(&shell) |
27861
6c87f679ed29
patch 8.2.4456: terminal test may fail on some machines
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
718 " Starting a terminal can be slow, esp. on busy CI machines. |
6c87f679ed29
patch 8.2.4456: terminal test may fail on some machines
Bram Moolenaar <Bram@vim.org>
parents:
27626
diff
changeset
|
719 let wait_time = 7500 |
19770
4e843fc8772f
patch 8.2.0441: terminal noblock test is still failing on BSD
Bram Moolenaar <Bram@vim.org>
parents:
19768
diff
changeset
|
720 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
|
721 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
|
722 " 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
|
723 " 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
|
724 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
|
725 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
|
726 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
|
727 " 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
|
728 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
|
729 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
|
730 else |
040ec95b8647
patch 8.0.1049: shell on Mac can't handle long text
Christian Brabandt <cb@256bit.org>
parents:
12313
diff
changeset
|
731 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
|
732 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
|
733 |
19768
0d1088e3c53f
patch 8.2.0440: terminal noblock test is still very flaky on BSD
Bram Moolenaar <Bram@vim.org>
parents:
19764
diff
changeset
|
734 " 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
|
735 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
|
736 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
|
737 endfor |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
738 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
|
739 |
65cff399750b
patch 8.0.0979: terminal noblock test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12196
diff
changeset
|
740 " 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
|
741 " 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
|
742 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
|
743 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
|
744 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
|
745 if line !~ 'done' |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
746 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
|
747 endif |
65cff399750b
patch 8.0.0979: terminal noblock test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12196
diff
changeset
|
748 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
|
749 |
12765
c1347c968d31
patch 8.0.1260: using global variables for WaitFor()
Christian Brabandt <cb@256bit.org>
parents:
12734
diff
changeset
|
750 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
|
751 call StopShellInTerminal(buf) |
12166
f512c507b061
patch 8.0.0963: terminal test fails on MacOS
Christian Brabandt <cb@256bit.org>
parents:
12156
diff
changeset
|
752 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
|
753 bwipe |
71e10b81226d
patch 8.0.0957: a terminal job can deadlock when sending many keys
Christian Brabandt <cb@256bit.org>
parents:
12126
diff
changeset
|
754 endfunc |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
755 |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
756 func Test_terminal_write_stdin() |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
757 " 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
|
758 CheckNotMSWindows |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
759 CheckExecutable wc |
29159
25480d36bff5
patch 8.2.5099: some terminal tests are not retried
Bram Moolenaar <Bram@vim.org>
parents:
29153
diff
changeset
|
760 let g:test_is_flaky = 1 |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
761 |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
762 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
|
763 %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
|
764 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
|
765 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
|
766 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
|
767 %bwipe! |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
768 |
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
769 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
|
770 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
|
771 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
|
772 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
|
773 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
|
774 %bwipe! |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
775 endfunc |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
776 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
777 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
|
778 call CheckPython(s:python) |
29159
25480d36bff5
patch 8.2.5099: some terminal tests are not retried
Bram Moolenaar <Bram@vim.org>
parents:
29153
diff
changeset
|
779 let g:test_is_flaky = 1 |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
780 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
781 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
|
782 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
|
783 " 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
|
784 if has('win32') |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
785 call WaitFor({-> getline('$') =~ 'exit(123)'}) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
786 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
|
787 else |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
788 call WaitFor({-> getline('$') =~ 'hello'}) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
789 call assert_equal('hello', getline('$')) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
790 endif |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
791 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
|
792 %bwipe! |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
793 endfunc |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
794 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
795 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
|
796 CheckMSWindows |
20219
820f24dc1e3e
patch 8.2.0665: wrongly assuming Python executable is called "python"
Bram Moolenaar <Bram@vim.org>
parents:
20178
diff
changeset
|
797 call CheckPython(s:python) |
29159
25480d36bff5
patch 8.2.5099: some terminal tests are not retried
Bram Moolenaar <Bram@vim.org>
parents:
29153
diff
changeset
|
798 let g:test_is_flaky = 1 |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
799 |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
800 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
|
801 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
|
802 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
|
803 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
|
804 %bwipe! |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
805 endfunc |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
806 |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
807 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
|
808 call CheckPython(s:python) |
29159
25480d36bff5
patch 8.2.5099: some terminal tests are not retried
Bram Moolenaar <Bram@vim.org>
parents:
29153
diff
changeset
|
809 let g:test_is_flaky = 1 |
12313
44f3c9b7eec4
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12309
diff
changeset
|
810 |
29159
25480d36bff5
patch 8.2.5099: some terminal tests are not retried
Bram Moolenaar <Bram@vim.org>
parents:
29153
diff
changeset
|
811 " Check the last specified ++eof arg is used and does not leak memory. |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
812 new |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
813 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
|
814 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
|
815 " 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
|
816 if has('win32') |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
817 call WaitFor({-> getline('$') =~ 'exit(123)'}) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
818 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
|
819 else |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
820 call WaitFor({-> getline('$') =~ 'hello'}) |
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
821 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
|
822 endif |
19245
5ed8297121fa
patch 8.2.0181: problems parsing :term arguments
Bram Moolenaar <Bram@vim.org>
parents:
18748
diff
changeset
|
823 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
|
824 %bwipe! |
12196
9237b087583c
patch 8.0.0978: writing to terminal job is not tested
Christian Brabandt <cb@256bit.org>
parents:
12192
diff
changeset
|
825 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
|
826 |
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
827 func Test_terminal_no_cmd() |
25969
a5a772dace5b
patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
24557
diff
changeset
|
828 let g:test_is_flaky = 1 |
12240
24abce52ad20
patch 8.0.1000: cannot open a terminal without running a job in it
Christian Brabandt <cb@256bit.org>
parents:
12230
diff
changeset
|
829 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
|
830 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
|
831 |
12389
d0cf7f71b95b
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12357
diff
changeset
|
832 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
|
833 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
|
834 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
|
835 " 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
|
836 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
|
837 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
|
838 " 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
|
839 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
|
840 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
|
841 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
|
842 |
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
|
843 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
|
844 endfunc |
12343
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
845 |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
846 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
|
847 " 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
|
848 CheckUnix |
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
849 |
12343
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
850 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
|
851 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
|
852 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
|
853 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
|
854 " 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
|
855 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
|
856 |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
857 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
|
858 bwipe |
72046661f6d0
patch 8.0.1051: cannot run terminal with spaces in argument
Christian Brabandt <cb@256bit.org>
parents:
12339
diff
changeset
|
859 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
|
860 |
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
|
861 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
|
862 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
|
863 \ "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
|
864 \ "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
|
865 \ "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
|
866 \ "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
|
867 \ "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
|
868 \ "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
|
869 \ })', '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
|
870 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
|
871 \ "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
|
872 \ })', '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
|
873 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
|
874 \ "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
|
875 \ })', '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
|
876 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
|
877 |
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
|
878 func Test_terminal_redir_file() |
25969
a5a772dace5b
patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
24557
diff
changeset
|
879 let g:test_is_flaky = 1 |
13860
7f892e37b017
patch 8.0.1801: MS-Windows: redirecting terminal output does not work
Christian Brabandt <cb@256bit.org>
parents:
13835
diff
changeset
|
880 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
|
881 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
|
882 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
|
883 " 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
|
884 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
|
885 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
|
886 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
|
887 endif |
13860
7f892e37b017
patch 8.0.1801: MS-Windows: redirecting terminal output does not work
Christian Brabandt <cb@256bit.org>
parents:
13835
diff
changeset
|
888 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
|
889 call WaitForAssert({-> assert_equal("dead", job_status(g:job))}) |
21445
ae23caa42dac
patch 8.2.1273: MS-Windows: terminal test may leave file behind
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
890 |
ae23caa42dac
patch 8.2.1273: MS-Windows: terminal test may leave file behind
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
891 if has('win32') |
ae23caa42dac
patch 8.2.1273: MS-Windows: terminal test may leave file behind
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
892 " On Windows we cannot delete a file being used by a process. When |
ae23caa42dac
patch 8.2.1273: MS-Windows: terminal test may leave file behind
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
893 " job_status() returns "dead", the process remains for a short time. |
ae23caa42dac
patch 8.2.1273: MS-Windows: terminal test may leave file behind
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
894 " Just wait for a moment. |
ae23caa42dac
patch 8.2.1273: MS-Windows: terminal test may leave file behind
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
895 sleep 50m |
ae23caa42dac
patch 8.2.1273: MS-Windows: terminal test may leave file behind
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
896 endif |
13860
7f892e37b017
patch 8.0.1801: MS-Windows: redirecting terminal output does not work
Christian Brabandt <cb@256bit.org>
parents:
13835
diff
changeset
|
897 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
|
898 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
|
899 |
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
|
900 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
|
901 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
|
902 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
|
903 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
|
904 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
|
905 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
|
906 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
|
907 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
|
908 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
|
909 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
|
910 endfunc |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
911 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
912 func TerminalTmap(remap) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
913 let buf = Run_shell_in_terminal({}) |
24212
6ddfe0f45b4c
patch 8.2.2647: terminal test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents:
24006
diff
changeset
|
914 " Wait for the shell to display a prompt |
6ddfe0f45b4c
patch 8.2.2647: terminal test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents:
24006
diff
changeset
|
915 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
916 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
|
917 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
918 if a:remap |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
919 tmap 123 456 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
920 else |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
921 tnoremap 123 456 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
922 endif |
12983
7a9c4a8b1ceb
patch 8.0.1367: terminal test hangs, executing abcde
Christian Brabandt <cb@256bit.org>
parents:
12907
diff
changeset
|
923 " 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
|
924 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
|
925 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
|
926 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
|
927 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
|
928 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
|
929 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
|
930 if a:remap |
12983
7a9c4a8b1ceb
patch 8.0.1367: terminal test hangs, executing abcde
Christian Brabandt <cb@256bit.org>
parents:
12907
diff
changeset
|
931 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
|
932 else |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
933 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
|
934 endif |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
935 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
936 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
|
937 call StopShellInTerminal(buf) |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
938 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
939 tunmap 123 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
940 tunmap 456 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
941 call assert_equal('', maparg('123', 't')) |
28259
0f1a0bef2c02
patch 8.2.4655: cmdline completion popup menu positioned wrong
Bram Moolenaar <Bram@vim.org>
parents:
27861
diff
changeset
|
942 exe buf . 'bwipe' |
12457
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
943 unlet g:job |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
944 endfunc |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
945 |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
946 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
|
947 call TerminalTmap(1) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
948 call TerminalTmap(0) |
dfb8254aa735
patch 8.0.1108: cannot specify mappings for the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12431
diff
changeset
|
949 endfunc |
12648
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
950 |
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
951 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
|
952 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
|
953 wall |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
954 call StopShellInTerminal(buf) |
12648
cdfd6eb8bb80
patch 8.0.1202: :wall gives an errof for a terminal window
Christian Brabandt <cb@256bit.org>
parents:
12505
diff
changeset
|
955 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
|
956 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
|
957 endfunc |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
958 |
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
|
959 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
|
960 let buf = Run_shell_in_terminal({}) |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
961 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
|
962 call StopShellInTerminal(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
|
963 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
|
964 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
|
965 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
|
966 |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
967 func Test_terminal_composing_unicode() |
25969
a5a772dace5b
patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
24557
diff
changeset
|
968 let g:test_is_flaky = 1 |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
969 let save_enc = &encoding |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
970 set encoding=utf-8 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
971 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
972 if has('win32') |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
973 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
|
974 let lnum = [3, 6, 9] |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
975 else |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
976 let cmd = &shell |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
977 let lnum = [1, 3, 5] |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
978 endif |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
979 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
980 enew |
22161
4373f3569140
patch 8.2.1630: terminal test fails
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
981 let buf = term_start(cmd, {'curwin': 1}) |
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
|
982 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
|
983 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
|
984 |
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
|
985 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
|
986 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
|
987 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
|
988 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
|
989 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
|
990 |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
991 " ascii + composing |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
992 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
|
993 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
|
994 call TermWait(buf, 25) |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
995 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
|
996 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
|
997 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
|
998 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
|
999 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
|
1000 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
|
1001 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
|
1002 |
23890
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1003 " multibyte + composing: がぎぐげご |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
1004 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
|
1005 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
|
1006 call TermWait(buf, 25) |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
1007 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
|
1008 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
|
1009 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
|
1010 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
|
1011 call assert_equal("\u304b\u3099", l[0].chars) |
23890
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1012 call assert_equal(2, l[0].width) |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1013 call assert_equal("\u304e", l[1].chars) |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1014 call assert_equal(2, l[1].width) |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1015 call assert_equal("\u304f\u3099", l[2].chars) |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1016 call assert_equal(2, l[2].width) |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1017 call assert_equal("\u3052", l[3].chars) |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1018 call assert_equal(2, l[3].width) |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1019 call assert_equal("\u3053\u3099", l[4].chars) |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1020 call assert_equal(2, l[4].width) |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
1021 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
1022 " \u00a0 + composing |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
1023 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
|
1024 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
|
1025 call TermWait(buf, 25) |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
1026 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
|
1027 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
|
1028 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
|
1029 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
|
1030 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
|
1031 |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
1032 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
|
1033 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
|
1034 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
|
1035 unlet g:job |
12650
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
1036 let &encoding = save_enc |
f58755eb453e
patch 8.0.1203: terminal window mistreats composing characters
Christian Brabandt <cb@256bit.org>
parents:
12648
diff
changeset
|
1037 endfunc |
12903
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1038 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1039 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
|
1040 fun Nop() |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1041 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
|
1042 endfun |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1043 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1044 aug repro |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1045 au! |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1046 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
|
1047 aug END |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1048 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1049 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
|
1050 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1051 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
|
1052 new |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1053 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
|
1054 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
|
1055 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
|
1056 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
|
1057 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
|
1058 bwipe! |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1059 |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1060 unlet s:called |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1061 au! repro |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1062 delfunc Nop |
411a30bd7e8a
patch 8.0.1328: trouble when using ":term ++close" with autocmd
Christian Brabandt <cb@256bit.org>
parents:
12765
diff
changeset
|
1063 endfunc |
13109
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
1064 |
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
1065 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
|
1066 let cmd = "call term_start('', {'curwin' : 1, 'term_finish' : 'close'})" |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
1067 call assert_fails(cmd, 'E474:') |
13109
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
1068 let cmd = "call term_start('', {'curwin' : 1, 'term_finish' : 'close'})" |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
1069 call assert_fails(cmd, 'E474:') |
13109
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
1070 let cmd = "call term_start({}, {'curwin' : 1, 'term_finish' : 'close'})" |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
1071 call assert_fails(cmd, 'E474:') |
13109
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
1072 let cmd = "call term_start(0, {'curwin' : 1, 'term_finish' : 'close'})" |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
1073 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
|
1074 let cmd = "call term_start('', {'term_name' : []})" |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
1075 call assert_fails(cmd, 'E730:') |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1076 let cmd = "call term_start('', {'term_finish' : 'axby'})" |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
1077 call assert_fails(cmd, 'E475:') |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1078 let cmd = "call term_start('', {'eof_chars' : []})" |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
1079 call assert_fails(cmd, 'E730:') |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1080 let cmd = "call term_start('', {'term_kill' : []})" |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
1081 call assert_fails(cmd, 'E730:') |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1082 let cmd = "call term_start('', {'tty_type' : []})" |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
1083 call assert_fails(cmd, 'E730:') |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1084 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
|
1085 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
|
1086 let cmd = "call term_start('', {'term_highlight' : []})" |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
1087 call assert_fails(cmd, 'E730:') |
20524
bed30e6b5a09
patch 8.2.0816: terminal test fails when compiled with Athena
Bram Moolenaar <Bram@vim.org>
parents:
20514
diff
changeset
|
1088 if has('gui') || has('termguicolors') |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1089 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
|
1090 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
|
1091 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
|
1092 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
|
1093 let cmd = "call term_start('', {'ansi_colors' : repeat(['blue'], 18)})" |
20524
bed30e6b5a09
patch 8.2.0816: terminal test fails when compiled with Athena
Bram Moolenaar <Bram@vim.org>
parents:
20514
diff
changeset
|
1094 if has('gui_running') || has('termguicolors') |
bed30e6b5a09
patch 8.2.0816: terminal test fails when compiled with Athena
Bram Moolenaar <Bram@vim.org>
parents:
20514
diff
changeset
|
1095 call assert_fails(cmd, 'E475:') |
bed30e6b5a09
patch 8.2.0816: terminal test fails when compiled with Athena
Bram Moolenaar <Bram@vim.org>
parents:
20514
diff
changeset
|
1096 else |
bed30e6b5a09
patch 8.2.0816: terminal test fails when compiled with Athena
Bram Moolenaar <Bram@vim.org>
parents:
20514
diff
changeset
|
1097 call assert_fails(cmd, 'E254:') |
bed30e6b5a09
patch 8.2.0816: terminal test fails when compiled with Athena
Bram Moolenaar <Bram@vim.org>
parents:
20514
diff
changeset
|
1098 endif |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
1099 endif |
13109
fb1b162cdcf6
patch 8.0.1429: crash when calling term_start() with empty argument
Christian Brabandt <cb@256bit.org>
parents:
12983
diff
changeset
|
1100 endfunc |
13132
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
1101 |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
1102 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
|
1103 CheckUnix |
13132
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
1104 |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
1105 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
|
1106 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
|
1107 |
13543
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
1108 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
|
1109 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
|
1110 |
13543
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
1111 " 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
|
1112 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
|
1113 |
36c503100cb3
patch 8.0.1452: terminal test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
13132
diff
changeset
|
1114 " 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
|
1115 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
|
1116 |
13543
98d832e4e394
patch 8.0.1645: test for terminal response to escape sequence may fail
Christian Brabandt <cb@256bit.org>
parents:
13541
diff
changeset
|
1117 " 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
|
1118 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
|
1119 |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1120 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
|
1121 exe buf . 'bwipe' |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
1122 unlet g:job |
fe0cec169589
patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents:
13109
diff
changeset
|
1123 endfunc |
13438
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
1124 |
26554
7a74515dde6b
patch 8.2.3806: terminal focus test fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
26546
diff
changeset
|
1125 " Run this first, it fails when run after other tests. |
7a74515dde6b
patch 8.2.3806: terminal focus test fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
26546
diff
changeset
|
1126 func Test_aa_terminal_focus_events() |
26462
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1127 CheckNotGui |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1128 CheckUnix |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1129 CheckRunVimInTerminal |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1130 |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1131 let save_term = &term |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1132 let save_ttymouse = &ttymouse |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1133 set term=xterm ttymouse=xterm2 |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1134 |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1135 let lines =<< trim END |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1136 set term=xterm ttymouse=xterm2 |
26466
d413104a94c8
patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents:
26462
diff
changeset
|
1137 au FocusLost * call setline(1, 'I am lost') | set nomod |
d413104a94c8
patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents:
26462
diff
changeset
|
1138 au FocusGained * call setline(1, 'I am back') | set nomod |
26462
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1139 END |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1140 call writefile(lines, 'XtermFocus') |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1141 let buf = RunVimInTerminal('-S XtermFocus', #{rows: 6}) |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1142 |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1143 " Send a focus event to ourselves, it should be forwarded to the terminal |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1144 call feedkeys("\<Esc>[O", "Lx!") |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1145 call VerifyScreenDump(buf, 'Test_terminal_focus_1', {}) |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1146 |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1147 call feedkeys("\<Esc>[I", "Lx!") |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1148 call VerifyScreenDump(buf, 'Test_terminal_focus_2', {}) |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1149 |
26466
d413104a94c8
patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents:
26462
diff
changeset
|
1150 " check that a command line being edited is redrawn in place |
d413104a94c8
patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents:
26462
diff
changeset
|
1151 call term_sendkeys(buf, ":" .. repeat('x', 80)) |
d413104a94c8
patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents:
26462
diff
changeset
|
1152 call TermWait(buf) |
d413104a94c8
patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents:
26462
diff
changeset
|
1153 call feedkeys("\<Esc>[O", "Lx!") |
d413104a94c8
patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents:
26462
diff
changeset
|
1154 call VerifyScreenDump(buf, 'Test_terminal_focus_3', {}) |
d413104a94c8
patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents:
26462
diff
changeset
|
1155 call term_sendkeys(buf, "\<Esc>") |
d413104a94c8
patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents:
26462
diff
changeset
|
1156 |
26462
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1157 call StopVimInTerminal(buf) |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1158 call delete('XtermFocus') |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1159 let &term = save_term |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1160 let &ttymouse = save_ttymouse |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1161 endfunc |
3af56224dca6
patch 8.2.3761: focus change is not passed on to a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
26217
diff
changeset
|
1162 |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1163 " 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
|
1164 " :qall works. |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1165 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
|
1166 " 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
|
1167 " 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
|
1168 " 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
|
1169 let after = [ |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1170 \ a:line1, |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1171 \ 'let buf = bufnr("%")', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1172 \ '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
|
1173 \ ' sleep 10m', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1174 \ 'endwhile', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1175 \ a:line2, |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1176 \ '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
|
1177 \ 'qall', |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1178 \ ] |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1179 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
|
1180 return |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
1181 endif |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1182 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
|
1183 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
|
1184 endfunc |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
1185 |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
1186 " 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
|
1187 " 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
|
1188 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
|
1189 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
|
1190 endfunc |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1191 |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1192 " 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
|
1193 " 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
|
1194 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
|
1195 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
|
1196 endfunc |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1197 |
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1198 " 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
|
1199 " 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
|
1200 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
|
1201 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
|
1202 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
|
1203 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
|
1204 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
|
1205 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
|
1206 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
|
1207 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
|
1208 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
|
1209 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
|
1210 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
|
1211 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
|
1212 [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
|
1213 |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1214 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
|
1215 return |
33eea5ce5415
patch 8.0.1593: :qall never exits with an active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13435
diff
changeset
|
1216 endif |
13499
661394686fd8
patch 8.0.1623: terminal kill tests are flaky
Christian Brabandt <cb@256bit.org>
parents:
13476
diff
changeset
|
1217 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
|
1218 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
|
1219 endfunc |
13440
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
1220 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
1221 " 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
|
1222 " 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
|
1223 func Test_terminal_qall_prompt() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1224 CheckRunVimInTerminal |
29142
74974ecddc8a
patch 8.2.5091: terminal test fails with some shell commands
Bram Moolenaar <Bram@vim.org>
parents:
28919
diff
changeset
|
1225 |
29151
6dfdbe81899e
patch 8.2.5095: terminal test still fails with some shell commands
Bram Moolenaar <Bram@vim.org>
parents:
29142
diff
changeset
|
1226 let buf = RunVimInTerminal('', {}) |
6dfdbe81899e
patch 8.2.5095: terminal test still fails with some shell commands
Bram Moolenaar <Bram@vim.org>
parents:
29142
diff
changeset
|
1227 |
29142
74974ecddc8a
patch 8.2.5091: terminal test fails with some shell commands
Bram Moolenaar <Bram@vim.org>
parents:
28919
diff
changeset
|
1228 " the shell may set the window title, we don't want that here |
29153
5fb3e2a89d7a
patch 8.2.5096: terminal test still fails with some shell commands
Bram Moolenaar <Bram@vim.org>
parents:
29151
diff
changeset
|
1229 call term_sendkeys(buf, ":call test_override('vterm_title', 1)\<CR>") |
13440
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
1230 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
1231 " 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
|
1232 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
|
1233 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
|
1234 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
|
1235 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
1236 " 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
|
1237 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
|
1238 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
|
1239 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
|
1240 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
|
1241 |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
1242 " 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
|
1243 quit |
22439cdda382
patch 8.0.1594: :conform qall not tested with active terminal window
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
1244 endfunc |
13444
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1245 |
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
|
1246 " 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
|
1247 " 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
|
1248 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
|
1249 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
|
1250 |
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
|
1251 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
|
1252 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
|
1253 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
|
1254 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
|
1255 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
|
1256 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
|
1257 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
|
1258 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
|
1259 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
|
1260 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
|
1261 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
|
1262 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
|
1263 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
|
1264 |
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
|
1265 " 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
|
1266 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
|
1267 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
|
1268 |
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
|
1269 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
|
1270 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
|
1271 |
13462
568dcfac9daf
patch 8.0.1605: terminal test is a bit flaky
Christian Brabandt <cb@256bit.org>
parents:
13444
diff
changeset
|
1272 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
|
1273 augroup repro |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1274 au! |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1275 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
|
1276 augroup END |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1277 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1278 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
|
1279 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1280 " 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
|
1281 terminal |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1282 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
|
1283 bwipe! |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1284 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1285 " 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
|
1286 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
|
1287 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
|
1288 bwipe! |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1289 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1290 " 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
|
1291 terminal ++hidden |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1292 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
|
1293 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
|
1294 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
|
1295 endfor |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1296 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1297 " 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
|
1298 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
|
1299 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
|
1300 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
|
1301 |
9f06f7aca74c
patch 8.0.1596: no autocommand specifically for opening a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13440
diff
changeset
|
1302 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
|
1303 au! repro |
22872
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1304 endfunc |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1305 |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1306 func Test_open_term_from_cmd() |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1307 CheckUnix |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1308 CheckRunVimInTerminal |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1309 |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1310 let lines =<< trim END |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1311 call setline(1, ['a', 'b', 'c']) |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1312 3 |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1313 set incsearch |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1314 cnoremap <F3> <Cmd>call term_start(['/bin/sh', '-c', ':'])<CR> |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1315 END |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1316 call writefile(lines, 'Xopenterm') |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1317 let buf = RunVimInTerminal('-S Xopenterm', {}) |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1318 |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1319 " this opens a window, incsearch should not use the old cursor position |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1320 call term_sendkeys(buf, "/\<F3>") |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1321 call VerifyScreenDump(buf, 'Test_terminal_from_cmd', {}) |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1322 call term_sendkeys(buf, "\<Esc>") |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1323 call term_sendkeys(buf, ":q\<CR>") |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1324 |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1325 call StopVimInTerminal(buf) |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1326 call delete('Xopenterm') |
5a7db84713dc
patch 8.2.1983: ml_get error when using <Cmd> to open a terminal
Bram Moolenaar <Bram@vim.org>
parents:
22864
diff
changeset
|
1327 endfunc |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1328 |
23890
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1329 func Test_combining_double_width() |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1330 CheckUnix |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1331 CheckRunVimInTerminal |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1332 |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1333 call writefile(["\xe3\x83\x9b\xe3\x82\x9a"], 'Xonedouble') |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1334 let lines =<< trim END |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1335 call term_start(['/bin/sh', '-c', 'cat Xonedouble']) |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1336 END |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1337 call writefile(lines, 'Xcombining') |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1338 let buf = RunVimInTerminal('-S Xcombining', #{rows: 9}) |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1339 |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1340 " this opens a window, incsearch should not use the old cursor position |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1341 call VerifyScreenDump(buf, 'Test_terminal_combining', {}) |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1342 call term_sendkeys(buf, ":q\<CR>") |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1343 |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1344 call StopVimInTerminal(buf) |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1345 call delete('Xonedouble') |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1346 call delete('Xcombining') |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1347 endfunc |
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
22987
diff
changeset
|
1348 |
22876
b952e0a3af2f
patch 8.2.1985: crash when closing terminal popup with <Cmd> mapping
Bram Moolenaar <Bram@vim.org>
parents:
22872
diff
changeset
|
1349 func Test_terminal_popup_with_cmd() |
b952e0a3af2f
patch 8.2.1985: crash when closing terminal popup with <Cmd> mapping
Bram Moolenaar <Bram@vim.org>
parents:
22872
diff
changeset
|
1350 " this was crashing |
b952e0a3af2f
patch 8.2.1985: crash when closing terminal popup with <Cmd> mapping
Bram Moolenaar <Bram@vim.org>
parents:
22872
diff
changeset
|
1351 let buf = term_start(&shell, #{hidden: v:true}) |
b952e0a3af2f
patch 8.2.1985: crash when closing terminal popup with <Cmd> mapping
Bram Moolenaar <Bram@vim.org>
parents:
22872
diff
changeset
|
1352 let s:winid = popup_create(buf, {}) |
b952e0a3af2f
patch 8.2.1985: crash when closing terminal popup with <Cmd> mapping
Bram Moolenaar <Bram@vim.org>
parents:
22872
diff
changeset
|
1353 tnoremap <F3> <Cmd>call popup_close(s:winid)<CR> |
b952e0a3af2f
patch 8.2.1985: crash when closing terminal popup with <Cmd> mapping
Bram Moolenaar <Bram@vim.org>
parents:
22872
diff
changeset
|
1354 call feedkeys("\<F3>", 'xt') |
b952e0a3af2f
patch 8.2.1985: crash when closing terminal popup with <Cmd> mapping
Bram Moolenaar <Bram@vim.org>
parents:
22872
diff
changeset
|
1355 |
b952e0a3af2f
patch 8.2.1985: crash when closing terminal popup with <Cmd> mapping
Bram Moolenaar <Bram@vim.org>
parents:
22872
diff
changeset
|
1356 tunmap <F3> |
b952e0a3af2f
patch 8.2.1985: crash when closing terminal popup with <Cmd> mapping
Bram Moolenaar <Bram@vim.org>
parents:
22872
diff
changeset
|
1357 exe 'bwipe! ' .. buf |
b952e0a3af2f
patch 8.2.1985: crash when closing terminal popup with <Cmd> mapping
Bram Moolenaar <Bram@vim.org>
parents:
22872
diff
changeset
|
1358 unlet s:winid |
b952e0a3af2f
patch 8.2.1985: crash when closing terminal popup with <Cmd> mapping
Bram Moolenaar <Bram@vim.org>
parents:
22872
diff
changeset
|
1359 endfunc |
b952e0a3af2f
patch 8.2.1985: crash when closing terminal popup with <Cmd> mapping
Bram Moolenaar <Bram@vim.org>
parents:
22872
diff
changeset
|
1360 |
22900
2c1520981e63
patch 8.2.1997: window changes when using bufload() while in a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22882
diff
changeset
|
1361 func Test_terminal_popup_bufload() |
2c1520981e63
patch 8.2.1997: window changes when using bufload() while in a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22882
diff
changeset
|
1362 let termbuf = term_start(&shell, #{hidden: v:true, term_finish: 'close'}) |
2c1520981e63
patch 8.2.1997: window changes when using bufload() while in a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22882
diff
changeset
|
1363 let winid = popup_create(termbuf, {}) |
2c1520981e63
patch 8.2.1997: window changes when using bufload() while in a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22882
diff
changeset
|
1364 sleep 50m |
2c1520981e63
patch 8.2.1997: window changes when using bufload() while in a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22882
diff
changeset
|
1365 |
2c1520981e63
patch 8.2.1997: window changes when using bufload() while in a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22882
diff
changeset
|
1366 let newbuf = bufadd('') |
2c1520981e63
patch 8.2.1997: window changes when using bufload() while in a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22882
diff
changeset
|
1367 call bufload(newbuf) |
2c1520981e63
patch 8.2.1997: window changes when using bufload() while in a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22882
diff
changeset
|
1368 call setbufline(newbuf, 1, 'foobar') |
2c1520981e63
patch 8.2.1997: window changes when using bufload() while in a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22882
diff
changeset
|
1369 |
2c1520981e63
patch 8.2.1997: window changes when using bufload() while in a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22882
diff
changeset
|
1370 " must not have switched to another window |
2c1520981e63
patch 8.2.1997: window changes when using bufload() while in a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22882
diff
changeset
|
1371 call assert_equal(winid, win_getid()) |
2c1520981e63
patch 8.2.1997: window changes when using bufload() while in a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22882
diff
changeset
|
1372 |
22904
a7c1a92bd13c
patch 8.2.1999: terminal popup test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
22902
diff
changeset
|
1373 call StopShellInTerminal(termbuf) |
a7c1a92bd13c
patch 8.2.1999: terminal popup test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
22902
diff
changeset
|
1374 call WaitFor({-> win_getid() != winid}) |
22900
2c1520981e63
patch 8.2.1997: window changes when using bufload() while in a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22882
diff
changeset
|
1375 exe 'bwipe! ' .. newbuf |
2c1520981e63
patch 8.2.1997: window changes when using bufload() while in a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22882
diff
changeset
|
1376 endfunc |
2c1520981e63
patch 8.2.1997: window changes when using bufload() while in a terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22882
diff
changeset
|
1377 |
26544
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1378 func Test_terminal_popup_two_windows() |
26546
d9aac1eaf9a3
patch 8.2.3802: terminal in two windows test fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
26544
diff
changeset
|
1379 CheckRunVimInTerminal |
26544
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1380 CheckUnix |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1381 |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1382 " use "sh" instead of "&shell" in the hope it will use a short prompt |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1383 let lines =<< trim END |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1384 let termbuf = term_start('sh', #{hidden: v:true, term_finish: 'close'}) |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1385 exe 'buffer ' .. termbuf |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1386 |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1387 let winid = popup_create(termbuf, #{line: 2, minwidth: 30, border: []}) |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1388 sleep 50m |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1389 |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1390 call term_sendkeys(termbuf, "echo 'test'") |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1391 END |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1392 call writefile(lines, 'XpopupScript') |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1393 let buf = RunVimInTerminal('-S XpopupScript', {}) |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1394 |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1395 " typed text appears both in normal window and in popup |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1396 call WaitForAssert({-> assert_match("echo 'test'", term_getline(buf, 1))}) |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1397 call WaitForAssert({-> assert_match("echo 'test'", term_getline(buf, 3))}) |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1398 |
26546
d9aac1eaf9a3
patch 8.2.3802: terminal in two windows test fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
26544
diff
changeset
|
1399 call term_sendkeys(buf, "\<CR>\<CR>exit\<CR>") |
d9aac1eaf9a3
patch 8.2.3802: terminal in two windows test fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
26544
diff
changeset
|
1400 call TermWait(buf) |
d9aac1eaf9a3
patch 8.2.3802: terminal in two windows test fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
26544
diff
changeset
|
1401 call term_sendkeys(buf, ":q\<CR>") |
26544
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1402 call StopVimInTerminal(buf) |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1403 call delete('XpopupScript') |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1404 endfunc |
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1405 |
22882
be7f52838056
patch 8.2.1988: still in Insert mode when opening terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22876
diff
changeset
|
1406 func Test_terminal_popup_insert_cmd() |
be7f52838056
patch 8.2.1988: still in Insert mode when opening terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22876
diff
changeset
|
1407 CheckUnix |
be7f52838056
patch 8.2.1988: still in Insert mode when opening terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22876
diff
changeset
|
1408 |
be7f52838056
patch 8.2.1988: still in Insert mode when opening terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22876
diff
changeset
|
1409 inoremap <F3> <Cmd>call StartTermInPopup()<CR> |
be7f52838056
patch 8.2.1988: still in Insert mode when opening terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22876
diff
changeset
|
1410 func StartTermInPopup() |
22902
1bde09eef44a
patch 8.2.1998: terminal Cmd test sometimes fails to close popup
Bram Moolenaar <Bram@vim.org>
parents:
22900
diff
changeset
|
1411 call term_start(['/bin/sh', '-c', 'cat'], #{hidden: v:true, term_finish: 'close'})->popup_create(#{highlight: 'Pmenu'}) |
22882
be7f52838056
patch 8.2.1988: still in Insert mode when opening terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22876
diff
changeset
|
1412 endfunc |
be7f52838056
patch 8.2.1988: still in Insert mode when opening terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22876
diff
changeset
|
1413 call feedkeys("i\<F3>") |
be7f52838056
patch 8.2.1988: still in Insert mode when opening terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22876
diff
changeset
|
1414 sleep 10m |
be7f52838056
patch 8.2.1988: still in Insert mode when opening terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22876
diff
changeset
|
1415 call assert_equal('n', mode()) |
be7f52838056
patch 8.2.1988: still in Insert mode when opening terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22876
diff
changeset
|
1416 |
be7f52838056
patch 8.2.1988: still in Insert mode when opening terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22876
diff
changeset
|
1417 call feedkeys("\<C-D>", 'xt') |
22920
696364caabea
patch 8.2.2007: test for insert mode in popup is not reliable
Bram Moolenaar <Bram@vim.org>
parents:
22904
diff
changeset
|
1418 call WaitFor({-> popup_list() == []}) |
22882
be7f52838056
patch 8.2.1988: still in Insert mode when opening terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22876
diff
changeset
|
1419 delfunc StartTermInPopup |
be7f52838056
patch 8.2.1988: still in Insert mode when opening terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22876
diff
changeset
|
1420 iunmap <F3> |
be7f52838056
patch 8.2.1988: still in Insert mode when opening terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22876
diff
changeset
|
1421 endfunc |
be7f52838056
patch 8.2.1988: still in Insert mode when opening terminal popup
Bram Moolenaar <Bram@vim.org>
parents:
22876
diff
changeset
|
1422 |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1423 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
|
1424 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
|
1425 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
|
1426 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
|
1427 endfunc |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1428 |
13557
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1429 func Test_terminal_dumpwrite_composing() |
18143
2416e1a887ca
patch 8.1.2066: no tests for state()
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
1430 CheckRunVimInTerminal |
26544
30abd8e55ee5
patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents:
26466
diff
changeset
|
1431 |
13557
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1432 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
|
1433 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
|
1434 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
|
1435 |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1436 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
|
1437 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
|
1438 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
|
1439 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
|
1440 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
|
1441 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
|
1442 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
|
1443 |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1444 call StopVimInTerminal(buf) |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1445 call delete('Xcomposing') |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1446 call delete('Xdump') |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1447 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
|
1448 endfunc |
4911058c43eb
patch 8.0.1652: term_dumpwrite() does not output composing characters
Christian Brabandt <cb@256bit.org>
parents:
13555
diff
changeset
|
1449 |
20365
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1450 " 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
|
1451 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
|
1452 CheckRunVimInTerminal |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1453 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
|
1454 let buf = RunVimInTerminal('', {}) |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1455 call TermWait(buf) |
20365
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1456 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
|
1457 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
|
1458 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
|
1459 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
|
1460 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
|
1461 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
|
1462 call assert_fails("call term_dumpwrite(buf, test_null_string())", 'E482:') |
20508
357dea6b9fde
patch 8.2.0808: not enough testing for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
20502
diff
changeset
|
1463 call test_garbagecollect_now() |
22780
2e681033d766
patch 8.2.1938: wiping out a terminal buffer makes some tests fail
Bram Moolenaar <Bram@vim.org>
parents:
22742
diff
changeset
|
1464 call StopVimInTerminal(buf, 0) |
21897
e0af4660dfc7
patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
1465 call TermWait(buf) |
20365
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1466 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
|
1467 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
|
1468 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
|
1469 endfunc |
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1470 |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1471 " 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
|
1472 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
|
1473 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
|
1474 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
|
1475 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
|
1476 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
|
1477 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
|
1478 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
|
1479 |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1480 " 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
|
1481 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
|
1482 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
|
1483 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
|
1484 |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1485 " 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
|
1486 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
|
1487 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
|
1488 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
|
1489 |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1490 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
|
1491 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
|
1492 new |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1493 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
|
1494 quit |
a5e3509b33ca
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Bram Moolenaar <Bram@vim.org>
parents:
16720
diff
changeset
|
1495 call assert_fails("call term_dumpload('dumps/Test_popup_command_01.dump', {'bufnr': closedbuf})", 'E475:') |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
1496 call assert_fails('call term_dumpload([])', 'E730:') |
20365
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1497 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
|
1498 |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1499 quit |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1500 endfunc |
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1501 |
18327
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1502 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
|
1503 CheckRunVimInTerminal |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1504 |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1505 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
|
1506 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
|
1507 END |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1508 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
|
1509 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
|
1510 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
|
1511 |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1512 call StopVimInTerminal(buf) |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1513 call delete('XtermDumpload') |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1514 endfunc |
0e9d3a77c624
patch 8.1.2158: terminal attributes missing in Terminal-normal mode
Bram Moolenaar <Bram@vim.org>
parents:
18321
diff
changeset
|
1515 |
13525
7d0a8ca17f30
patch 8.0.1636: no test for term_dumpload() and term_dumpdiff()
Christian Brabandt <cb@256bit.org>
parents:
13499
diff
changeset
|
1516 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
|
1517 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
|
1518 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
|
1519 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
|
1520 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
|
1521 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
|
1522 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
|
1523 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
|
1524 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
|
1525 |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
1526 call assert_fails('call term_dumpdiff("X1.dump", [])', 'E730:') |
20365
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
1527 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
|
1528 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
|
1529 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
|
1530 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
|
1531 endfunc |
13527
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1532 |
15832
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1533 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
|
1534 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
|
1535 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
|
1536 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
|
1537 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
|
1538 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
|
1539 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
|
1540 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
|
1541 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
|
1542 |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1543 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
|
1544 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
|
1545 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
|
1546 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
|
1547 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
|
1548 quit |
20508
357dea6b9fde
patch 8.2.0808: not enough testing for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
20502
diff
changeset
|
1549 |
357dea6b9fde
patch 8.2.0808: not enough testing for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
20502
diff
changeset
|
1550 " Diff two terminal dump files with different number of rows |
357dea6b9fde
patch 8.2.0808: not enough testing for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
20502
diff
changeset
|
1551 " Swap the diffs |
357dea6b9fde
patch 8.2.0808: not enough testing for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
20502
diff
changeset
|
1552 call term_dumpdiff('dumps/Test_popup_command_01.dump', 'dumps/Test_winline_rnu.dump') |
357dea6b9fde
patch 8.2.0808: not enough testing for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
20502
diff
changeset
|
1553 call assert_match('Test_popup_command_01.dump', getline(21)) |
357dea6b9fde
patch 8.2.0808: not enough testing for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
20502
diff
changeset
|
1554 call assert_match('Test_winline_rnu.dump', getline(42)) |
357dea6b9fde
patch 8.2.0808: not enough testing for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
20502
diff
changeset
|
1555 normal s |
357dea6b9fde
patch 8.2.0808: not enough testing for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
20502
diff
changeset
|
1556 call assert_match('Test_winline_rnu.dump', getline(6)) |
357dea6b9fde
patch 8.2.0808: not enough testing for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
20502
diff
changeset
|
1557 call assert_match('Test_popup_command_01.dump', getline(27)) |
357dea6b9fde
patch 8.2.0808: not enough testing for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
20502
diff
changeset
|
1558 quit |
15832
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1559 endfunc |
85c94163c4ab
patch 8.1.0923: terminal dump diff swap does not update file names
Bram Moolenaar <Bram@vim.org>
parents:
15830
diff
changeset
|
1560 |
13527
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1561 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
|
1562 set laststatus=0 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1563 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
|
1564 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
|
1565 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
|
1566 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
|
1567 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
|
1568 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
|
1569 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
|
1570 quit |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1571 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1572 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
|
1573 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
|
1574 call assert_equal(2, winnr('$')) |
17262
041156ce1d22
patch 8.1.1630: various small problems
Bram Moolenaar <Bram@vim.org>
parents:
17164
diff
changeset
|
1575 call assert_equal(&columns, winwidth(0)) |
041156ce1d22
patch 8.1.1630: various small problems
Bram Moolenaar <Bram@vim.org>
parents:
17164
diff
changeset
|
1576 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
|
1577 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
|
1578 quit |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1579 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1580 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
|
1581 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
|
1582 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
|
1583 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
|
1584 bwipe |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1585 |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1586 set laststatus& |
b2b99d01321b
patch 8.0.1637: no test for term_dumpdiff() options argument
Christian Brabandt <cb@256bit.org>
parents:
13525
diff
changeset
|
1587 endfunc |
13535
e9ffb5b35266
patch 8.0.1641: job in terminal can't communicate with Vim
Christian Brabandt <cb@256bit.org>
parents:
13527
diff
changeset
|
1588 |
15557
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1589 " 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
|
1590 " yet. |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1591 " 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
|
1592 " 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
|
1593 " 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
|
1594 " 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
|
1595 " 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
|
1596 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
|
1597 CheckUnix |
26598
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1598 CheckFeature timers |
18041
060e1b1220c6
patch 8.1.2016: terminal altscreen test now fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
18039
diff
changeset
|
1599 |
15557
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1600 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
|
1601 terminal |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1602 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
|
1603 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
|
1604 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
|
1605 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
|
1606 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
|
1607 |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1608 sleep 2 |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1609 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
|
1610 au! BufLeave |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1611 set statusline= |
c0560da7873e
patch 8.1.0786: ml_get error when updating the status line
Bram Moolenaar <Bram@vim.org>
parents:
15545
diff
changeset
|
1612 endfunc |
16241
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
16233
diff
changeset
|
1613 |
26598
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1614 func CheckTerminalWindowWorks(buf) |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1615 call WaitForAssert({-> assert_match('!sh \[running\]', term_getline(a:buf, 10))}) |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1616 call term_sendkeys(a:buf, "exit\<CR>") |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1617 call WaitForAssert({-> assert_match('!sh \[finished\]', term_getline(a:buf, 10))}) |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1618 call term_sendkeys(a:buf, ":q\<CR>") |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1619 call WaitForAssert({-> assert_match('^\~', term_getline(a:buf, 10))}) |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1620 endfunc |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1621 |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1622 func Test_start_terminal_from_timer() |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1623 CheckUnix |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1624 CheckFeature timers |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1625 |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1626 " Open a terminal window from a timer, typed text goes to the terminal |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1627 call writefile(["call timer_start(100, { -> term_start('sh') })"], 'XtimerTerm') |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1628 let buf = RunVimInTerminal('-S XtimerTerm', {}) |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1629 call CheckTerminalWindowWorks(buf) |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1630 |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1631 " do the same in Insert mode |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1632 call term_sendkeys(buf, ":call timer_start(200, { -> term_start('sh') })\<CR>a") |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1633 call CheckTerminalWindowWorks(buf) |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1634 |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1635 call StopVimInTerminal(buf) |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1636 call delete('XtimerTerm') |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1637 endfunc |
b3ac5a4dc158
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Bram Moolenaar <Bram@vim.org>
parents:
26554
diff
changeset
|
1638 |
22448
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1639 func Test_terminal_window_focus() |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1640 let winid1 = win_getid() |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1641 terminal |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1642 let winid2 = win_getid() |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1643 call feedkeys("\<C-W>j", 'xt') |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1644 call assert_equal(winid1, win_getid()) |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1645 call feedkeys("\<C-W>k", 'xt') |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1646 call assert_equal(winid2, win_getid()) |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1647 " can use a cursor key here |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1648 call feedkeys("\<C-W>\<Down>", 'xt') |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1649 call assert_equal(winid1, win_getid()) |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1650 call feedkeys("\<C-W>\<Up>", 'xt') |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1651 call assert_equal(winid2, win_getid()) |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1652 |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1653 bwipe! |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1654 endfunc |
5e287462487e
patch 8.2.1772: cannot use CTRL-W <Down> to move out of a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22161
diff
changeset
|
1655 |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1656 func Api_drop_common(options) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1657 call assert_equal(1, winnr('$')) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1658 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1659 " Use the title termcap entries to output the escape sequence. |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1660 call writefile([ |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1661 \ 'set title', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1662 \ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1663 \ 'let &titlestring = ''["drop","Xtextfile"' . a:options . ']''', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1664 \ 'redraw', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1665 \ "set t_ts=", |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1666 \ ], 'Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1667 let buf = RunVimInTerminal('-S Xscript', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1668 call WaitFor({-> bufnr('Xtextfile') > 0}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1669 call assert_equal('Xtextfile', expand('%:t')) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1670 call assert_true(winnr('$') >= 3) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1671 return buf |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1672 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1673 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1674 func Test_terminal_api_drop_newwin() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1675 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1676 let buf = Api_drop_common('') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1677 call assert_equal(0, &bin) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1678 call assert_equal('', &fenc) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1679 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1680 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1681 call delete('Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1682 bwipe Xtextfile |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1683 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1684 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1685 func Test_terminal_api_drop_newwin_bin() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1686 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1687 let buf = Api_drop_common(',{"bin":1}') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1688 call assert_equal(1, &bin) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1689 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1690 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1691 call delete('Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1692 bwipe Xtextfile |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1693 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1694 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1695 func Test_terminal_api_drop_newwin_binary() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1696 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1697 let buf = Api_drop_common(',{"binary":1}') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1698 call assert_equal(1, &bin) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1699 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1700 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1701 call delete('Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1702 bwipe Xtextfile |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1703 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1704 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1705 func Test_terminal_api_drop_newwin_nobin() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1706 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1707 set binary |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1708 let buf = Api_drop_common(',{"nobin":1}') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1709 call assert_equal(0, &bin) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1710 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1711 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1712 call delete('Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1713 bwipe Xtextfile |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1714 set nobinary |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1715 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1716 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1717 func Test_terminal_api_drop_newwin_nobinary() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1718 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1719 set binary |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1720 let buf = Api_drop_common(',{"nobinary":1}') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1721 call assert_equal(0, &bin) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1722 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1723 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1724 call delete('Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1725 bwipe Xtextfile |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1726 set nobinary |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1727 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1728 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1729 func Test_terminal_api_drop_newwin_ff() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1730 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1731 let buf = Api_drop_common(',{"ff":"dos"}') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1732 call assert_equal("dos", &ff) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1733 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1734 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1735 call delete('Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1736 bwipe Xtextfile |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1737 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1738 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1739 func Test_terminal_api_drop_newwin_fileformat() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1740 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1741 let buf = Api_drop_common(',{"fileformat":"dos"}') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1742 call assert_equal("dos", &ff) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1743 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1744 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1745 call delete('Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1746 bwipe Xtextfile |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1747 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1748 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1749 func Test_terminal_api_drop_newwin_enc() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1750 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1751 let buf = Api_drop_common(',{"enc":"utf-16"}') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1752 call assert_equal("utf-16", &fenc) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1753 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1754 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1755 call delete('Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1756 bwipe Xtextfile |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1757 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1758 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1759 func Test_terminal_api_drop_newwin_encoding() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1760 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1761 let buf = Api_drop_common(',{"encoding":"utf-16"}') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1762 call assert_equal("utf-16", &fenc) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1763 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1764 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1765 call delete('Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1766 bwipe Xtextfile |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1767 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1768 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1769 func Test_terminal_api_drop_oldwin() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1770 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1771 let firstwinid = win_getid() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1772 split Xtextfile |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1773 let textfile_winid = win_getid() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1774 call assert_equal(2, winnr('$')) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1775 call win_gotoid(firstwinid) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1776 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1777 " Use the title termcap entries to output the escape sequence. |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1778 call writefile([ |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1779 \ 'set title', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1780 \ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1781 \ 'let &titlestring = ''["drop","Xtextfile"]''', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1782 \ 'redraw', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1783 \ "set t_ts=", |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1784 \ ], 'Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1785 let buf = RunVimInTerminal('-S Xscript', {'rows': 10}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1786 call WaitForAssert({-> assert_equal('Xtextfile', expand('%:t'))}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1787 call assert_equal(textfile_winid, win_getid()) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1788 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1789 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1790 call delete('Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1791 bwipe Xtextfile |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1792 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1793 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1794 func Tapi_TryThis(bufnum, arg) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1795 let g:called_bufnum = a:bufnum |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1796 let g:called_arg = a:arg |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1797 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1798 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1799 func WriteApiCall(funcname) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1800 " Use the title termcap entries to output the escape sequence. |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1801 call writefile([ |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1802 \ 'set title', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1803 \ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1804 \ 'let &titlestring = ''["call","' . a:funcname . '",["hello",123]]''', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1805 \ 'redraw', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1806 \ "set t_ts=", |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1807 \ ], 'Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1808 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1809 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1810 func Test_terminal_api_call() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1811 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1812 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1813 unlet! g:called_bufnum |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1814 unlet! g:called_arg |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1815 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1816 call WriteApiCall('Tapi_TryThis') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1817 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1818 " Default |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1819 let buf = RunVimInTerminal('-S Xscript', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1820 call WaitFor({-> exists('g:called_bufnum')}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1821 call assert_equal(buf, g:called_bufnum) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1822 call assert_equal(['hello', 123], g:called_arg) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1823 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1824 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1825 unlet! g:called_bufnum |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1826 unlet! g:called_arg |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1827 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1828 " Enable explicitly |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1829 let buf = RunVimInTerminal('-S Xscript', {'term_api': 'Tapi_Try'}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1830 call WaitFor({-> exists('g:called_bufnum')}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1831 call assert_equal(buf, g:called_bufnum) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1832 call assert_equal(['hello', 123], g:called_arg) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1833 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1834 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1835 unlet! g:called_bufnum |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1836 unlet! g:called_arg |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1837 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1838 func! ApiCall_TryThis(bufnum, arg) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1839 let g:called_bufnum2 = a:bufnum |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1840 let g:called_arg2 = a:arg |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1841 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1842 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1843 call WriteApiCall('ApiCall_TryThis') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1844 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1845 " Use prefix match |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1846 let buf = RunVimInTerminal('-S Xscript', {'term_api': 'ApiCall_'}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1847 call WaitFor({-> exists('g:called_bufnum2')}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1848 call assert_equal(buf, g:called_bufnum2) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1849 call assert_equal(['hello', 123], g:called_arg2) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1850 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1851 |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
1852 call assert_fails("call term_start('ls', {'term_api' : []})", 'E730:') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1853 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1854 unlet! g:called_bufnum2 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1855 unlet! g:called_arg2 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1856 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1857 call delete('Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1858 delfunction! ApiCall_TryThis |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1859 unlet! g:called_bufnum2 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1860 unlet! g:called_arg2 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1861 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1862 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1863 func Test_terminal_api_call_fails() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1864 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1865 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1866 func! TryThis(bufnum, arg) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1867 let g:called_bufnum3 = a:bufnum |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1868 let g:called_arg3 = a:arg |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1869 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1870 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1871 call WriteApiCall('TryThis') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1872 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1873 unlet! g:called_bufnum3 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1874 unlet! g:called_arg3 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1875 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1876 " Not permitted |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1877 call ch_logfile('Xlog', 'w') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1878 let buf = RunVimInTerminal('-S Xscript', {'term_api': ''}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1879 call WaitForAssert({-> assert_match('Unpermitted function: TryThis', string(readfile('Xlog')))}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1880 call assert_false(exists('g:called_bufnum3')) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1881 call assert_false(exists('g:called_arg3')) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1882 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1883 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1884 " No match |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1885 call ch_logfile('Xlog', 'w') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1886 let buf = RunVimInTerminal('-S Xscript', {'term_api': 'TryThat'}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1887 call WaitFor({-> string(readfile('Xlog')) =~ 'Unpermitted function: TryThis'}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1888 call assert_false(exists('g:called_bufnum3')) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1889 call assert_false(exists('g:called_arg3')) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1890 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1891 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1892 call delete('Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1893 call ch_logfile('') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1894 call delete('Xlog') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1895 delfunction! TryThis |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1896 unlet! g:called_bufnum3 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1897 unlet! g:called_arg3 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1898 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1899 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1900 let s:caught_e937 = 0 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1901 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1902 func Tapi_Delete(bufnum, arg) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1903 try |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1904 execute 'bdelete!' a:bufnum |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1905 catch /E937:/ |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1906 let s:caught_e937 = 1 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1907 endtry |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1908 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1909 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1910 func Test_terminal_api_call_fail_delete() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1911 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1912 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1913 call WriteApiCall('Tapi_Delete') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1914 let buf = RunVimInTerminal('-S Xscript', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1915 call WaitForAssert({-> assert_equal(1, s:caught_e937)}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1916 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1917 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1918 call delete('Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1919 call ch_logfile('', '') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1920 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1921 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1922 func Test_terminal_setapi_and_call() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1923 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1924 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1925 call WriteApiCall('Tapi_TryThis') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1926 call ch_logfile('Xlog', 'w') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1927 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1928 unlet! g:called_bufnum |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1929 unlet! g:called_arg |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1930 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1931 let buf = RunVimInTerminal('-S Xscript', {'term_api': ''}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1932 call WaitForAssert({-> assert_match('Unpermitted function: Tapi_TryThis', string(readfile('Xlog')))}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1933 call assert_false(exists('g:called_bufnum')) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1934 call assert_false(exists('g:called_arg')) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1935 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1936 eval buf->term_setapi('Tapi_') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1937 call term_sendkeys(buf, ":set notitle\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1938 call term_sendkeys(buf, ":source Xscript\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1939 call WaitFor({-> exists('g:called_bufnum')}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1940 call assert_equal(buf, g:called_bufnum) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1941 call assert_equal(['hello', 123], g:called_arg) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1942 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1943 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1944 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1945 call delete('Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1946 call ch_logfile('') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1947 call delete('Xlog') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1948 unlet! g:called_bufnum |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1949 unlet! g:called_arg |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1950 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1951 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1952 func Test_terminal_api_arg() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1953 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1954 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1955 call WriteApiCall('Tapi_TryThis') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1956 call ch_logfile('Xlog', 'w') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1957 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1958 unlet! g:called_bufnum |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1959 unlet! g:called_arg |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1960 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1961 execute 'term ++api= ' .. GetVimCommandCleanTerm() .. '-S Xscript' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1962 let buf = bufnr('%') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1963 call WaitForAssert({-> assert_match('Unpermitted function: Tapi_TryThis', string(readfile('Xlog')))}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1964 call assert_false(exists('g:called_bufnum')) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1965 call assert_false(exists('g:called_arg')) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1966 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1967 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1968 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1969 call ch_logfile('Xlog', 'w') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1970 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1971 execute 'term ++api=Tapi_ ' .. GetVimCommandCleanTerm() .. '-S Xscript' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1972 let buf = bufnr('%') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1973 call WaitFor({-> exists('g:called_bufnum')}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1974 call assert_equal(buf, g:called_bufnum) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1975 call assert_equal(['hello', 123], g:called_arg) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1976 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1977 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1978 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1979 call delete('Xscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1980 call ch_logfile('') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1981 call delete('Xlog') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1982 unlet! g:called_bufnum |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1983 unlet! g:called_arg |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1984 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1985 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1986 func Test_terminal_ansicolors_default() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1987 CheckFunction term_getansicolors |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1988 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1989 let colors = [ |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1990 \ '#000000', '#e00000', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1991 \ '#00e000', '#e0e000', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1992 \ '#0000e0', '#e000e0', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1993 \ '#00e0e0', '#e0e0e0', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1994 \ '#808080', '#ff4040', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1995 \ '#40ff40', '#ffff40', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1996 \ '#4040ff', '#ff40ff', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1997 \ '#40ffff', '#ffffff', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1998 \] |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
1999 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2000 let buf = Run_shell_in_terminal({}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2001 call assert_equal(colors, term_getansicolors(buf)) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2002 call StopShellInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2003 call assert_equal([], term_getansicolors(buf)) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2004 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2005 exe buf . 'bwipe' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2006 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2007 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2008 let s:test_colors = [ |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2009 \ '#616e64', '#0d0a79', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2010 \ '#6d610d', '#0a7373', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2011 \ '#690d0a', '#6d696e', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2012 \ '#0d0a6f', '#616e0d', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2013 \ '#0a6479', '#6d0d0a', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2014 \ '#617373', '#0d0a69', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2015 \ '#6d690d', '#0a6e6f', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2016 \ '#610d0a', '#6e6479', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2017 \] |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2018 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2019 func Test_terminal_ansicolors_global() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2020 CheckFeature termguicolors |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2021 CheckFunction term_getansicolors |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2022 |
28919
99c1356f4210
patch 8.2.4982: colors in terminal window are not 100% correct
Bram Moolenaar <Bram@vim.org>
parents:
28259
diff
changeset
|
2023 if has('vtp') && !has('vcon') && !has('gui_running') |
99c1356f4210
patch 8.2.4982: colors in terminal window are not 100% correct
Bram Moolenaar <Bram@vim.org>
parents:
28259
diff
changeset
|
2024 throw 'Skipped: does not support termguicolors' |
99c1356f4210
patch 8.2.4982: colors in terminal window are not 100% correct
Bram Moolenaar <Bram@vim.org>
parents:
28259
diff
changeset
|
2025 endif |
99c1356f4210
patch 8.2.4982: colors in terminal window are not 100% correct
Bram Moolenaar <Bram@vim.org>
parents:
28259
diff
changeset
|
2026 |
99c1356f4210
patch 8.2.4982: colors in terminal window are not 100% correct
Bram Moolenaar <Bram@vim.org>
parents:
28259
diff
changeset
|
2027 set tgc |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2028 let g:terminal_ansi_colors = reverse(copy(s:test_colors)) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2029 let buf = Run_shell_in_terminal({}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2030 call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf)) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2031 call StopShellInTerminal(buf) |
28919
99c1356f4210
patch 8.2.4982: colors in terminal window are not 100% correct
Bram Moolenaar <Bram@vim.org>
parents:
28259
diff
changeset
|
2032 set tgc& |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2033 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2034 exe buf . 'bwipe' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2035 unlet g:terminal_ansi_colors |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2036 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2037 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2038 func Test_terminal_ansicolors_func() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2039 CheckFeature termguicolors |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2040 CheckFunction term_getansicolors |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2041 |
28919
99c1356f4210
patch 8.2.4982: colors in terminal window are not 100% correct
Bram Moolenaar <Bram@vim.org>
parents:
28259
diff
changeset
|
2042 if has('vtp') && !has('vcon') && !has('gui_running') |
99c1356f4210
patch 8.2.4982: colors in terminal window are not 100% correct
Bram Moolenaar <Bram@vim.org>
parents:
28259
diff
changeset
|
2043 throw 'Skipped: does not support termguicolors' |
99c1356f4210
patch 8.2.4982: colors in terminal window are not 100% correct
Bram Moolenaar <Bram@vim.org>
parents:
28259
diff
changeset
|
2044 endif |
99c1356f4210
patch 8.2.4982: colors in terminal window are not 100% correct
Bram Moolenaar <Bram@vim.org>
parents:
28259
diff
changeset
|
2045 |
99c1356f4210
patch 8.2.4982: colors in terminal window are not 100% correct
Bram Moolenaar <Bram@vim.org>
parents:
28259
diff
changeset
|
2046 set tgc |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2047 let g:terminal_ansi_colors = reverse(copy(s:test_colors)) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2048 let buf = Run_shell_in_terminal({'ansi_colors': s:test_colors}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2049 call assert_equal(s:test_colors, term_getansicolors(buf)) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2050 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2051 call term_setansicolors(buf, g:terminal_ansi_colors) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2052 call assert_equal(g:terminal_ansi_colors, buf->term_getansicolors()) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2053 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2054 let colors = [ |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2055 \ 'ivory', 'AliceBlue', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2056 \ 'grey67', 'dark goldenrod', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2057 \ 'SteelBlue3', 'PaleVioletRed4', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2058 \ 'MediumPurple2', 'yellow2', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2059 \ 'RosyBrown3', 'OrangeRed2', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2060 \ 'white smoke', 'navy blue', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2061 \ 'grey47', 'gray97', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2062 \ 'MistyRose2', 'DodgerBlue4', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2063 \] |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2064 eval buf->term_setansicolors(colors) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2065 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2066 let colors[4] = 'Invalid' |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21253
diff
changeset
|
2067 call assert_fails('call term_setansicolors(buf, colors)', 'E254:') |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2068 call assert_fails('call term_setansicolors(buf, {})', 'E714:') |
28919
99c1356f4210
patch 8.2.4982: colors in terminal window are not 100% correct
Bram Moolenaar <Bram@vim.org>
parents:
28259
diff
changeset
|
2069 set tgc& |
21253
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2070 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2071 call StopShellInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2072 call assert_equal(0, term_setansicolors(buf, [])) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2073 exe buf . 'bwipe' |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2074 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2075 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2076 func Test_terminal_all_ansi_colors() |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2077 CheckRunVimInTerminal |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2078 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2079 " Use all the ANSI colors. |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2080 call writefile([ |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2081 \ 'call setline(1, "AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPP XXYYZZ")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2082 \ 'hi Tblack ctermfg=0 ctermbg=8', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2083 \ 'hi Tdarkred ctermfg=1 ctermbg=9', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2084 \ 'hi Tdarkgreen ctermfg=2 ctermbg=10', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2085 \ 'hi Tbrown ctermfg=3 ctermbg=11', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2086 \ 'hi Tdarkblue ctermfg=4 ctermbg=12', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2087 \ 'hi Tdarkmagenta ctermfg=5 ctermbg=13', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2088 \ 'hi Tdarkcyan ctermfg=6 ctermbg=14', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2089 \ 'hi Tlightgrey ctermfg=7 ctermbg=15', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2090 \ 'hi Tdarkgrey ctermfg=8 ctermbg=0', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2091 \ 'hi Tred ctermfg=9 ctermbg=1', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2092 \ 'hi Tgreen ctermfg=10 ctermbg=2', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2093 \ 'hi Tyellow ctermfg=11 ctermbg=3', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2094 \ 'hi Tblue ctermfg=12 ctermbg=4', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2095 \ 'hi Tmagenta ctermfg=13 ctermbg=5', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2096 \ 'hi Tcyan ctermfg=14 ctermbg=6', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2097 \ 'hi Twhite ctermfg=15 ctermbg=7', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2098 \ 'hi TdarkredBold ctermfg=1 cterm=bold', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2099 \ 'hi TgreenBold ctermfg=10 cterm=bold', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2100 \ 'hi TmagentaBold ctermfg=13 cterm=bold ctermbg=5', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2101 \ '', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2102 \ 'call matchadd("Tblack", "A")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2103 \ 'call matchadd("Tdarkred", "B")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2104 \ 'call matchadd("Tdarkgreen", "C")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2105 \ 'call matchadd("Tbrown", "D")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2106 \ 'call matchadd("Tdarkblue", "E")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2107 \ 'call matchadd("Tdarkmagenta", "F")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2108 \ 'call matchadd("Tdarkcyan", "G")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2109 \ 'call matchadd("Tlightgrey", "H")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2110 \ 'call matchadd("Tdarkgrey", "I")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2111 \ 'call matchadd("Tred", "J")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2112 \ 'call matchadd("Tgreen", "K")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2113 \ 'call matchadd("Tyellow", "L")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2114 \ 'call matchadd("Tblue", "M")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2115 \ 'call matchadd("Tmagenta", "N")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2116 \ 'call matchadd("Tcyan", "O")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2117 \ 'call matchadd("Twhite", "P")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2118 \ 'call matchadd("TdarkredBold", "X")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2119 \ 'call matchadd("TgreenBold", "Y")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2120 \ 'call matchadd("TmagentaBold", "Z")', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2121 \ 'redraw', |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2122 \ ], 'Xcolorscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2123 let buf = RunVimInTerminal('-S Xcolorscript', {'rows': 10}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2124 call VerifyScreenDump(buf, 'Test_terminal_all_ansi_colors', {}) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2125 |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2126 call term_sendkeys(buf, ":q\<CR>") |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2127 call StopVimInTerminal(buf) |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2128 call delete('Xcolorscript') |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2129 endfunc |
ffa6b82fa993
patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
21126
diff
changeset
|
2130 |
24309
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2131 function On_BufFilePost() |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2132 doautocmd <nomodeline> User UserEvent |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2133 endfunction |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2134 |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2135 func Test_terminal_nested_autocmd() |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2136 new |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2137 call setline(1, range(500)) |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2138 $ |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2139 let lastline = line('.') |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2140 |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2141 augroup TermTest |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2142 autocmd BufFilePost * call On_BufFilePost() |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2143 autocmd User UserEvent silent |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2144 augroup END |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2145 |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2146 let cmd = Get_cat_123_cmd() |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2147 let buf = term_start(cmd, #{term_finish: 'close', hidden: 1}) |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2148 call assert_equal(lastline, line('.')) |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2149 |
24319
cc40b0d66646
patch 8.2.2700: nested autocmd test fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
24309
diff
changeset
|
2150 let job = term_getjob(buf) |
cc40b0d66646
patch 8.2.2700: nested autocmd test fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
24309
diff
changeset
|
2151 call WaitForAssert({-> assert_equal("dead", job_status(job))}) |
24309
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2152 call delete('Xtext') |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2153 augroup TermTest |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2154 au! |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2155 augroup END |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2156 endfunc |
f8619a303e9d
patch 8.2.2695: cursor position reset with nested autocommands
Bram Moolenaar <Bram@vim.org>
parents:
24212
diff
changeset
|
2157 |
24557
7a4cc4d3a40a
patch 8.2.2818: no jump added when opening terminal in current window
Bram Moolenaar <Bram@vim.org>
parents:
24319
diff
changeset
|
2158 func Test_terminal_adds_jump() |
7a4cc4d3a40a
patch 8.2.2818: no jump added when opening terminal in current window
Bram Moolenaar <Bram@vim.org>
parents:
24319
diff
changeset
|
2159 clearjumps |
7a4cc4d3a40a
patch 8.2.2818: no jump added when opening terminal in current window
Bram Moolenaar <Bram@vim.org>
parents:
24319
diff
changeset
|
2160 call term_start("ls", #{curwin: 1}) |
7a4cc4d3a40a
patch 8.2.2818: no jump added when opening terminal in current window
Bram Moolenaar <Bram@vim.org>
parents:
24319
diff
changeset
|
2161 call assert_equal(1, getjumplist()[0]->len()) |
7a4cc4d3a40a
patch 8.2.2818: no jump added when opening terminal in current window
Bram Moolenaar <Bram@vim.org>
parents:
24319
diff
changeset
|
2162 bwipe! |
7a4cc4d3a40a
patch 8.2.2818: no jump added when opening terminal in current window
Bram Moolenaar <Bram@vim.org>
parents:
24319
diff
changeset
|
2163 endfunc |
7a4cc4d3a40a
patch 8.2.2818: no jump added when opening terminal in current window
Bram Moolenaar <Bram@vim.org>
parents:
24319
diff
changeset
|
2164 |
26217
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2165 func Close_cb(ch, ctx) |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2166 call term_wait(a:ctx.bufnr) |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2167 let g:close_done = 'done' |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2168 endfunc |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2169 |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2170 func Test_term_wait_in_close_cb() |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2171 let g:close_done = '' |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2172 let ctx = {} |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2173 let ctx.bufnr = term_start('echo "HELLO WORLD"', |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2174 \ {'close_cb': {ch -> Close_cb(ch, ctx)}}) |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2175 |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2176 call WaitForAssert({-> assert_equal("done", g:close_done)}) |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2177 |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2178 unlet g:close_done |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2179 bwipe! |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2180 endfunc |
d25c0b0aad7d
patch 8.2.3640: freeze when calling term_wait() in a close callback
Bram Moolenaar <Bram@vim.org>
parents:
26185
diff
changeset
|
2181 |
20365
6bcd12791bf1
patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents:
20263
diff
changeset
|
2182 |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19840
diff
changeset
|
2183 " vim: shiftwidth=2 sts=2 expandtab |