Mercurial > vim
annotate src/testdir/test_startup.vim @ 33738:2172872dfbcd v9.0.2096
patch 9.0.2096: Vim9: confusing usage of private
Commit: https://github.com/vim/vim/commit/03042a2753e3e6ac971045a8ce256d709214710e
Author: Ernie Rael <errael@raelity.com>
Date: Sat Nov 11 08:53:32 2023 +0100
patch 9.0.2096: Vim9: confusing usage of private
Problem: Vim9: confusing usage of private
Solution: clarify and use protected keyword instead
[vim9class] document `_` as protected instead of private
fixes #13504
closes: #13520
Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 11 Nov 2023 09:00:06 +0100 |
parents | 8e6ccb8cf556 |
children | fdc8a179c79e |
rev | line source |
---|---|
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
1 " Tests for startup. |
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
2 |
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
3 source shared.vim |
16385
bb0f7cb7e2d5
patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents:
15926
diff
changeset
|
4 source screendump.vim |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
5 source term_util.vim |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
6 source check.vim |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
7 |
9678
8c9e13109df8
commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 " Check that loading startup.vim works. |
8c9e13109df8
commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 func Test_startup_script() |
8c9e13109df8
commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 set compatible |
8c9e13109df8
commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 source $VIMRUNTIME/defaults.vim |
8c9e13109df8
commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 |
8c9e13109df8
commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call assert_equal(0, &compatible) |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
14 " Restore some options, so that the following tests doesn't break |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
15 set nomore |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
16 set noshowmode |
9678
8c9e13109df8
commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 endfunc |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
18 |
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
19 " Verify the order in which plugins are loaded: |
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
20 " 1. plugins in non-after directories |
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
21 " 2. packages |
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
22 " 3. plugins in after directories |
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
23 func Test_after_comes_later() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21333
diff
changeset
|
24 CheckFeature packages |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
25 let before =<< trim [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
26 set nocp viminfo+=nviminfo |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
27 set guioptions+=M |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
28 let $HOME = "/does/not/exist" |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
29 set loadplugins |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
30 set rtp=Xhere,Xafter,Xanother |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
31 set packpath=Xhere,Xafter |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
32 set nomore |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
33 let g:sequence = "" |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
34 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
35 |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
36 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:
16590
diff
changeset
|
37 redir! > Xtestout |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
38 scriptnames |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
39 redir END |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
40 redir! > Xsequence |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
41 echo g:sequence |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
42 redir END |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
43 quit |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
44 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
45 |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
46 call mkdir('Xhere/plugin', 'pR') |
11595
42cd59477698
patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents:
11457
diff
changeset
|
47 call writefile(['let g:sequence .= "here "'], 'Xhere/plugin/here.vim') |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
48 call mkdir('Xanother/plugin', 'pR') |
11595
42cd59477698
patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents:
11457
diff
changeset
|
49 call writefile(['let g:sequence .= "another "'], 'Xanother/plugin/another.vim') |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
50 call mkdir('Xhere/pack/foo/start/foobar/plugin', 'p') |
11595
42cd59477698
patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents:
11457
diff
changeset
|
51 call writefile(['let g:sequence .= "pack "'], 'Xhere/pack/foo/start/foobar/plugin/foo.vim') |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
52 |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
53 call mkdir('Xafter/plugin', 'pR') |
11595
42cd59477698
patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents:
11457
diff
changeset
|
54 call writefile(['let g:sequence .= "after "'], 'Xafter/plugin/later.vim') |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
55 |
9794
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
56 if RunVim(before, after, '') |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
57 |
9780
103ad8a18ebc
commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents:
9778
diff
changeset
|
58 let lines = readfile('Xtestout') |
11595
42cd59477698
patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents:
11457
diff
changeset
|
59 let expected = ['Xbefore.vim', 'here.vim', 'another.vim', 'foo.vim', 'later.vim', 'Xafter.vim'] |
9780
103ad8a18ebc
commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents:
9778
diff
changeset
|
60 let found = [] |
103ad8a18ebc
commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents:
9778
diff
changeset
|
61 for line in lines |
103ad8a18ebc
commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents:
9778
diff
changeset
|
62 for one in expected |
103ad8a18ebc
commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents:
9778
diff
changeset
|
63 if line =~ one |
103ad8a18ebc
commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents:
9778
diff
changeset
|
64 call add(found, one) |
103ad8a18ebc
commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents:
9778
diff
changeset
|
65 endif |
103ad8a18ebc
commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents:
9778
diff
changeset
|
66 endfor |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
67 endfor |
9780
103ad8a18ebc
commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents:
9778
diff
changeset
|
68 call assert_equal(expected, found) |
103ad8a18ebc
commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents:
9778
diff
changeset
|
69 endif |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
70 |
11595
42cd59477698
patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents:
11457
diff
changeset
|
71 call assert_equal('here another pack after', substitute(join(readfile('Xsequence', 1), ''), '\s\+$', '', '')) |
42cd59477698
patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents:
11457
diff
changeset
|
72 |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
73 call delete('Xtestout') |
11595
42cd59477698
patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents:
11457
diff
changeset
|
74 call delete('Xsequence') |
9778
4360b2b46125
commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents:
9678
diff
changeset
|
75 endfunc |
9794
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
76 |
11457
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
77 func Test_pack_in_rtp_when_plugins_run() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21333
diff
changeset
|
78 CheckFeature packages |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
79 let before =<< trim [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
80 set nocp viminfo+=nviminfo |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
81 set guioptions+=M |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
82 let $HOME = "/does/not/exist" |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
83 set loadplugins |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
84 set rtp=Xhere |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
85 set packpath=Xhere |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
86 set nomore |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
87 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
88 |
11457
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
89 let after = [ |
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
90 \ 'quit', |
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
91 \ ] |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
92 call mkdir('Xhere/plugin', 'pR') |
11457
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
93 call writefile(['redir! > Xtestout', 'silent set runtimepath?', 'silent! call foo#Trigger()', 'redir END'], 'Xhere/plugin/here.vim') |
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
94 call mkdir('Xhere/pack/foo/start/foobar/autoload', 'p') |
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
95 call writefile(['function! foo#Trigger()', 'echo "autoloaded foo"', 'endfunction'], 'Xhere/pack/foo/start/foobar/autoload/foo.vim') |
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
96 |
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
97 if RunVim(before, after, '') |
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
98 |
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
99 let lines = filter(readfile('Xtestout'), '!empty(v:val)') |
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
100 call assert_match('Xhere[/\\]pack[/\\]foo[/\\]start[/\\]foobar', get(lines, 0)) |
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
101 call assert_match('autoloaded foo', get(lines, 1)) |
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
102 endif |
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
103 |
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
104 call delete('Xtestout') |
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
105 endfunc |
5a1656d79707
patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents:
11307
diff
changeset
|
106 |
9794
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
107 func Test_help_arg() |
24140
af489e854955
patch 8.2.2611: conditions for startup tests are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
24136
diff
changeset
|
108 " This does not work with a GUI-only binary, such as on MS-Windows. |
af489e854955
patch 8.2.2611: conditions for startup tests are not exactly right
Bram Moolenaar <Bram@vim.org>
parents:
24136
diff
changeset
|
109 CheckAnyOf Unix NotGui |
24126
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
110 |
9794
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
111 if RunVim([], [], '--help >Xtestout') |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
112 let lines = readfile('Xtestout') |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
113 call assert_true(len(lines) > 20) |
9804
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
114 call assert_match('Vi IMproved', lines[0]) |
9794
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
115 |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
116 " check if couple of lines are there |
9830
6049c1f01391
commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents:
9808
diff
changeset
|
117 let found = [] |
9794
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
118 for line in lines |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
119 if line =~ '-R.*Readonly mode' |
9830
6049c1f01391
commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents:
9808
diff
changeset
|
120 call add(found, 'Readonly mode') |
9794
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
121 endif |
9830
6049c1f01391
commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents:
9808
diff
changeset
|
122 " Watch out for a second --version line in the Gnome version. |
6049c1f01391
commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents:
9808
diff
changeset
|
123 if line =~ '--version.*Print version information and exit' |
6049c1f01391
commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents:
9808
diff
changeset
|
124 call add(found, "--version") |
9794
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
125 endif |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
126 endfor |
9830
6049c1f01391
commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents:
9808
diff
changeset
|
127 call assert_equal(['Readonly mode', '--version'], found) |
9794
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
128 endif |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
129 call delete('Xtestout') |
fd32f719d34f
commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents:
9788
diff
changeset
|
130 endfunc |
9804
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
131 |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
132 func Test_compatible_args() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
133 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:
16590
diff
changeset
|
134 call writefile([string(&compatible)], "Xtestout") |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
135 set viminfo+=nviminfo |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
136 quit |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
137 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
138 |
9804
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
139 if RunVim([], after, '-C') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
140 let lines = readfile('Xtestout') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
141 call assert_equal('1', lines[0]) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
142 endif |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
143 |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
144 if RunVim([], after, '-N') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
145 let lines = readfile('Xtestout') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
146 call assert_equal('0', lines[0]) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
147 endif |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
148 |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
149 call delete('Xtestout') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
150 endfunc |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
151 |
14772
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
152 " Test the -o[N] and -O[N] arguments to open N windows split |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
153 " horizontally or vertically. |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
154 func Test_o_arg() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
155 let after =<< trim [CODE] |
17178
40c4cb095d53
patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
156 set cpo&vim |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
157 call writefile([winnr("$"), |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
158 \ winheight(1), winheight(2), &lines, |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
159 \ winwidth(1), winwidth(2), &columns, |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
160 \ bufname(winbufnr(1)), bufname(winbufnr(2))], |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
161 \ "Xtestout") |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
162 qall |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
163 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
164 |
14772
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
165 if RunVim([], after, '-o2') |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
166 " Open 2 windows split horizontally. Expect: |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
167 " - 2 windows |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
168 " - both windows should have the same or almost the same height |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
169 " - sum of both windows height (+ 3 for both statusline and Ex command) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
170 " should be equal to the number of lines |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
171 " - both windows should have the same width which should be equal to the |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
172 " number of columns |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
173 " - buffer of both windows should have no name |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
174 let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout') |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
175 call assert_equal('2', wn) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
176 call assert_inrange(0, 1, wh1 - wh2) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
177 call assert_equal(string(wh1 + wh2 + 3), ln) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
178 call assert_equal(ww1, ww2) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
179 call assert_equal(ww1, cn) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
180 call assert_equal('', bn1) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
181 call assert_equal('', bn2) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
182 endif |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
183 |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
184 if RunVim([], after, '-o foo bar') |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
185 " Same expectations as for -o2 but buffer names should be foo and bar |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
186 let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout') |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
187 call assert_equal('2', wn) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
188 call assert_inrange(0, 1, wh1 - wh2) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
189 call assert_equal(string(wh1 + wh2 + 3), ln) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
190 call assert_equal(ww1, ww2) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
191 call assert_equal(ww1, cn) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
192 call assert_equal('foo', bn1) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
193 call assert_equal('bar', bn2) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
194 endif |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
195 |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
196 if RunVim([], after, '-O2') |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
197 " Open 2 windows split vertically. Expect: |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
198 " - 2 windows |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
199 " - both windows should have the same or almost the same width |
14810
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
200 " - sum of both windows width (+ 1 for the separator) should be equal to |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
201 " the number of columns |
14772
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
202 " - both windows should have the same height |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
203 " - window height (+ 2 for the statusline and Ex command) should be equal |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
204 " to the number of lines |
14788
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
205 " - buffer of both windows should have no name |
14772
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
206 let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout') |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
207 call assert_equal('2', wn) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
208 call assert_inrange(0, 1, ww1 - ww2) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
209 call assert_equal(string(ww1 + ww2 + 1), cn) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
210 call assert_equal(wh1, wh2) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
211 call assert_equal(string(wh1 + 2), ln) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
212 call assert_equal('', bn1) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
213 call assert_equal('', bn2) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
214 endif |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
215 |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
216 if RunVim([], after, '-O foo bar') |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
217 " Same expectations as for -O2 but buffer names should be foo and bar |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
218 let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout') |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
219 call assert_equal('2', wn) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
220 call assert_inrange(0, 1, ww1 - ww2) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
221 call assert_equal(string(ww1 + ww2 + 1), cn) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
222 call assert_equal(wh1, wh2) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
223 call assert_equal(string(wh1 + 2), ln) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
224 call assert_equal('foo', bn1) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
225 call assert_equal('bar', bn2) |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
226 endif |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
227 call delete('Xtestout') |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
228 endfunc |
66e241c3a2f0
patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents:
13162
diff
changeset
|
229 |
14788
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
230 " Test the -p[N] argument to open N tabpages. |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
231 func Test_p_arg() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
232 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:
16590
diff
changeset
|
233 call writefile(split(execute("tabs"), "\n"), "Xtestout") |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
234 qall |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
235 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
236 |
14788
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
237 if RunVim([], after, '-p2') |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
238 let lines = readfile('Xtestout') |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
239 call assert_equal(4, len(lines)) |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
240 call assert_equal('Tab page 1', lines[0]) |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
241 call assert_equal('> [No Name]', lines[1]) |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
242 call assert_equal('Tab page 2', lines[2]) |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
243 call assert_equal(' [No Name]', lines[3]) |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
244 endif |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
245 |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
246 if RunVim([], after, '-p foo bar') |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
247 let lines = readfile('Xtestout') |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
248 call assert_equal(4, len(lines)) |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
249 call assert_equal('Tab page 1', lines[0]) |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
250 call assert_equal('> foo', lines[1]) |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
251 call assert_equal('Tab page 2', lines[2]) |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
252 call assert_equal(' bar', lines[3]) |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
253 endif |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
254 |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
255 call delete('Xtestout') |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
256 endfunc |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
257 |
14794
9be43810b5ec
patch 8.1.0409: startup test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
14788
diff
changeset
|
258 " Test the -V[N] argument to set the 'verbose' option to [N] |
14788
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
259 func Test_V_arg() |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
260 " Can't catch the output of gvim. |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
261 CheckNotGui |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
262 |
14788
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
263 let out = system(GetVimCommand() . ' --clean -es -X -V0 -c "set verbose?" -cq') |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
264 call assert_equal(" verbose=0\n", out) |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
265 |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
266 let out = system(GetVimCommand() . ' --clean -es -X -V2 -c "set verbose?" -cq') |
20273
6209800492fc
patch 8.2.0692: startup test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
20271
diff
changeset
|
267 call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nline \\d\\+: sourcing \"[^\"]*runtime[\\/]filetype\.vim\".*\n", out) |
14794
9be43810b5ec
patch 8.1.0409: startup test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
14788
diff
changeset
|
268 call assert_match(" verbose=2\n", out) |
14788
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
269 |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
270 let out = system(GetVimCommand() . ' --clean -es -X -V15 -c "set verbose?" -cq') |
14794
9be43810b5ec
patch 8.1.0409: startup test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
14788
diff
changeset
|
271 call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nline 1: \" The default vimrc file\..* verbose=15\n", out) |
14788
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
272 endfunc |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
273 |
24733
08eced3add83
patch 8.2.2905: no error when defaults.vim cannot be loaded
Bram Moolenaar <Bram@vim.org>
parents:
24620
diff
changeset
|
274 " Test that an error is shown when the defaults.vim file could not be read |
24778
9b5374b80b02
patch 8.2.2927: test commented out because it fails with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
24735
diff
changeset
|
275 func Test_defaults_error() |
9b5374b80b02
patch 8.2.2927: test commented out because it fails with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
24735
diff
changeset
|
276 " Can't catch the output of gvim. |
9b5374b80b02
patch 8.2.2927: test commented out because it fails with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
24735
diff
changeset
|
277 CheckNotGui |
9b5374b80b02
patch 8.2.2927: test commented out because it fails with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
24735
diff
changeset
|
278 CheckNotMSWindows |
9b5374b80b02
patch 8.2.2927: test commented out because it fails with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
24735
diff
changeset
|
279 " For unknown reasons freeing all memory does not work here, even though |
9b5374b80b02
patch 8.2.2927: test commented out because it fails with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
24735
diff
changeset
|
280 " EXITFREE is defined. |
9b5374b80b02
patch 8.2.2927: test commented out because it fails with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
24735
diff
changeset
|
281 CheckNotAsan |
9b5374b80b02
patch 8.2.2927: test commented out because it fails with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
24735
diff
changeset
|
282 |
9b5374b80b02
patch 8.2.2927: test commented out because it fails with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
24735
diff
changeset
|
283 let out = system('VIMRUNTIME=/tmp ' .. GetVimCommand() .. ' --clean -cq') |
9b5374b80b02
patch 8.2.2927: test commented out because it fails with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
24735
diff
changeset
|
284 call assert_match("E1187: Failed to source defaults.vim", out) |
9b5374b80b02
patch 8.2.2927: test commented out because it fails with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
24735
diff
changeset
|
285 |
9b5374b80b02
patch 8.2.2927: test commented out because it fails with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
24735
diff
changeset
|
286 let out = system('VIMRUNTIME=/tmp ' .. GetVimCommand() .. ' -u DEFAULTS -cq') |
9b5374b80b02
patch 8.2.2927: test commented out because it fails with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
24735
diff
changeset
|
287 call assert_match("E1187: Failed to source defaults.vim", out) |
9b5374b80b02
patch 8.2.2927: test commented out because it fails with ASAN
Bram Moolenaar <Bram@vim.org>
parents:
24735
diff
changeset
|
288 endfunc |
24733
08eced3add83
patch 8.2.2905: no error when defaults.vim cannot be loaded
Bram Moolenaar <Bram@vim.org>
parents:
24620
diff
changeset
|
289 |
15284
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
290 " Test the '-q [errorfile]' argument. |
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
291 func Test_q_arg() |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18477
diff
changeset
|
292 CheckFeature quickfix |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18477
diff
changeset
|
293 |
21333
c44867526ad5
patch 8.2.1217: startup test depends on random source file
Bram Moolenaar <Bram@vim.org>
parents:
21331
diff
changeset
|
294 let lines =<< trim END |
c44867526ad5
patch 8.2.1217: startup test depends on random source file
Bram Moolenaar <Bram@vim.org>
parents:
21331
diff
changeset
|
295 /* some file with an error */ |
c44867526ad5
patch 8.2.1217: startup test depends on random source file
Bram Moolenaar <Bram@vim.org>
parents:
21331
diff
changeset
|
296 main() { |
c44867526ad5
patch 8.2.1217: startup test depends on random source file
Bram Moolenaar <Bram@vim.org>
parents:
21331
diff
changeset
|
297 functionCall(arg; arg, arg); |
c44867526ad5
patch 8.2.1217: startup test depends on random source file
Bram Moolenaar <Bram@vim.org>
parents:
21331
diff
changeset
|
298 return 666 |
c44867526ad5
patch 8.2.1217: startup test depends on random source file
Bram Moolenaar <Bram@vim.org>
parents:
21331
diff
changeset
|
299 } |
c44867526ad5
patch 8.2.1217: startup test depends on random source file
Bram Moolenaar <Bram@vim.org>
parents:
21331
diff
changeset
|
300 END |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
301 call writefile(lines, 'Xbadfile.c', 'D') |
21333
c44867526ad5
patch 8.2.1217: startup test depends on random source file
Bram Moolenaar <Bram@vim.org>
parents:
21331
diff
changeset
|
302 |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
303 let after =<< trim [CODE] |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
304 call writefile([&errorfile, string(getpos("."))], "XtestoutQarg") |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
305 copen |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
306 w >> XtestoutQarg |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
307 qall |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
308 [CODE] |
15284
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
309 |
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
310 " Test with default argument '-q'. |
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
311 call assert_equal('errors.err', &errorfile) |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
312 call writefile(["Xbadfile.c:4:12: error: expected ';' before '}' token"], 'errors.err', 'D') |
15284
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
313 if RunVim([], after, '-q') |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
314 let lines = readfile('XtestoutQarg') |
15284
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
315 call assert_equal(['errors.err', |
21333
c44867526ad5
patch 8.2.1217: startup test depends on random source file
Bram Moolenaar <Bram@vim.org>
parents:
21331
diff
changeset
|
316 \ '[0, 4, 12, 0]', |
c44867526ad5
patch 8.2.1217: startup test depends on random source file
Bram Moolenaar <Bram@vim.org>
parents:
21331
diff
changeset
|
317 \ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"], |
15284
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
318 \ lines) |
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
319 endif |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
320 call delete('XtestoutQarg') |
15284
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
321 |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
322 " Test with explicit argument '-q XerrorsQarg' (with space). |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
323 call writefile(["Xbadfile.c:4:12: error: expected ';' before '}' token"], 'XerrorsQarg', 'D') |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
324 if RunVim([], after, '-q XerrorsQarg') |
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
325 let lines = readfile('XtestoutQarg') |
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
326 call assert_equal(['XerrorsQarg', |
21333
c44867526ad5
patch 8.2.1217: startup test depends on random source file
Bram Moolenaar <Bram@vim.org>
parents:
21331
diff
changeset
|
327 \ '[0, 4, 12, 0]', |
c44867526ad5
patch 8.2.1217: startup test depends on random source file
Bram Moolenaar <Bram@vim.org>
parents:
21331
diff
changeset
|
328 \ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"], |
15284
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
329 \ lines) |
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
330 endif |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
331 call delete('XtestoutQarg') |
15284
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
332 |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
333 " Test with explicit argument '-qXerrorsQarg' (without space). |
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
334 if RunVim([], after, '-qXerrorsQarg') |
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
335 let lines = readfile('XtestoutQarg') |
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
336 call assert_equal(['XerrorsQarg', |
21333
c44867526ad5
patch 8.2.1217: startup test depends on random source file
Bram Moolenaar <Bram@vim.org>
parents:
21331
diff
changeset
|
337 \ '[0, 4, 12, 0]', |
c44867526ad5
patch 8.2.1217: startup test depends on random source file
Bram Moolenaar <Bram@vim.org>
parents:
21331
diff
changeset
|
338 \ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"], |
15284
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
339 \ lines) |
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
340 endif |
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
341 |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
342 " Test with a non-existing error file (exits with value 3) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
343 let out = system(GetVimCommand() .. ' -q xyz.err') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
344 call assert_equal(3, v:shell_error) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
345 |
30184
dc238f2c7355
patch 9.0.0428: autocmd test uses common file name
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
346 call delete('XtestoutQarg') |
15284
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
347 endfunc |
c31e4b1fa4fd
patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents:
14828
diff
changeset
|
348 |
14810
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
349 " Test the -V[N]{filename} argument to set the 'verbose' option to N |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
350 " and set 'verbosefile' to filename. |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
351 func Test_V_file_arg() |
14828
421e120ffb30
patch 8.1.0426: accessing invalid memory in SmcOpenConnection()
Christian Brabandt <cb@256bit.org>
parents:
14810
diff
changeset
|
352 if RunVim([], [], ' --clean -V2Xverbosefile -c "set verbose? verbosefile?" -cq') |
14810
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
353 let out = join(readfile('Xverbosefile'), "\n") |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
354 call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\n", out) |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
355 call assert_match("\n verbose=2\n", out) |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
356 call assert_match("\n verbosefile=Xverbosefile", out) |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
357 endif |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
358 |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
359 call delete('Xverbosefile') |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
360 endfunc |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
361 |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
362 " Test the -m, -M and -R arguments: |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
363 " -m resets 'write' |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
364 " -M resets 'modifiable' and 'write' |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
365 " -R sets 'readonly' |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
366 func Test_m_M_R() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
367 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:
16590
diff
changeset
|
368 call writefile([&write, &modifiable, &readonly, &updatecount], "Xtestout") |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
369 qall |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
370 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
371 |
14810
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
372 if RunVim([], after, '') |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
373 let lines = readfile('Xtestout') |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
374 call assert_equal(['1', '1', '0', '200'], lines) |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
375 endif |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
376 if RunVim([], after, '-m') |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
377 let lines = readfile('Xtestout') |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
378 call assert_equal(['0', '1', '0', '200'], lines) |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
379 endif |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
380 if RunVim([], after, '-M') |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
381 let lines = readfile('Xtestout') |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
382 call assert_equal(['0', '0', '0', '200'], lines) |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
383 endif |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
384 if RunVim([], after, '-R') |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
385 let lines = readfile('Xtestout') |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
386 call assert_equal(['1', '1', '1', '10000'], lines) |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
387 endif |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
388 |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
389 call delete('Xtestout') |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
390 endfunc |
d47c8d294d1a
patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14794
diff
changeset
|
391 |
32068
a87a50f84f96
patch 9.0.1365: dead test code
Bram Moolenaar <Bram@vim.org>
parents:
30791
diff
changeset
|
392 " Test the -A and -H arguments (Arabic and Hebrew modes). |
a87a50f84f96
patch 9.0.1365: dead test code
Bram Moolenaar <Bram@vim.org>
parents:
30791
diff
changeset
|
393 func Test_A_H_arg() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
394 let after =<< trim [CODE] |
30791
574bf5c78a40
patch 9.0.0730: startup test fails with right-left feature
Bram Moolenaar <Bram@vim.org>
parents:
30769
diff
changeset
|
395 call writefile([&rightleft, &arabic, &fkmap, &hkmap], "Xtestout") |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
396 qall |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
397 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
398 |
14794
9be43810b5ec
patch 8.1.0409: startup test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
14788
diff
changeset
|
399 " Use silent Ex mode to avoid the hit-Enter prompt for the warning that |
9be43810b5ec
patch 8.1.0409: startup test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
14788
diff
changeset
|
400 " 'encoding' is not utf-8. |
9be43810b5ec
patch 8.1.0409: startup test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
14788
diff
changeset
|
401 if has('arabic') && &encoding == 'utf-8' && RunVim([], after, '-e -s -A') |
14788
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
402 let lines = readfile('Xtestout') |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
403 call assert_equal(['1', '1', '0', '0'], lines) |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
404 endif |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
405 |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
406 if has('rightleft') && RunVim([], after, '-H') |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
407 let lines = readfile('Xtestout') |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
408 call assert_equal(['1', '0', '0', '1'], lines) |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
409 endif |
30791
574bf5c78a40
patch 9.0.0730: startup test fails with right-left feature
Bram Moolenaar <Bram@vim.org>
parents:
30769
diff
changeset
|
410 |
574bf5c78a40
patch 9.0.0730: startup test fails with right-left feature
Bram Moolenaar <Bram@vim.org>
parents:
30769
diff
changeset
|
411 call delete('Xtestout') |
14788
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
412 endfunc |
0aff6e5f3d55
patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents:
14772
diff
changeset
|
413 |
24126
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
414 " Test the --echo-wid argument (for GTK GUI only). |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
415 func Test_echo_wid() |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
416 CheckCanRunGui |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
417 CheckFeature gui_gtk |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
418 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
419 if RunVim([], [], '-g --echo-wid -cq >Xtest_echo_wid') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
420 let lines = readfile('Xtest_echo_wid') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
421 call assert_equal(1, len(lines)) |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
422 call assert_match('^WID: \d\+$', lines[0]) |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
423 endif |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
424 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
425 call delete('Xtest_echo_wid') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
426 endfunction |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
427 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
428 " Test the -reverse and +reverse arguments (for GUI only). |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
429 func Test_reverse() |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
430 CheckCanRunGui |
28303
9849df834f1d
patch 8.2.4677: the Athena GUI support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
27004
diff
changeset
|
431 CheckAnyOf Feature:gui_gtk Feature:gui_motif |
24126
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
432 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
433 let after =<< trim [CODE] |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
434 call writefile([&background], "Xtest_reverse") |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
435 qall |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
436 [CODE] |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
437 if RunVim([], after, '-f -g -reverse') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
438 let lines = readfile('Xtest_reverse') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
439 call assert_equal(['dark'], lines) |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
440 endif |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
441 if RunVim([], after, '-f -g +reverse') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
442 let lines = readfile('Xtest_reverse') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
443 call assert_equal(['light'], lines) |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
444 endif |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
445 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
446 call delete('Xtest_reverse') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
447 endfunc |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
448 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
449 " Test the -background and -foreground arguments (for GUI only). |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
450 func Test_background_foreground() |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
451 CheckCanRunGui |
28303
9849df834f1d
patch 8.2.4677: the Athena GUI support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
27004
diff
changeset
|
452 CheckAnyOf Feature:gui_gtk Feature:gui_motif |
24126
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
453 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
454 " Is there a better way to check the effect of -background & -foreground |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
455 " other than merely looking at &background (dark or light)? |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
456 let after =<< trim [CODE] |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
457 call writefile([&background], "Xtest_fg_bg") |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
458 qall |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
459 [CODE] |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
460 if RunVim([], after, '-f -g -background darkred -foreground yellow') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
461 let lines = readfile('Xtest_fg_bg') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
462 call assert_equal(['dark'], lines) |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
463 endif |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
464 if RunVim([], after, '-f -g -background ivory -foreground darkgreen') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
465 let lines = readfile('Xtest_fg_bg') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
466 call assert_equal(['light'], lines) |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
467 endif |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
468 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
469 call delete('Xtest_fg_bg') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
470 endfunc |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
471 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
472 " Test the -font argument (for GUI only). |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
473 func Test_font() |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
474 CheckCanRunGui |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
475 CheckNotMSWindows |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
476 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
477 if has('gui_gtk') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
478 let font = 'Courier 14' |
28303
9849df834f1d
patch 8.2.4677: the Athena GUI support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
27004
diff
changeset
|
479 elseif has('gui_motif') |
24126
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
480 let font = '-misc-fixed-bold-*' |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
481 else |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
482 throw 'Skipped: test does not set a valid font for this GUI' |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
483 endif |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
484 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
485 let after =<< trim [CODE] |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
486 call writefile([&guifont], "Xtest_font") |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
487 qall |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
488 [CODE] |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
489 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
490 if RunVim([], after, '--nofork -g -font "' .. font .. '"') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
491 let lines = readfile('Xtest_font') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
492 call assert_equal([font], lines) |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
493 endif |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
494 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
495 call delete('Xtest_font') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
496 endfunc |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
497 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
498 " Test the -geometry argument (for GUI only). |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
499 func Test_geometry() |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
500 CheckCanRunGui |
28303
9849df834f1d
patch 8.2.4677: the Athena GUI support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
27004
diff
changeset
|
501 CheckAnyOf Feature:gui_gtk Feature:gui_motif |
24126
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
502 |
28303
9849df834f1d
patch 8.2.4677: the Athena GUI support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
27004
diff
changeset
|
503 if has('gui_motif') |
9849df834f1d
patch 8.2.4677: the Athena GUI support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
27004
diff
changeset
|
504 " FIXME: With GUI Motif the value of getwinposx(), |
24126
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
505 " getwinposy() and getwinpos() do not match exactly the |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
506 " value given in -geometry. Why? |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
507 " So only check &columns and &lines for those GUIs. |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
508 let after =<< trim [CODE] |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
509 call writefile([&columns, &lines], "Xtest_geometry") |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
510 qall |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
511 [CODE] |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
512 if RunVim([], after, '-f -g -geometry 31x13+41+43') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
513 let lines = readfile('Xtest_geometry') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
514 call assert_equal(['31', '13'], lines) |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
515 endif |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
516 else |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
517 let after =<< trim [CODE] |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
518 call writefile([&columns, &lines, getwinposx(), getwinposy(), string(getwinpos())], "Xtest_geometry") |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
519 qall |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
520 [CODE] |
29247
5f314b2ed494
patch 8.2.5142: startup test fails if there is a status bar
Bram Moolenaar <Bram@vim.org>
parents:
28435
diff
changeset
|
521 " Some window managers have a bar at the top that pushes windows down, |
5f314b2ed494
patch 8.2.5142: startup test fails if there is a status bar
Bram Moolenaar <Bram@vim.org>
parents:
28435
diff
changeset
|
522 " need to use at least 130, let's do 150 |
5f314b2ed494
patch 8.2.5142: startup test fails if there is a status bar
Bram Moolenaar <Bram@vim.org>
parents:
28435
diff
changeset
|
523 if RunVim([], after, '-f -g -geometry 31x13+41+150') |
24126
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
524 let lines = readfile('Xtest_geometry') |
25923
70d1339c0fa0
patch 8.2.3495: GUI geometry startup test fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
25887
diff
changeset
|
525 " Depending on the GUI library and the windowing system the final size |
70d1339c0fa0
patch 8.2.3495: GUI geometry startup test fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
25887
diff
changeset
|
526 " might be a bit different, allow for some tolerance. Tuned based on |
70d1339c0fa0
patch 8.2.3495: GUI geometry startup test fails on some systems
Bram Moolenaar <Bram@vim.org>
parents:
25887
diff
changeset
|
527 " actual failures. |
25931
a12337b82da0
patch 8.2.3499: GUI geometry startup test fails
Bram Moolenaar <Bram@vim.org>
parents:
25923
diff
changeset
|
528 call assert_inrange(31, 35, str2nr(lines[0])) |
a12337b82da0
patch 8.2.3499: GUI geometry startup test fails
Bram Moolenaar <Bram@vim.org>
parents:
25923
diff
changeset
|
529 call assert_equal('13', lines[1]) |
a12337b82da0
patch 8.2.3499: GUI geometry startup test fails
Bram Moolenaar <Bram@vim.org>
parents:
25923
diff
changeset
|
530 call assert_equal('41', lines[2]) |
29247
5f314b2ed494
patch 8.2.5142: startup test fails if there is a status bar
Bram Moolenaar <Bram@vim.org>
parents:
28435
diff
changeset
|
531 call assert_equal('150', lines[3]) |
5f314b2ed494
patch 8.2.5142: startup test fails if there is a status bar
Bram Moolenaar <Bram@vim.org>
parents:
28435
diff
changeset
|
532 call assert_equal('[41, 150]', lines[4]) |
24126
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
533 endif |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
534 endif |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
535 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
536 call delete('Xtest_geometry') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
537 endfunc |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
538 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
539 " Test the -iconic argument (for GUI only). |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
540 func Test_iconic() |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
541 CheckCanRunGui |
28303
9849df834f1d
patch 8.2.4677: the Athena GUI support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
27004
diff
changeset
|
542 CheckAnyOf Feature:gui_gtk Feature:gui_motif |
24126
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
543 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
544 call RunVim([], [], '-f -g -iconic -cq') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
545 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
546 " TODO: currently only start vim iconified, but does not |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
547 " check that vim is iconified. How could this be checked? |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
548 endfunc |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
549 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
550 |
16578
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
551 func Test_invalid_args() |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
552 " must be able to get the output of Vim. |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
553 CheckUnix |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
554 CheckNotGui |
16578
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
555 |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
556 for opt in ['-Y', '--does-not-exist'] |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
557 let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
558 call assert_equal(1, v:shell_error) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
559 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
560 call assert_equal('Unknown option argument: "' .. opt .. '"', out[1]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
561 call assert_equal('More info with: "vim -h"', out[2]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
562 endfor |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
563 |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
564 for opt in ['-c', '-i', '-s', '-t', '-T', '-u', '-U', '-w', '-W', '--cmd', '--startuptime'] |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
565 let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
566 call assert_equal(1, v:shell_error) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
567 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
568 call assert_equal('Argument missing after: "' .. opt .. '"', out[1]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
569 call assert_equal('More info with: "vim -h"', out[2]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
570 endfor |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
571 |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
572 if has('clientserver') |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
573 for opt in ['--remote', '--remote-send', '--remote-silent', '--remote-expr', |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
574 \ '--remote-tab', '--remote-tab-wait', |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
575 \ '--remote-tab-wait-silent', '--remote-tab-silent', |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
576 \ '--remote-wait', '--remote-wait-silent', |
16586
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
577 \ '--servername', |
16578
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
578 \ ] |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
579 let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
580 call assert_equal(1, v:shell_error) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
581 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
582 call assert_equal('Argument missing after: "' .. opt .. '"', out[1]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
583 call assert_equal('More info with: "vim -h"', out[2]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
584 endfor |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
585 endif |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
586 |
16588
c56fe1427025
patch 8.1.1297: invalid argument test fails without GTK
Bram Moolenaar <Bram@vim.org>
parents:
16586
diff
changeset
|
587 if has('gui_gtk') |
16586
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
588 let out = split(system(GetVimCommand() .. ' --display'), "\n") |
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
589 call assert_equal(1, v:shell_error) |
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
590 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) |
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
591 call assert_equal('Argument missing after: "--display"', out[1]) |
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
592 call assert_equal('More info with: "vim -h"', out[2]) |
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
593 endif |
16578
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
594 |
16590
5c212dd3cd64
patch 8.1.1298: invalid argument test fails without X clipboard
Bram Moolenaar <Bram@vim.org>
parents:
16588
diff
changeset
|
595 if has('xterm_clipboard') |
16588
c56fe1427025
patch 8.1.1297: invalid argument test fails without GTK
Bram Moolenaar <Bram@vim.org>
parents:
16586
diff
changeset
|
596 let out = split(system(GetVimCommand() .. ' -display'), "\n") |
c56fe1427025
patch 8.1.1297: invalid argument test fails without GTK
Bram Moolenaar <Bram@vim.org>
parents:
16586
diff
changeset
|
597 call assert_equal(1, v:shell_error) |
c56fe1427025
patch 8.1.1297: invalid argument test fails without GTK
Bram Moolenaar <Bram@vim.org>
parents:
16586
diff
changeset
|
598 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) |
c56fe1427025
patch 8.1.1297: invalid argument test fails without GTK
Bram Moolenaar <Bram@vim.org>
parents:
16586
diff
changeset
|
599 call assert_equal('Argument missing after: "-display"', out[1]) |
c56fe1427025
patch 8.1.1297: invalid argument test fails without GTK
Bram Moolenaar <Bram@vim.org>
parents:
16586
diff
changeset
|
600 call assert_equal('More info with: "vim -h"', out[2]) |
c56fe1427025
patch 8.1.1297: invalid argument test fails without GTK
Bram Moolenaar <Bram@vim.org>
parents:
16586
diff
changeset
|
601 endif |
c56fe1427025
patch 8.1.1297: invalid argument test fails without GTK
Bram Moolenaar <Bram@vim.org>
parents:
16586
diff
changeset
|
602 |
16578
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
603 let out = split(system(GetVimCommand() .. ' -ix'), "\n") |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
604 call assert_equal(1, v:shell_error) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
605 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
606 call assert_equal('Garbage after option argument: "-ix"', out[1]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
607 call assert_equal('More info with: "vim -h"', out[2]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
608 |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
609 let out = split(system(GetVimCommand() .. ' - xxx'), "\n") |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
610 call assert_equal(1, v:shell_error) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
611 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
612 call assert_equal('Too many edit arguments: "xxx"', out[1]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
613 call assert_equal('More info with: "vim -h"', out[2]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
614 |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18477
diff
changeset
|
615 if has('quickfix') |
25771
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
25066
diff
changeset
|
616 " Detect invalid repeated arguments '-t foo -t foo', '-q foo -q foo'. |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18477
diff
changeset
|
617 for opt in ['-t', '-q'] |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18477
diff
changeset
|
618 let out = split(system(GetVimCommand() .. repeat(' ' .. opt .. ' foo', 2)), "\n") |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18477
diff
changeset
|
619 call assert_equal(1, v:shell_error) |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18477
diff
changeset
|
620 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18477
diff
changeset
|
621 call assert_equal('Too many edit arguments: "' .. opt .. '"', out[1]) |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18477
diff
changeset
|
622 call assert_equal('More info with: "vim -h"', out[2]) |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18477
diff
changeset
|
623 endfor |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18477
diff
changeset
|
624 endif |
16578
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
625 |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
626 for opt in [' -cq', ' --cmd q', ' +', ' -S foo'] |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
627 let out = split(system(GetVimCommand() .. repeat(opt, 11)), "\n") |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
628 call assert_equal(1, v:shell_error) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
629 " FIXME: The error message given by Vim is not ideal in case of repeated |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
630 " -S foo since it does not mention -S. |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
631 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
632 call assert_equal('Too many "+command", "-c command" or "--cmd command" arguments', out[1]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
633 call assert_equal('More info with: "vim -h"', out[2]) |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
634 endfor |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
635 |
16586
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
636 if has('gui_gtk') |
24596
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24242
diff
changeset
|
637 let out = split(system(GetVimCommand() .. ' --socketid'), "\n") |
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24242
diff
changeset
|
638 call assert_equal(1, v:shell_error) |
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24242
diff
changeset
|
639 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) |
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24242
diff
changeset
|
640 call assert_equal('Argument missing after: "--socketid"', out[1]) |
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24242
diff
changeset
|
641 call assert_equal('More info with: "vim -h"', out[2]) |
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24242
diff
changeset
|
642 |
16586
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
643 for opt in ['--socketid x', '--socketid 0xg'] |
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
644 let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") |
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
645 call assert_equal(1, v:shell_error) |
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
646 call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) |
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
647 call assert_equal('Invalid argument for: "--socketid"', out[1]) |
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
648 call assert_equal('More info with: "vim -h"', out[2]) |
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
649 endfor |
24596
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24242
diff
changeset
|
650 |
16586
5ebb2c87d1f5
patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents:
16578
diff
changeset
|
651 endif |
16578
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
652 endfunc |
5726af4931e3
patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
16385
diff
changeset
|
653 |
9804
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
654 func Test_file_args() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
655 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:
16590
diff
changeset
|
656 call writefile(argv(), "Xtestout") |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
657 qall |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
658 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
659 |
9804
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
660 if RunVim([], after, '') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
661 let lines = readfile('Xtestout') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
662 call assert_equal(0, len(lines)) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
663 endif |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
664 |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
665 if RunVim([], after, 'one') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
666 let lines = readfile('Xtestout') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
667 call assert_equal(1, len(lines)) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
668 call assert_equal('one', lines[0]) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
669 endif |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
670 |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
671 if RunVim([], after, 'one two three') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
672 let lines = readfile('Xtestout') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
673 call assert_equal(3, len(lines)) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
674 call assert_equal('one', lines[0]) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
675 call assert_equal('two', lines[1]) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
676 call assert_equal('three', lines[2]) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
677 endif |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
678 |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
679 if RunVim([], after, 'one -c echo two') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
680 let lines = readfile('Xtestout') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
681 call assert_equal(2, len(lines)) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
682 call assert_equal('one', lines[0]) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
683 call assert_equal('two', lines[1]) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
684 endif |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
685 |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
686 if RunVim([], after, 'one -- -c echo two') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
687 let lines = readfile('Xtestout') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
688 call assert_equal(4, len(lines)) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
689 call assert_equal('one', lines[0]) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
690 call assert_equal('-c', lines[1]) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
691 call assert_equal('echo', lines[2]) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
692 call assert_equal('two', lines[3]) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
693 endif |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
694 |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
695 call delete('Xtestout') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
696 endfunc |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
697 |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
698 func Test_startuptime() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21333
diff
changeset
|
699 CheckFeature startuptime |
9804
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
700 let after = ['qall'] |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
701 if RunVim([], after, '--startuptime Xtestout one') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
702 let lines = readfile('Xtestout') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
703 let expected = ['--- VIM STARTING ---', 'parsing arguments', |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
704 \ 'shell init', 'inits 3', 'start termcap', 'opening buffers'] |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
705 let found = [] |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
706 for line in lines |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
707 for exp in expected |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
708 if line =~ exp |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
709 call add(found, exp) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
710 endif |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
711 endfor |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
712 endfor |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
713 call assert_equal(expected, found) |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
714 endif |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
715 call delete('Xtestout') |
4ef933b816e7
commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents:
9796
diff
changeset
|
716 endfunc |
9806
108b62925cb0
commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents:
9804
diff
changeset
|
717 |
28435
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
718 func Test_log() |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
719 CheckFeature channel |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
720 |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
721 call assert_false(filereadable('Xlogfile')) |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
722 let after = ['qall'] |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
723 if RunVim([], after, '--log Xlogfile') |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
724 call assert_equal(1, readfile('Xlogfile') |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
725 \ ->filter({i, l -> l =~ '==== start log session'}) |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
726 \ ->len()) |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
727 " second time appends to the log |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
728 if RunVim([], after, '--log Xlogfile') |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
729 call assert_equal(2, readfile('Xlogfile') |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
730 \ ->filter({i, l -> l =~ '==== start log session'}) |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
731 \ ->len()) |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
732 endif |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
733 endif |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
734 call delete('Xlogfile') |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
735 endfunc |
0533e7466ef0
patch 8.2.4742: there is no way to start logging very early in startup
Bram Moolenaar <Bram@vim.org>
parents:
28303
diff
changeset
|
736 |
9806
108b62925cb0
commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents:
9804
diff
changeset
|
737 func Test_read_stdin() |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
738 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:
16590
diff
changeset
|
739 write Xtestout |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
740 quit! |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
741 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
742 |
9806
108b62925cb0
commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents:
9804
diff
changeset
|
743 if RunVimPiped([], after, '-', 'echo something | ') |
108b62925cb0
commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents:
9804
diff
changeset
|
744 let lines = readfile('Xtestout') |
9808
0470742f7346
commit https://github.com/vim/vim/commit/e4a76ad0e74a31bbd9f1b1ac5b816d714d19a412
Christian Brabandt <cb@256bit.org>
parents:
9806
diff
changeset
|
745 " MS-Windows adds a space after the word |
0470742f7346
commit https://github.com/vim/vim/commit/e4a76ad0e74a31bbd9f1b1ac5b816d714d19a412
Christian Brabandt <cb@256bit.org>
parents:
9806
diff
changeset
|
746 call assert_equal(['something'], split(lines[0])) |
9806
108b62925cb0
commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents:
9804
diff
changeset
|
747 endif |
108b62925cb0
commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents:
9804
diff
changeset
|
748 call delete('Xtestout') |
108b62925cb0
commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents:
9804
diff
changeset
|
749 endfunc |
11032
516391d8865f
patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents:
9830
diff
changeset
|
750 |
516391d8865f
patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents:
9830
diff
changeset
|
751 func Test_progpath() |
516391d8865f
patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents:
9830
diff
changeset
|
752 " Tests normally run with "./vim" or "../vim", these must have been expanded |
516391d8865f
patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents:
9830
diff
changeset
|
753 " to a full path. |
516391d8865f
patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents:
9830
diff
changeset
|
754 if has('unix') |
516391d8865f
patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents:
9830
diff
changeset
|
755 call assert_equal('/', v:progpath[0]) |
516391d8865f
patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents:
9830
diff
changeset
|
756 elseif has('win32') |
516391d8865f
patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents:
9830
diff
changeset
|
757 call assert_equal(':', v:progpath[1]) |
516391d8865f
patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents:
9830
diff
changeset
|
758 call assert_match('[/\\]', v:progpath[2]) |
516391d8865f
patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents:
9830
diff
changeset
|
759 endif |
516391d8865f
patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents:
9830
diff
changeset
|
760 |
516391d8865f
patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents:
9830
diff
changeset
|
761 " Only expect "vim" to appear in v:progname. |
516391d8865f
patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents:
9830
diff
changeset
|
762 call assert_match('vim\c', v:progname) |
516391d8865f
patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents:
9830
diff
changeset
|
763 endfunc |
11258
84f71a8a5f2c
patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents:
11032
diff
changeset
|
764 |
84f71a8a5f2c
patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents:
11032
diff
changeset
|
765 func Test_silent_ex_mode() |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
766 " must be able to get the output of Vim. |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
767 CheckUnix |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
768 CheckNotGui |
11258
84f71a8a5f2c
patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents:
11032
diff
changeset
|
769 |
84f71a8a5f2c
patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents:
11032
diff
changeset
|
770 " This caused an ml_get error. |
84f71a8a5f2c
patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents:
11032
diff
changeset
|
771 let out = system(GetVimCommand() . '-u NONE -es -c''set verbose=1|h|exe "%norm\<c-y>\<c-d>"'' -c cq') |
84f71a8a5f2c
patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents:
11032
diff
changeset
|
772 call assert_notmatch('E315:', out) |
84f71a8a5f2c
patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents:
11032
diff
changeset
|
773 endfunc |
11305
3bcdfad55b19
patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents:
11258
diff
changeset
|
774 |
3bcdfad55b19
patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents:
11258
diff
changeset
|
775 func Test_default_term() |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
776 " must be able to get the output of Vim. |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
777 CheckUnix |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
778 CheckNotGui |
11305
3bcdfad55b19
patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents:
11258
diff
changeset
|
779 |
3bcdfad55b19
patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents:
11258
diff
changeset
|
780 let save_term = $TERM |
11307
6e1c19d3de03
patch 8.0.0539: startup test fails on Mac
Christian Brabandt <cb@256bit.org>
parents:
11305
diff
changeset
|
781 let $TERM = 'unknownxxx' |
11305
3bcdfad55b19
patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents:
11258
diff
changeset
|
782 let out = system(GetVimCommand() . ' -c''set term'' -c cq') |
3bcdfad55b19
patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents:
11258
diff
changeset
|
783 call assert_match("defaulting to 'ansi'", out) |
3bcdfad55b19
patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents:
11258
diff
changeset
|
784 let $TERM = save_term |
3bcdfad55b19
patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents:
11258
diff
changeset
|
785 endfunc |
12545
241fbf588b95
patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents:
11595
diff
changeset
|
786 |
241fbf588b95
patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents:
11595
diff
changeset
|
787 func Test_zzz_startinsert() |
241fbf588b95
patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents:
11595
diff
changeset
|
788 " Test :startinsert |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
789 call writefile(['123456'], 'Xtestout', 'D') |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
790 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:
16590
diff
changeset
|
791 :startinsert |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
792 call feedkeys("foobar\<c-o>:wq\<cr>","t") |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
793 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
794 |
12545
241fbf588b95
patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents:
11595
diff
changeset
|
795 if RunVim([], after, 'Xtestout') |
241fbf588b95
patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents:
11595
diff
changeset
|
796 let lines = readfile('Xtestout') |
241fbf588b95
patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents:
11595
diff
changeset
|
797 call assert_equal(['foobar123456'], lines) |
241fbf588b95
patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents:
11595
diff
changeset
|
798 endif |
241fbf588b95
patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents:
11595
diff
changeset
|
799 " Test :startinsert! |
241fbf588b95
patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents:
11595
diff
changeset
|
800 call writefile(['123456'], 'Xtestout') |
16720
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
801 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:
16590
diff
changeset
|
802 :startinsert! |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
803 call feedkeys("foobar\<c-o>:wq\<cr>","t") |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
804 [CODE] |
9c90cf08cfa8
patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents:
16590
diff
changeset
|
805 |
12545
241fbf588b95
patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents:
11595
diff
changeset
|
806 if RunVim([], after, 'Xtestout') |
241fbf588b95
patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents:
11595
diff
changeset
|
807 let lines = readfile('Xtestout') |
241fbf588b95
patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents:
11595
diff
changeset
|
808 call assert_equal(['123456foobar'], lines) |
241fbf588b95
patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents:
11595
diff
changeset
|
809 endif |
241fbf588b95
patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents:
11595
diff
changeset
|
810 endfunc |
15926
ca0a0b64809c
patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents:
15284
diff
changeset
|
811 |
ca0a0b64809c
patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents:
15284
diff
changeset
|
812 func Test_issue_3969() |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
813 " Can't catch the output of gvim. |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
814 CheckNotGui |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
815 |
15926
ca0a0b64809c
patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents:
15284
diff
changeset
|
816 " Check that message is not truncated. |
ca0a0b64809c
patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents:
15284
diff
changeset
|
817 let out = system(GetVimCommand() . ' -es -X -V1 -c "echon ''hello''" -cq') |
ca0a0b64809c
patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents:
15284
diff
changeset
|
818 call assert_equal('hello', out) |
ca0a0b64809c
patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents:
15284
diff
changeset
|
819 endfunc |
16385
bb0f7cb7e2d5
patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents:
15926
diff
changeset
|
820 |
bb0f7cb7e2d5
patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents:
15926
diff
changeset
|
821 func Test_start_with_tabs() |
20625
116c7bd5e980
patch 8.2.0866: not enough tests for buffer writing
Bram Moolenaar <Bram@vim.org>
parents:
20273
diff
changeset
|
822 CheckRunVimInTerminal |
16385
bb0f7cb7e2d5
patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents:
15926
diff
changeset
|
823 |
bb0f7cb7e2d5
patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents:
15926
diff
changeset
|
824 let buf = RunVimInTerminal('-p a b c', {}) |
bb0f7cb7e2d5
patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents:
15926
diff
changeset
|
825 call VerifyScreenDump(buf, 'Test_start_with_tabs', {}) |
bb0f7cb7e2d5
patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents:
15926
diff
changeset
|
826 |
bb0f7cb7e2d5
patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents:
15926
diff
changeset
|
827 " clean up |
bb0f7cb7e2d5
patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents:
15926
diff
changeset
|
828 call StopVimInTerminal(buf) |
bb0f7cb7e2d5
patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents:
15926
diff
changeset
|
829 endfunc |
18477
e93cab5d0f0f
patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents:
18241
diff
changeset
|
830 |
27004
671664c5faa4
patch 8.2.4031: crash in xterm with only two lines
Bram Moolenaar <Bram@vim.org>
parents:
25931
diff
changeset
|
831 func Test_start_in_minimal_window() |
671664c5faa4
patch 8.2.4031: crash in xterm with only two lines
Bram Moolenaar <Bram@vim.org>
parents:
25931
diff
changeset
|
832 CheckRunVimInTerminal |
671664c5faa4
patch 8.2.4031: crash in xterm with only two lines
Bram Moolenaar <Bram@vim.org>
parents:
25931
diff
changeset
|
833 |
671664c5faa4
patch 8.2.4031: crash in xterm with only two lines
Bram Moolenaar <Bram@vim.org>
parents:
25931
diff
changeset
|
834 let buf = RunVimInTerminal('-c "set nomore"', {'cols': 12, 'rows': 2, 'keep_t_u7': 1}) |
671664c5faa4
patch 8.2.4031: crash in xterm with only two lines
Bram Moolenaar <Bram@vim.org>
parents:
25931
diff
changeset
|
835 call term_sendkeys(buf, "ahello\<Esc>") |
671664c5faa4
patch 8.2.4031: crash in xterm with only two lines
Bram Moolenaar <Bram@vim.org>
parents:
25931
diff
changeset
|
836 call WaitForAssert({-> assert_match('^hello', term_getline(buf, 1))}) |
671664c5faa4
patch 8.2.4031: crash in xterm with only two lines
Bram Moolenaar <Bram@vim.org>
parents:
25931
diff
changeset
|
837 |
671664c5faa4
patch 8.2.4031: crash in xterm with only two lines
Bram Moolenaar <Bram@vim.org>
parents:
25931
diff
changeset
|
838 " clean up |
671664c5faa4
patch 8.2.4031: crash in xterm with only two lines
Bram Moolenaar <Bram@vim.org>
parents:
25931
diff
changeset
|
839 call StopVimInTerminal(buf) |
671664c5faa4
patch 8.2.4031: crash in xterm with only two lines
Bram Moolenaar <Bram@vim.org>
parents:
25931
diff
changeset
|
840 endfunc |
671664c5faa4
patch 8.2.4031: crash in xterm with only two lines
Bram Moolenaar <Bram@vim.org>
parents:
25931
diff
changeset
|
841 |
18477
e93cab5d0f0f
patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents:
18241
diff
changeset
|
842 func Test_v_argv() |
e93cab5d0f0f
patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents:
18241
diff
changeset
|
843 " Can't catch the output of gvim. |
e93cab5d0f0f
patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents:
18241
diff
changeset
|
844 CheckNotGui |
e93cab5d0f0f
patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents:
18241
diff
changeset
|
845 |
e93cab5d0f0f
patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents:
18241
diff
changeset
|
846 let out = system(GetVimCommand() . ' -es -V1 -X arg1 --cmd "echo v:argv" --cmd q') |
e93cab5d0f0f
patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents:
18241
diff
changeset
|
847 let list = out->split("', '") |
e93cab5d0f0f
patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents:
18241
diff
changeset
|
848 call assert_match('vim', list[0]) |
e93cab5d0f0f
patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents:
18241
diff
changeset
|
849 let idx = index(list, 'arg1') |
e93cab5d0f0f
patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents:
18241
diff
changeset
|
850 call assert_true(idx > 2) |
e93cab5d0f0f
patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents:
18241
diff
changeset
|
851 call assert_equal(['arg1', '--cmd', 'echo v:argv', '--cmd', 'q'']'], list[idx:]) |
e93cab5d0f0f
patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents:
18241
diff
changeset
|
852 endfunc |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
853 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
854 " Test for the "-r" recovery mode option |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
855 func Test_r_arg() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
856 " Can't catch the output of gvim. |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
857 CheckNotGui |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
858 CheckUnix |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
859 CheckEnglish |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
860 let cmd = GetVimCommand() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
861 " There can be swap files anywhere, only check for the headers. |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
862 let expected =<< trim END |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
863 Swap files found:.* |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
864 In current directory:.* |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
865 In directory \~/tmp:.* |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
866 In directory /var/tmp:.* |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
867 In directory /tmp:.* |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
868 END |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
869 call assert_match(join(expected, ""), system(cmd .. " -r")->substitute("[\r\n]\\+", '', '')) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
870 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
871 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
872 " Test for the '-t' option to jump to a tag |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
873 func Test_t_arg() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
874 let before =<< trim [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
875 set tags=Xtags |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
876 [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
877 let after =<< trim [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
878 let s = bufname('') .. ':L' .. line('.') .. 'C' .. col('.') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
879 call writefile([s], "Xtestout") |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
880 qall |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
881 [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
882 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
883 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
884 \ "first\tXfile1\t/^ \\zsfirst$/", |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
885 \ "second\tXfile1\t/^ \\zssecond$/", |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
886 \ "third\tXfile1\t/^ \\zsthird$/"], |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
887 \ 'Xtags', 'D') |
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
888 call writefile([' first', ' second', ' third'], 'Xfile1', 'D') |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
889 |
24230
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
24228
diff
changeset
|
890 for t_arg in ['-t second', '-tsecond'] |
25771
7dbd3a65a04b
patch 8.2.3421: a bit of code is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
25066
diff
changeset
|
891 if RunVim(before, after, t_arg) |
24230
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
24228
diff
changeset
|
892 call assert_equal(['Xfile1:L2C5'], readfile('Xtestout'), t_arg) |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
24228
diff
changeset
|
893 call delete('Xtestout') |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
24228
diff
changeset
|
894 endif |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
24228
diff
changeset
|
895 endfor |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
896 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
897 |
23231
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
898 " Test the '-T' argument which sets the 'term' option. |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
899 func Test_T_arg() |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
900 CheckNotGui |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
901 let after =<< trim [CODE] |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
902 call writefile([&term], "Xtest_T_arg") |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
903 qall |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
904 [CODE] |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
905 |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
906 for t in ['builtin_dumb', 'builtin_ansi'] |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
907 if RunVim([], after, '-T ' .. t) |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
908 let lines = readfile('Xtest_T_arg') |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
909 call assert_equal([t], lines) |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
910 endif |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
911 endfor |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
912 |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
913 call delete('Xtest_T_arg') |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
914 endfunc |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
915 |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
916 " Test the '-x' argument to read/write encrypted files. |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
917 func Test_x_arg() |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
918 CheckRunVimInTerminal |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
919 CheckFeature cryptv |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
920 |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
921 " Create an encrypted file Xtest_x_arg. |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
922 let buf = RunVimInTerminal('-n -x Xtest_x_arg', #{rows: 10, wait_for_ruler: 0}) |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
923 call WaitForAssert({-> assert_match('^Enter encryption key: ', term_getline(buf, 10))}) |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
924 call term_sendkeys(buf, "foo\n") |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
925 call WaitForAssert({-> assert_match('^Enter same key again: ', term_getline(buf, 10))}) |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
926 call term_sendkeys(buf, "foo\n") |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
927 call WaitForAssert({-> assert_match(' All$', term_getline(buf, 10))}) |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
928 call term_sendkeys(buf, "itest\<Esc>:w\<Enter>") |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
929 call WaitForAssert({-> assert_match('"Xtest_x_arg" \[New\]\[blowfish2\] 1L, 5B written', |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
930 \ term_getline(buf, 10))}) |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
931 call StopVimInTerminal(buf) |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
932 |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
933 " Read the encrypted file and check that it contains the expected content "test" |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
934 let buf = RunVimInTerminal('-n -x Xtest_x_arg', #{rows: 10, wait_for_ruler: 0}) |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
935 call WaitForAssert({-> assert_match('^Enter encryption key: ', term_getline(buf, 10))}) |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
936 call term_sendkeys(buf, "foo\n") |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
937 call WaitForAssert({-> assert_match('^Enter same key again: ', term_getline(buf, 10))}) |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
938 call term_sendkeys(buf, "foo\n") |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
939 call WaitForAssert({-> assert_match('^test', term_getline(buf, 1))}) |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
940 call StopVimInTerminal(buf) |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
941 |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
942 call delete('Xtest_x_arg') |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
943 endfunc |
990466a75d3c
patch 8.2.2161: arguments -T and -x not tested yet
Bram Moolenaar <Bram@vim.org>
parents:
22502
diff
changeset
|
944 |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
945 " Test for entering the insert mode on startup |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
946 func Test_start_insertmode() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
947 let before =<< trim [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
948 set insertmode |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
949 [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
950 let after =<< trim [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
951 call writefile(['insertmode=' .. &insertmode], 'Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
952 qall |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
953 [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
954 if RunVim(before, after, '') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
955 call assert_equal(['insertmode=1'], readfile('Xtestout')) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
956 call delete('Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
957 endif |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
958 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
959 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
960 " Test for enabling the binary mode on startup |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
961 func Test_b_arg() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
962 let after =<< trim [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
963 call writefile(['binary=' .. &binary], 'Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
964 qall |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
965 [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
966 if RunVim([], after, '-b') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
967 call assert_equal(['binary=1'], readfile('Xtestout')) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
968 call delete('Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
969 endif |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
970 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
971 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
972 " Test for enabling the lisp mode on startup |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
973 func Test_l_arg() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
974 let after =<< trim [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
975 let s = 'lisp=' .. &lisp .. ', showmatch=' .. &showmatch |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
976 call writefile([s], 'Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
977 qall |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
978 [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
979 if RunVim([], after, '-l') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
980 call assert_equal(['lisp=1, showmatch=1'], readfile('Xtestout')) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
981 call delete('Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
982 endif |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
983 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
984 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
985 " Test for specifying a non-existing vimrc file using "-u" |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
986 func Test_missing_vimrc() |
20625
116c7bd5e980
patch 8.2.0866: not enough tests for buffer writing
Bram Moolenaar <Bram@vim.org>
parents:
20273
diff
changeset
|
987 CheckRunVimInTerminal |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
988 let after =<< trim [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
989 call assert_match('^E282:', v:errmsg) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
990 call writefile(v:errors, 'Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
991 [CODE] |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
992 call writefile(after, 'Xafter', 'D') |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
993 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
994 let cmd = GetVimCommandCleanTerm() . ' -u Xvimrc_missing -S Xafter' |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
995 let buf = term_start(cmd, {'term_rows' : 10}) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
996 call WaitForAssert({-> assert_equal("running", term_getstatus(buf))}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
997 call TermWait(buf) |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
998 call term_sendkeys(buf, "\n:") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
999 call TermWait(buf) |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1000 call WaitForAssert({-> assert_match(':', term_getline(buf, 10))}) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1001 call StopVimInTerminal(buf) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1002 call assert_equal([], readfile('Xtestout')) |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
1003 |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1004 call delete('Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1005 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1006 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1007 " Test for using the $VIMINIT environment variable |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1008 func Test_VIMINIT() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1009 let after =<< trim [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1010 call assert_equal(1, exists('viminit_found')) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1011 call assert_equal('yes', viminit_found) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1012 call writefile(v:errors, 'Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1013 qall |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1014 [CODE] |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
1015 call writefile(after, 'Xafter', 'D') |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1016 let cmd = GetVimProg() . ' --not-a-term -S Xafter --cmd "set enc=utf8"' |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1017 call setenv('VIMINIT', 'let viminit_found="yes"') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1018 exe "silent !" . cmd |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1019 call assert_equal([], readfile('Xtestout')) |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
1020 |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1021 call delete('Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1022 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1023 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1024 " Test for using the $EXINIT environment variable |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1025 func Test_EXINIT() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1026 let after =<< trim [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1027 call assert_equal(1, exists('exinit_found')) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1028 call assert_equal('yes', exinit_found) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1029 call writefile(v:errors, 'Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1030 qall |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1031 [CODE] |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
1032 call writefile(after, 'Xafter', 'D') |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1033 let cmd = GetVimProg() . ' --not-a-term -S Xafter --cmd "set enc=utf8"' |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1034 call setenv('EXINIT', 'let exinit_found="yes"') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1035 exe "silent !" . cmd |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1036 call assert_equal([], readfile('Xtestout')) |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
1037 |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1038 call delete('Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1039 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1040 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1041 " Test for using the 'exrc' option |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1042 func Test_exrc() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1043 let after =<< trim [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1044 call assert_equal(1, &exrc) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1045 call assert_equal(1, &secure) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1046 call assert_equal(37, exrc_found) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1047 call writefile(v:errors, 'Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1048 qall |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1049 [CODE] |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
1050 call mkdir('Xrcdir', 'R') |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29247
diff
changeset
|
1051 call writefile(['let exrc_found=37'], 'Xrcdir/.exrc') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29247
diff
changeset
|
1052 call writefile(after, 'Xrcdir/Xafter') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29247
diff
changeset
|
1053 let cmd = GetVimProg() . ' --not-a-term -S Xafter --cmd "cd Xrcdir" --cmd "set enc=utf8 exrc secure"' |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1054 exe "silent !" . cmd |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29247
diff
changeset
|
1055 call assert_equal([], readfile('Xrcdir/Xtestout')) |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1056 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1057 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1058 " Test for starting Vim with a non-terminal as input/output |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1059 func Test_io_not_a_terminal() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1060 " Can't catch the output of gvim. |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1061 CheckNotGui |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1062 CheckUnix |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1063 CheckEnglish |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1064 let l = systemlist(GetVimProg() .. ' --ttyfail') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1065 call assert_equal(['Vim: Warning: Output is not to a terminal', |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1066 \ 'Vim: Warning: Input is not from a terminal'], l) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1067 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1068 |
24242
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1069 " Test for --not-a-term avoiding escape codes. |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1070 func Test_not_a_term() |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1071 CheckUnix |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1072 CheckNotGui |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1073 |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1074 if &shellredir =~ '%s' |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1075 let redir = printf(&shellredir, 'Xvimout') |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1076 else |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1077 let redir = &shellredir .. ' Xvimout' |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1078 endif |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1079 |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1080 " Without --not-a-term there are a few escape sequences. |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1081 " This will take 2 seconds because of the missing --not-a-term |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1082 let cmd = GetVimProg() .. ' --cmd quit ' .. redir |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1083 exe "silent !" . cmd |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1084 call assert_match("\<Esc>", readfile('Xvimout')->join()) |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1085 call delete('Xvimout') |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1086 |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1087 " With --not-a-term there are no escape sequences. |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1088 let cmd = GetVimProg() .. ' --not-a-term --cmd quit ' .. redir |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1089 exe "silent !" . cmd |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1090 call assert_notmatch("\<Esc>", readfile('Xvimout')->join()) |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1091 call delete('Xvimout') |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1092 endfunc |
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1093 |
30467
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1094 " Test quitting with CTRL-C when output is redirected. |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1095 func Test_redirect_Ctrl_C() |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1096 CheckUnix |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1097 CheckNotGui |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1098 CheckRunVimInTerminal |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1099 |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1100 let buf = Run_shell_in_terminal({}) |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1101 " Wait for the shell to display a prompt |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1102 call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))}) |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1103 |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1104 call term_sendkeys(buf, GetVimProg() .. " | grep word\<CR>") |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1105 call WaitForAssert({-> assert_match("Output is not to a terminal", getline(1, 4)->join())}) |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1106 " wait for the hard coded delay, otherwise the CTRL-C interrupts startup |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1107 sleep 2 |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1108 call term_sendkeys(buf, "\<C-C>") |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1109 sleep 100m |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1110 call term_sendkeys(buf, "exit\<CR>") |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1111 call WaitForAssert({-> assert_equal('dead', job_status(g:job))}) |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1112 |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1113 exe buf . 'bwipe!' |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1114 unlet g:job |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1115 endfunc |
072c61082148
patch 9.0.0569: cannot easily get out when using "vim file | grep word"
Bram Moolenaar <Bram@vim.org>
parents:
30184
diff
changeset
|
1116 |
24242
d3cabf12c991
patch 8.2.2662: there is no way to avoid some escape sequences
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1117 |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1118 " Test for the "-w scriptout" argument |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1119 func Test_w_arg() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1120 " Can't catch the output of gvim. |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1121 CheckNotGui |
24228
1e85e76f9e76
patch 8.2.2655: The -w command line argument doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
24182
diff
changeset
|
1122 |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
1123 call writefile(["iVim Editor\<Esc>:q!\<CR>"], 'Xscriptin', 'bD') |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1124 if RunVim([], [], '-s Xscriptin -w Xscriptout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1125 call assert_equal(["iVim Editor\e:q!\r"], readfile('Xscriptout')) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1126 call delete('Xscriptout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1127 endif |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1128 call delete('Xscriptin') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1129 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1130 " Test for failing to open the script output file. This test works only when |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1131 " the language is English. |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1132 if v:lang == "C" || v:lang =~ '^[Ee]n' |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29247
diff
changeset
|
1133 call mkdir("Xargdir") |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29247
diff
changeset
|
1134 let m = system(GetVimCommand() .. " -w Xargdir") |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29247
diff
changeset
|
1135 call assert_equal("Cannot open for script output: \"Xargdir\"\n", m) |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29247
diff
changeset
|
1136 call delete("Xargdir", 'rf') |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1137 endif |
24228
1e85e76f9e76
patch 8.2.2655: The -w command line argument doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
24182
diff
changeset
|
1138 |
1e85e76f9e76
patch 8.2.2655: The -w command line argument doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
24182
diff
changeset
|
1139 " A number argument sets the 'window' option |
1e85e76f9e76
patch 8.2.2655: The -w command line argument doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
24182
diff
changeset
|
1140 call writefile(["iwindow \<C-R>=&window\<CR>\<Esc>:wq! Xresult\<CR>"], 'Xscriptin', 'b') |
24230
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
24228
diff
changeset
|
1141 for w_arg in ['-w 17', '-w17'] |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
24228
diff
changeset
|
1142 if RunVim([], [], '-s Xscriptin ' .. w_arg) |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
24228
diff
changeset
|
1143 call assert_equal(["window 17"], readfile('Xresult'), w_arg) |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
24228
diff
changeset
|
1144 call delete('Xresult') |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
24228
diff
changeset
|
1145 endif |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
24228
diff
changeset
|
1146 endfor |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1147 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1148 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1149 " Test for the "-s scriptin" argument |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1150 func Test_s_arg() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1151 " Can't catch the output of gvim. |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1152 CheckNotGui |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1153 CheckEnglish |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1154 " Test for failing to open the script input file. |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1155 let m = system(GetVimCommand() .. " -s abcxyz") |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1156 call assert_equal("Cannot open for reading: \"abcxyz\"\n", m) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1157 |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
1158 call writefile([], 'Xinput', 'D') |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1159 let m = system(GetVimCommand() .. " -s Xinput -s Xinput") |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1160 call assert_equal("Attempt to open script file again: \"-s Xinput\"\n", m) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1161 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1162 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1163 " Test for the "-n" (no swap file) argument |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1164 func Test_n_arg() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1165 let after =<< trim [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1166 call assert_equal(0, &updatecount) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1167 call writefile(v:errors, 'Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1168 qall |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1169 [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1170 if RunVim([], after, '-n') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1171 call assert_equal([], readfile('Xtestout')) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1172 call delete('Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1173 endif |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1174 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1175 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1176 " Test for the "-h" (help) argument |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1177 func Test_h_arg() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1178 " Can't catch the output of gvim. |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1179 CheckNotGui |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1180 let l = systemlist(GetVimProg() .. ' -h') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1181 call assert_match('^VIM - Vi IMproved', l[0]) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1182 let l = systemlist(GetVimProg() .. ' -?') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1183 call assert_match('^VIM - Vi IMproved', l[0]) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1184 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1185 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1186 " Test for the "-F" (farsi) argument |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1187 func Test_F_arg() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1188 " Can't catch the output of gvim. |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1189 CheckNotGui |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1190 let l = systemlist(GetVimProg() .. ' -F') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1191 call assert_match('^E27:', l[0]) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1192 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1193 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1194 " Test for the "-E" (improved Ex mode) argument |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1195 func Test_E_arg() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1196 let after =<< trim [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1197 call assert_equal('cv', mode(1)) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1198 call writefile(v:errors, 'Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1199 qall |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1200 [CODE] |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1201 if RunVim([], after, '-E') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1202 call assert_equal([], readfile('Xtestout')) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1203 call delete('Xtestout') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1204 endif |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1205 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1206 |
24182
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
24140
diff
changeset
|
1207 " Test for the "-D" (debugger) argument |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
24140
diff
changeset
|
1208 func Test_D_arg() |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
24140
diff
changeset
|
1209 CheckRunVimInTerminal |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
24140
diff
changeset
|
1210 |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
24140
diff
changeset
|
1211 let cmd = GetVimCommandCleanTerm() .. ' -D' |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
24140
diff
changeset
|
1212 let buf = term_start(cmd, {'term_rows' : 10}) |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
24140
diff
changeset
|
1213 call WaitForAssert({-> assert_equal("running", term_getstatus(buf))}) |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
24140
diff
changeset
|
1214 |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
24140
diff
changeset
|
1215 call WaitForAssert({-> assert_equal('Entering Debug mode. Type "cont" to continue.', |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
24140
diff
changeset
|
1216 \ term_getline(buf, 7))}) |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
24140
diff
changeset
|
1217 call WaitForAssert({-> assert_equal('>', term_getline(buf, 10))}) |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
24140
diff
changeset
|
1218 |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
24140
diff
changeset
|
1219 call StopVimInTerminal(buf) |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
24140
diff
changeset
|
1220 endfunc |
493870e7f61d
patch 8.2.2632: not all command line arguments are tested
Bram Moolenaar <Bram@vim.org>
parents:
24140
diff
changeset
|
1221 |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1222 " Test for too many edit argument errors |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1223 func Test_too_many_edit_args() |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1224 " Can't catch the output of gvim. |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1225 CheckNotGui |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1226 CheckEnglish |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1227 let l = systemlist(GetVimProg() .. ' - -') |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1228 call assert_match('^Too many edit arguments: "-"', l[1]) |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1229 endfunc |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1230 |
23574
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1231 " Test starting vim with various names: vim, ex, view, evim, etc. |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1232 func Test_progname() |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1233 CheckUnix |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1234 |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
1235 call mkdir('Xprogname', 'pD') |
23574
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1236 call writefile(['silent !date', |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1237 \ 'call writefile([mode(1), ' |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1238 \ .. '&insertmode, &diff, &readonly, &updatecount, ' |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1239 \ .. 'join(split(execute("message"), "\n")[1:])], "Xprogname_out")', |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1240 \ 'qall'], 'Xprogname_after') |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1241 |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1242 " +---------------------------------------------- progname |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1243 " | +--------------------------------- mode(1) |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1244 " | | +--------------------------- &insertmode |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1245 " | | | +---------------------- &diff |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1246 " | | | | +----------------- &readonly |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1247 " | | | | | +-------- &updatecount |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1248 " | | | | | | +--- :messages |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1249 " | | | | | | | |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1250 let expectations = { |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1251 \ 'vim': ['n', '0', '0', '0', '200', ''], |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1252 \ 'gvim': ['n', '0', '0', '0', '200', ''], |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1253 \ 'ex': ['ce', '0', '0', '0', '200', ''], |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1254 \ 'exim': ['cv', '0', '0', '0', '200', ''], |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1255 \ 'view': ['n', '0', '0', '1', '10000', ''], |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1256 \ 'gview': ['n', '0', '0', '1', '10000', ''], |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1257 \ 'evim': ['n', '1', '0', '0', '200', ''], |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1258 \ 'eview': ['n', '1', '0', '1', '10000', ''], |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1259 \ 'rvim': ['n', '0', '0', '0', '200', 'line 1: E145: Shell commands and some functionality not allowed in rvim'], |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1260 \ 'rgvim': ['n', '0', '0', '0', '200', 'line 1: E145: Shell commands and some functionality not allowed in rvim'], |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1261 \ 'rview': ['n', '0', '0', '1', '10000', 'line 1: E145: Shell commands and some functionality not allowed in rvim'], |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1262 \ 'rgview': ['n', '0', '0', '1', '10000', 'line 1: E145: Shell commands and some functionality not allowed in rvim'], |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1263 \ 'vimdiff': ['n', '0', '1', '0', '200', ''], |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1264 \ 'gvimdiff': ['n', '0', '1', '0', '200', '']} |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1265 |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1266 let prognames = ['vim', 'gvim', 'ex', 'exim', 'view', 'gview', |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1267 \ 'evim', 'eview', 'rvim', 'rgvim', 'rview', 'rgview', |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1268 \ 'vimdiff', 'gvimdiff'] |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1269 |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1270 for progname in prognames |
24126
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
1271 let run_with_gui = (progname =~# 'g') || (has('gui') && (progname ==# 'evim' || progname ==# 'eview')) |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
1272 |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
1273 if empty($DISPLAY) && run_with_gui |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
1274 " Can't run gvim, gview (etc.) if $DISPLAY is not setup. |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
1275 continue |
23574
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1276 endif |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1277 |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1278 exe 'silent !ln -s -f ' ..exepath(GetVimProg()) .. ' Xprogname/' .. progname |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1279 |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1280 let stdout_stderr = '' |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1281 if progname =~# 'g' |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1282 let stdout_stderr = system('Xprogname/'..progname..' -f --clean --not-a-term -S Xprogname_after') |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1283 else |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1284 exe 'sil !Xprogname/'..progname..' -f --clean --not-a-term -S Xprogname_after' |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1285 endif |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1286 |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1287 if progname =~# 'g' && !has('gui') |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1288 call assert_equal("E25: GUI cannot be used: Not enabled at compile time\n", stdout_stderr, progname) |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1289 else |
24126
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
1290 " GUI motif can output some warnings like this: |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
1291 " Warning: |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
1292 " Name: subMenu |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
1293 " Class: XmCascadeButton |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
1294 " Illegal mnemonic character; Could not convert X KEYSYM to a keycode |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
1295 " So don't check that stderr is empty with GUI Motif. |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
1296 if run_with_gui && !has('gui_motif') |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
1297 call assert_equal('', stdout_stderr, progname) |
51ba4b49d7f9
patch 8.2.2604: GUI-specific command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents:
23574
diff
changeset
|
1298 endif |
23574
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1299 call assert_equal(expectations[progname], readfile('Xprogname_out'), progname) |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1300 endif |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1301 |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1302 call delete('Xprogname/' .. progname) |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1303 call delete('Xprogname_out') |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1304 endfor |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1305 |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1306 call delete('Xprogname_after') |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1307 endfunc |
e310c2a0bb8c
patch 8.2.2329: not all ways Vim can be started are tested
Bram Moolenaar <Bram@vim.org>
parents:
23231
diff
changeset
|
1308 |
24620
9f48b262539b
patch 8.2.2849: bufwrite not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
1309 " Test for doing a write from .vimrc |
9f48b262539b
patch 8.2.2849: bufwrite not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
1310 func Test_write_in_vimrc() |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
1311 call writefile(['silent! write'], 'Xvimrc', 'D') |
24620
9f48b262539b
patch 8.2.2849: bufwrite not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
1312 let after =<< trim [CODE] |
9f48b262539b
patch 8.2.2849: bufwrite not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
1313 call assert_match('E32: ', v:errmsg) |
9f48b262539b
patch 8.2.2849: bufwrite not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
1314 call writefile(v:errors, 'Xtestout') |
9f48b262539b
patch 8.2.2849: bufwrite not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
1315 qall |
9f48b262539b
patch 8.2.2849: bufwrite not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
1316 [CODE] |
9f48b262539b
patch 8.2.2849: bufwrite not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
1317 if RunVim([], after, '-u Xvimrc') |
9f48b262539b
patch 8.2.2849: bufwrite not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
1318 call assert_equal([], readfile('Xtestout')) |
9f48b262539b
patch 8.2.2849: bufwrite not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
1319 call delete('Xtestout') |
9f48b262539b
patch 8.2.2849: bufwrite not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
1320 endif |
9f48b262539b
patch 8.2.2849: bufwrite not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
1321 endfunc |
9f48b262539b
patch 8.2.2849: bufwrite not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
1322 |
24938
ac0211a9fb6a
patch 8.2.3006: crash when echoing a value very early
Bram Moolenaar <Bram@vim.org>
parents:
24778
diff
changeset
|
1323 func Test_echo_true_in_cmd() |
24944
d8216679a971
patch 8.2.3009: startup test may hang
Bram Moolenaar <Bram@vim.org>
parents:
24942
diff
changeset
|
1324 CheckNotGui |
d8216679a971
patch 8.2.3009: startup test may hang
Bram Moolenaar <Bram@vim.org>
parents:
24942
diff
changeset
|
1325 |
24938
ac0211a9fb6a
patch 8.2.3006: crash when echoing a value very early
Bram Moolenaar <Bram@vim.org>
parents:
24778
diff
changeset
|
1326 let lines =<< trim END |
ac0211a9fb6a
patch 8.2.3006: crash when echoing a value very early
Bram Moolenaar <Bram@vim.org>
parents:
24778
diff
changeset
|
1327 echo v:true |
ac0211a9fb6a
patch 8.2.3006: crash when echoing a value very early
Bram Moolenaar <Bram@vim.org>
parents:
24778
diff
changeset
|
1328 call writefile(['done'], 'Xresult') |
24942
6dc1be6040d1
patch 8.2.3008: startup test may hang
Bram Moolenaar <Bram@vim.org>
parents:
24938
diff
changeset
|
1329 quit |
24938
ac0211a9fb6a
patch 8.2.3006: crash when echoing a value very early
Bram Moolenaar <Bram@vim.org>
parents:
24778
diff
changeset
|
1330 END |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
1331 call writefile(lines, 'Xscript', 'D') |
24942
6dc1be6040d1
patch 8.2.3008: startup test may hang
Bram Moolenaar <Bram@vim.org>
parents:
24938
diff
changeset
|
1332 if RunVim([], [], '--cmd "source Xscript"') |
24938
ac0211a9fb6a
patch 8.2.3006: crash when echoing a value very early
Bram Moolenaar <Bram@vim.org>
parents:
24778
diff
changeset
|
1333 call assert_equal(['done'], readfile('Xresult')) |
ac0211a9fb6a
patch 8.2.3006: crash when echoing a value very early
Bram Moolenaar <Bram@vim.org>
parents:
24778
diff
changeset
|
1334 endif |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
1335 |
24938
ac0211a9fb6a
patch 8.2.3006: crash when echoing a value very early
Bram Moolenaar <Bram@vim.org>
parents:
24778
diff
changeset
|
1336 call delete('Xresult') |
ac0211a9fb6a
patch 8.2.3006: crash when echoing a value very early
Bram Moolenaar <Bram@vim.org>
parents:
24778
diff
changeset
|
1337 endfunc |
ac0211a9fb6a
patch 8.2.3006: crash when echoing a value very early
Bram Moolenaar <Bram@vim.org>
parents:
24778
diff
changeset
|
1338 |
25885
7c640ad754fb
patch 8.2.3476: renaming a buffer on startup may cause using freed memory
Bram Moolenaar <Bram@vim.org>
parents:
25771
diff
changeset
|
1339 func Test_rename_buffer_on_startup() |
25887
86b63591bed2
patch 8.2.3477: startup test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
25885
diff
changeset
|
1340 CheckUnix |
86b63591bed2
patch 8.2.3477: startup test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
25885
diff
changeset
|
1341 |
25885
7c640ad754fb
patch 8.2.3476: renaming a buffer on startup may cause using freed memory
Bram Moolenaar <Bram@vim.org>
parents:
25771
diff
changeset
|
1342 let lines =<< trim END |
7c640ad754fb
patch 8.2.3476: renaming a buffer on startup may cause using freed memory
Bram Moolenaar <Bram@vim.org>
parents:
25771
diff
changeset
|
1343 call writefile(['done'], 'Xresult') |
7c640ad754fb
patch 8.2.3476: renaming a buffer on startup may cause using freed memory
Bram Moolenaar <Bram@vim.org>
parents:
25771
diff
changeset
|
1344 qa! |
7c640ad754fb
patch 8.2.3476: renaming a buffer on startup may cause using freed memory
Bram Moolenaar <Bram@vim.org>
parents:
25771
diff
changeset
|
1345 END |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
1346 call writefile(lines, 'Xscript', 'D') |
25885
7c640ad754fb
patch 8.2.3476: renaming a buffer on startup may cause using freed memory
Bram Moolenaar <Bram@vim.org>
parents:
25771
diff
changeset
|
1347 if RunVim([], [], "--clean -e -s --cmd 'file x|new|file x' --cmd 'so Xscript'") |
7c640ad754fb
patch 8.2.3476: renaming a buffer on startup may cause using freed memory
Bram Moolenaar <Bram@vim.org>
parents:
25771
diff
changeset
|
1348 call assert_equal(['done'], readfile('Xresult')) |
7c640ad754fb
patch 8.2.3476: renaming a buffer on startup may cause using freed memory
Bram Moolenaar <Bram@vim.org>
parents:
25771
diff
changeset
|
1349 endif |
30769
ae10b91ac6b3
patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30467
diff
changeset
|
1350 |
25885
7c640ad754fb
patch 8.2.3476: renaming a buffer on startup may cause using freed memory
Bram Moolenaar <Bram@vim.org>
parents:
25771
diff
changeset
|
1351 call delete('Xresult') |
7c640ad754fb
patch 8.2.3476: renaming a buffer on startup may cause using freed memory
Bram Moolenaar <Bram@vim.org>
parents:
25771
diff
changeset
|
1352 endfunc |
7c640ad754fb
patch 8.2.3476: renaming a buffer on startup may cause using freed memory
Bram Moolenaar <Bram@vim.org>
parents:
25771
diff
changeset
|
1353 |
33551
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1354 " Test that -cq works as expected |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1355 func Test_cq_zero_exmode() |
33596
8e6ccb8cf556
patch 9.0.2042: Test_cq_zero_exmode fails without channel feature
Christian Brabandt <cb@256bit.org>
parents:
33551
diff
changeset
|
1356 CheckFeature channel |
8e6ccb8cf556
patch 9.0.2042: Test_cq_zero_exmode fails without channel feature
Christian Brabandt <cb@256bit.org>
parents:
33551
diff
changeset
|
1357 |
33551
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1358 let logfile = 'Xcq_log.txt' |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1359 let out = system(GetVimCommand() .. ' --clean --log ' .. logfile .. ' -es -X -c "argdelete foobar" -c"7cq"') |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1360 call assert_equal(8, v:shell_error) |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1361 let log = filter(readfile(logfile), {idx, val -> val =~ "E480"}) |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1362 call assert_match('E480: No match: foobar', log[0]) |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1363 call delete(logfile) |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1364 |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1365 " wrap-around on Unix |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1366 let out = system(GetVimCommand() .. ' --clean --log ' .. logfile .. ' -es -X -c "argdelete foobar" -c"255cq"') |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1367 if !has('win32') |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1368 call assert_equal(0, v:shell_error) |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1369 else |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1370 call assert_equal(256, v:shell_error) |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1371 endif |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1372 let log = filter(readfile(logfile), {idx, val -> val =~ "E480"}) |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1373 call assert_match('E480: No match: foobar', log[0]) |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1374 call delete('Xcq_log.txt') |
9b8e771bf714
patch 9.0.2023: need more tests for :cq
Christian Brabandt <cb@256bit.org>
parents:
32068
diff
changeset
|
1375 endfunc |
25885
7c640ad754fb
patch 8.2.3476: renaming a buffer on startup may cause using freed memory
Bram Moolenaar <Bram@vim.org>
parents:
25771
diff
changeset
|
1376 |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
1377 " vim: shiftwidth=2 sts=2 expandtab |