annotate src/testdir/test_startup.vim @ 20273:6209800492fc v8.2.0692

patch 8.2.0692: startup test fails on MS-Windows Commit: https://github.com/vim/vim/commit/4515bcdec8f3ba54f9d671cc37b9c9b3e19ea999 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 3 18:21:04 2020 +0200 patch 8.2.0692: startup test fails on MS-Windows Problem: Startup test fails on MS-Windows. Solution: Allow for any path.
author Bram Moolenaar <Bram@vim.org>
date Sun, 03 May 2020 18:30:04 +0200
parents 5aacedd332a8
children 116c7bd5e980
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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()
9782
d6a69f968249 commit https://github.com/vim/vim/commit/328604307ba26e3182eb0b096e820f9cd346c2dd
Christian Brabandt <cb@256bit.org>
parents: 9780
diff changeset
24 if !has('packages')
d6a69f968249 commit https://github.com/vim/vim/commit/328604307ba26e3182eb0b096e820f9cd346c2dd
Christian Brabandt <cb@256bit.org>
parents: 9780
diff changeset
25 return
d6a69f968249 commit https://github.com/vim/vim/commit/328604307ba26e3182eb0b096e820f9cd346c2dd
Christian Brabandt <cb@256bit.org>
parents: 9780
diff changeset
26 endif
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
27 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
28 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
29 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
30 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
31 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
32 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
33 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
34 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
35 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
36 [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
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 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
39 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
40 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
41 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
42 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
43 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
44 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
45 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
46 [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
47
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
48 call mkdir('Xhere/plugin', 'p')
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 .= "here "'], 'Xhere/plugin/here.vim')
42cd59477698 patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents: 11457
diff changeset
50 call mkdir('Xanother/plugin', 'p')
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 .= "another "'], 'Xanother/plugin/another.vim')
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
52 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
53 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
54
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
55 call mkdir('Xafter/plugin', 'p')
11595
42cd59477698 patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents: 11457
diff changeset
56 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
57
9794
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
58 if RunVim(before, after, '')
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
59
9780
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
60 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
61 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
62 let found = []
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
63 for line in lines
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
64 for one in expected
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
65 if line =~ one
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
66 call add(found, one)
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
67 endif
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
68 endfor
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
69 endfor
9780
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
70 call assert_equal(expected, found)
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
71 endif
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
72
11595
42cd59477698 patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents: 11457
diff changeset
73 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
74
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
75 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
76 call delete('Xsequence')
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
77 call delete('Xhere', 'rf')
11595
42cd59477698 patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents: 11457
diff changeset
78 call delete('Xanother', 'rf')
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
79 call delete('Xafter', 'rf')
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
80 endfunc
9794
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
81
11457
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
82 func Test_pack_in_rtp_when_plugins_run()
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
83 if !has('packages')
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
84 return
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
85 endif
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
86 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
87 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
88 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
89 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
90 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
91 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
92 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
93 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
94 [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
95
11457
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
96 let after = [
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
97 \ 'quit',
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 call mkdir('Xhere/plugin', 'p')
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
100 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
101 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
102 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
103
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
104 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
105
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
106 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
107 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
108 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
109 endif
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
110
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
111 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
112 call delete('Xhere', 'rf')
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
113 endfunc
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
114
9794
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
115 func Test_help_arg()
9796
1f1ed7959860 commit https://github.com/vim/vim/commit/3321e9d8a36c91c62d8ba3d43430b5c213b87f8b
Christian Brabandt <cb@256bit.org>
parents: 9794
diff changeset
116 if !has('unix') && has('gui')
1f1ed7959860 commit https://github.com/vim/vim/commit/3321e9d8a36c91c62d8ba3d43430b5c213b87f8b
Christian Brabandt <cb@256bit.org>
parents: 9794
diff changeset
117 " this doesn't work with gvim on MS-Windows
1f1ed7959860 commit https://github.com/vim/vim/commit/3321e9d8a36c91c62d8ba3d43430b5c213b87f8b
Christian Brabandt <cb@256bit.org>
parents: 9794
diff changeset
118 return
1f1ed7959860 commit https://github.com/vim/vim/commit/3321e9d8a36c91c62d8ba3d43430b5c213b87f8b
Christian Brabandt <cb@256bit.org>
parents: 9794
diff changeset
119 endif
9794
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
120 if RunVim([], [], '--help >Xtestout')
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
121 let lines = readfile('Xtestout')
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
122 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
123 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
124
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
125 " 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
126 let found = []
9794
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
127 for line in lines
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
128 if line =~ '-R.*Readonly mode'
9830
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9808
diff changeset
129 call add(found, 'Readonly mode')
9794
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
130 endif
9830
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9808
diff changeset
131 " 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
132 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
133 call add(found, "--version")
9794
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
134 endif
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
135 endfor
9830
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9808
diff changeset
136 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
137 endif
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
138 call delete('Xtestout')
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
139 endfunc
9804
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
140
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
141 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
142 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
143 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
144 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
145 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
146 [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
147
9804
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
148 if RunVim([], after, '-C')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
149 let lines = readfile('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
150 call assert_equal('1', lines[0])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
151 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
152
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
153 if RunVim([], after, '-N')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
154 let lines = readfile('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
155 call assert_equal('0', lines[0])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
156 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
157
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
158 call delete('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
159 endfunc
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
160
14772
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
161 " 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
162 " 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
163 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
164 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
165 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
166 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
167 \ 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
168 \ 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
169 \ 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
170 \ "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
171 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
172 [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
173
14772
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
174 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
175 " 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
176 " - 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
177 " - 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
178 " - 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
179 " 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
180 " - 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
181 " 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
182 " - 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
183 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
184 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
185 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
186 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
187 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
188 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
189 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
190 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
191 endif
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
192
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
193 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
194 " 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
195 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
196 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
197 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
198 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
199 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
200 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
201 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
202 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
203 endif
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
204
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
205 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
206 " 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
207 " - 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
208 " - 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
209 " - 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
210 " 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
211 " - 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
212 " - 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
213 " 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
214 " - 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
215 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
216 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
217 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
218 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
219 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
220 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
221 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
222 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
223 endif
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
224
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
225 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
226 " 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
227 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
228 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
229 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
230 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
231 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
232 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
233 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
234 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
235 endif
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
236
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
237 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
238 endfunc
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
239
14788
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
240 " 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
241 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
242 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
243 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
244 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
245 [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
246
14788
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
247 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
248 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
249 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
250 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
251 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
252 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
253 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
254 endif
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
255
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
256 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
257 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
258 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
259 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
260 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
261 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
262 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
263 endif
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
264
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
265 call delete('Xtestout')
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
266 endfunc
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
267
14794
9be43810b5ec patch 8.1.0409: startup test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14788
diff changeset
268 " 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
269 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
270 " 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
271 CheckNotGui
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
272
14788
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
273 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
274 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
275
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
276 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
277 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
278 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
279
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
280 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
281 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
282 endfunc
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
283
15284
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
284 " 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
285 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
286 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18477
diff changeset
287
15284
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
288 let source_file = has('win32') ? '..\memfile.c' : '../memfile.c'
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
289 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
290 call writefile([&errorfile, string(getpos("."))], "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
291 copen
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16590
diff changeset
292 w >> 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
293 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
294 [CODE]
15284
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
295
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
296 " 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
297 call assert_equal('errors.err', &errorfile)
16823
b1b7c7a31679 patch 8.1.1413: error when the drive of the swap file was disconnected
Bram Moolenaar <Bram@vim.org>
parents: 16720
diff changeset
298 call writefile(["../memfile.c:208:5: error: expected ';' before '}' token"], 'errors.err')
15284
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
299 if RunVim([], after, '-q')
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
300 let lines = readfile('Xtestout')
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
301 call assert_equal(['errors.err',
16823
b1b7c7a31679 patch 8.1.1413: error when the drive of the swap file was disconnected
Bram Moolenaar <Bram@vim.org>
parents: 16720
diff changeset
302 \ '[0, 208, 5, 0]',
b1b7c7a31679 patch 8.1.1413: error when the drive of the swap file was disconnected
Bram Moolenaar <Bram@vim.org>
parents: 16720
diff changeset
303 \ source_file . "|208 col 5| 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
304 \ lines)
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
305 endif
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
306 call delete('Xtestout')
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
307 call delete('errors.err')
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
308
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
309 " Test with explicit argument '-q Xerrors' (with space).
16823
b1b7c7a31679 patch 8.1.1413: error when the drive of the swap file was disconnected
Bram Moolenaar <Bram@vim.org>
parents: 16720
diff changeset
310 call writefile(["../memfile.c:208:5: error: expected ';' before '}' token"], 'Xerrors')
15284
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
311 if RunVim([], after, '-q Xerrors')
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
312 let lines = readfile('Xtestout')
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
313 call assert_equal(['Xerrors',
16823
b1b7c7a31679 patch 8.1.1413: error when the drive of the swap file was disconnected
Bram Moolenaar <Bram@vim.org>
parents: 16720
diff changeset
314 \ '[0, 208, 5, 0]',
b1b7c7a31679 patch 8.1.1413: error when the drive of the swap file was disconnected
Bram Moolenaar <Bram@vim.org>
parents: 16720
diff changeset
315 \ source_file . "|208 col 5| 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
316 \ lines)
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
317 endif
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
318 call delete('Xtestout')
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
319
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
320 " Test with explicit argument '-qXerrors' (without space).
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
321 if RunVim([], after, '-qXerrors')
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
322 let lines = readfile('Xtestout')
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
323 call assert_equal(['Xerrors',
16823
b1b7c7a31679 patch 8.1.1413: error when the drive of the swap file was disconnected
Bram Moolenaar <Bram@vim.org>
parents: 16720
diff changeset
324 \ '[0, 208, 5, 0]',
b1b7c7a31679 patch 8.1.1413: error when the drive of the swap file was disconnected
Bram Moolenaar <Bram@vim.org>
parents: 16720
diff changeset
325 \ source_file . "|208 col 5| 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
326 \ lines)
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
327 endif
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
328
19906
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
329 " 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
330 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
331 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
332
15284
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
333 call delete('Xtestout')
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
334 call delete('Xerrors')
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
335 endfunc
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
336
14810
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
337 " 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
338 " 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
339 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
340 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
341 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
342 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
343 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
344 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
345 endif
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
346
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
347 call delete('Xverbosefile')
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
348 endfunc
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
349
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
350 " 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
351 " -m resets 'write'
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
352 " -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
353 " -R sets 'readonly'
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
354 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
355 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
356 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
357 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
358 [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
359
14810
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
360 if RunVim([], after, '')
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
361 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
362 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
363 endif
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
364 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
365 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
366 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
367 endif
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
368 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
369 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
370 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
371 endif
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, '-R')
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', '1', '10000'], 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
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
377 call delete('Xtestout')
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
378 endfunc
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
379
14788
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
380 " Test the -A, -F and -H arguments (Arabic, Farsi and Hebrew modes).
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
381 func Test_A_F_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
382 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
383 call writefile([&rightleft, &arabic, &fkmap, &hkmap], "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
384 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
385 [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
386
14794
9be43810b5ec patch 8.1.0409: startup test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14788
diff changeset
387 " 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
388 " '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
389 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
390 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
391 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
392 endif
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
393
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
394 if has('farsi') && RunVim([], after, '-F')
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
395 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
396 call assert_equal(['1', '0', '1', '0'], lines)
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
397 endif
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
398
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
399 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
400 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
401 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
402 endif
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
403
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
404 call delete('Xtestout')
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
405 endfunc
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
406
16578
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
407 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
408 " 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
409 CheckUnix
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
410 CheckNotGui
16578
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
411
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
412 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
413 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
414 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
415 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
416 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
417 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
418 endfor
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
419
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
420 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
421 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
422 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
423 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
424 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
425 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
426 endfor
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
427
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
428 if has('clientserver')
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
429 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
430 \ '--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
431 \ '--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
432 \ '--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
433 \ '--servername',
16578
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
434 \ ]
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
435 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
436 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
437 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
438 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
439 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
440 endfor
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
441 endif
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
442
16588
c56fe1427025 patch 8.1.1297: invalid argument test fails without GTK
Bram Moolenaar <Bram@vim.org>
parents: 16586
diff changeset
443 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
444 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
445 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
446 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
447 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
448 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
449 endif
16578
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
450
16590
5c212dd3cd64 patch 8.1.1298: invalid argument test fails without X clipboard
Bram Moolenaar <Bram@vim.org>
parents: 16588
diff changeset
451 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
452 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
453 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
454 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
455 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
456 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
457 endif
c56fe1427025 patch 8.1.1297: invalid argument test fails without GTK
Bram Moolenaar <Bram@vim.org>
parents: 16586
diff changeset
458
16578
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
459 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
460 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
461 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
462 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
463 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
464
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
465 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
466 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
467 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
468 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
469 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
470
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18477
diff changeset
471 if has('quickfix')
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18477
diff changeset
472 " Detect invalid repeated arguments '-t foo -t foo", '-q foo -q foo'.
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18477
diff changeset
473 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
474 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
475 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
476 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
477 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
478 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
479 endfor
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18477
diff changeset
480 endif
16578
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
481
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
482 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
483 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
484 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
485 " 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
486 " -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
487 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
488 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
489 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
490 endfor
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
491
16586
5ebb2c87d1f5 patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents: 16578
diff changeset
492 if has('gui_gtk')
5ebb2c87d1f5 patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents: 16578
diff changeset
493 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
494 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
495 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
496 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
497 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
498 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
499 endfor
5ebb2c87d1f5 patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents: 16578
diff changeset
500 endif
16578
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
501 endfunc
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
502
9804
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
503 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
504 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
505 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
506 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
507 [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
508
9804
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
509 if RunVim([], after, '')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
510 let lines = readfile('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
511 call assert_equal(0, len(lines))
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
512 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
513
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
514 if RunVim([], after, 'one')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
515 let lines = readfile('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
516 call assert_equal(1, len(lines))
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
517 call assert_equal('one', lines[0])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
518 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
519
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
520 if RunVim([], after, 'one two three')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
521 let lines = readfile('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
522 call assert_equal(3, len(lines))
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
523 call assert_equal('one', lines[0])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
524 call assert_equal('two', lines[1])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
525 call assert_equal('three', lines[2])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
526 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
527
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
528 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
529 let lines = readfile('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
530 call assert_equal(2, len(lines))
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
531 call assert_equal('one', lines[0])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
532 call assert_equal('two', lines[1])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
533 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
534
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
535 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
536 let lines = readfile('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
537 call assert_equal(4, len(lines))
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
538 call assert_equal('one', lines[0])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
539 call assert_equal('-c', lines[1])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
540 call assert_equal('echo', lines[2])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
541 call assert_equal('two', lines[3])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
542 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
543
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
544 call delete('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
545 endfunc
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
546
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
547 func Test_startuptime()
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
548 if !has('startuptime')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
549 return
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
550 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
551 let after = ['qall']
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
552 if RunVim([], after, '--startuptime Xtestout one')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
553 let lines = readfile('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
554 let expected = ['--- VIM STARTING ---', 'parsing arguments',
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
555 \ '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
556 let found = []
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
557 for line in lines
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
558 for exp in expected
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
559 if line =~ exp
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
560 call add(found, exp)
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
561 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
562 endfor
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
563 endfor
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
564 call assert_equal(expected, found)
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
565 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
566 call delete('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
567 endfunc
9806
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
568
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
569 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
570 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
571 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
572 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
573 [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
574
9806
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
575 if RunVimPiped([], after, '-', 'echo something | ')
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
576 let lines = readfile('Xtestout')
9808
0470742f7346 commit https://github.com/vim/vim/commit/e4a76ad0e74a31bbd9f1b1ac5b816d714d19a412
Christian Brabandt <cb@256bit.org>
parents: 9806
diff changeset
577 " 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
578 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
579 endif
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
580 call delete('Xtestout')
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
581 endfunc
11032
516391d8865f patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
582
13162
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
583 func Test_set_shell()
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
584 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
585 call writefile([&shell], "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
586 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
587 [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
588
18241
85160a3649b9 patch 8.1.2115: MS-Windows: shell commands fail if &shell contains a space
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
589 if has('win32')
85160a3649b9 patch 8.1.2115: MS-Windows: shell commands fail if &shell contains a space
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
590 let $SHELL = 'C:\with space\cmd.exe'
85160a3649b9 patch 8.1.2115: MS-Windows: shell commands fail if &shell contains a space
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
591 let expected = '"C:\with space\cmd.exe"'
85160a3649b9 patch 8.1.2115: MS-Windows: shell commands fail if &shell contains a space
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
592 else
85160a3649b9 patch 8.1.2115: MS-Windows: shell commands fail if &shell contains a space
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
593 let $SHELL = '/bin/with space/sh'
85160a3649b9 patch 8.1.2115: MS-Windows: shell commands fail if &shell contains a space
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
594 let expected = '/bin/with\ space/sh'
85160a3649b9 patch 8.1.2115: MS-Windows: shell commands fail if &shell contains a space
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
595 endif
85160a3649b9 patch 8.1.2115: MS-Windows: shell commands fail if &shell contains a space
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
596
13162
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
597 if RunVimPiped([], after, '', '')
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
598 let lines = readfile('Xtestout')
18241
85160a3649b9 patch 8.1.2115: MS-Windows: shell commands fail if &shell contains a space
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
599 call assert_equal(expected, lines[0])
13162
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
600 endif
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
601 call delete('Xtestout')
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
602 endfunc
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
603
11032
516391d8865f patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
604 func Test_progpath()
516391d8865f patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
605 " 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
606 " 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
607 if has('unix')
516391d8865f patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
608 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
609 elseif has('win32')
516391d8865f patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
610 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
611 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
612 endif
516391d8865f patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
613
516391d8865f patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
614 " 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
615 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
616 endfunc
11258
84f71a8a5f2c patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents: 11032
diff changeset
617
84f71a8a5f2c patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents: 11032
diff changeset
618 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
619 " 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
620 CheckUnix
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
621 CheckNotGui
11258
84f71a8a5f2c patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents: 11032
diff changeset
622
84f71a8a5f2c patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents: 11032
diff changeset
623 " 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
624 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
625 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
626 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
627
3bcdfad55b19 patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents: 11258
diff changeset
628 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
629 " 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
630 CheckUnix
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
631 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
632
3bcdfad55b19 patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents: 11258
diff changeset
633 let save_term = $TERM
11307
6e1c19d3de03 patch 8.0.0539: startup test fails on Mac
Christian Brabandt <cb@256bit.org>
parents: 11305
diff changeset
634 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
635 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
636 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
637 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
638 endfunc
12545
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
639
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
640 func Test_zzz_startinsert()
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
641 " Test :startinsert
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
642 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
643 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
644 :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
645 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
646 [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
647
12545
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
648 if RunVim([], after, 'Xtestout')
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
649 let lines = readfile('Xtestout')
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
650 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
651 endif
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
652 " Test :startinsert!
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
653 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
654 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
655 :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
656 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
657 [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
658
12545
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
659 if RunVim([], after, 'Xtestout')
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
660 let lines = readfile('Xtestout')
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
661 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
662 endif
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
663 call delete('Xtestout')
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
664 endfunc
15926
ca0a0b64809c patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents: 15284
diff changeset
665
ca0a0b64809c patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents: 15284
diff changeset
666 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
667 " 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
668 CheckNotGui
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17178
diff changeset
669
15926
ca0a0b64809c patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents: 15284
diff changeset
670 " 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
671 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
672 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
673 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
674
bb0f7cb7e2d5 patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15926
diff changeset
675 func 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
676 if !CanRunVimInTerminal()
16965
ba7727889385 patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents: 16823
diff changeset
677 throw 'Skipped: cannot make screendumps'
16385
bb0f7cb7e2d5 patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15926
diff changeset
678 endif
bb0f7cb7e2d5 patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15926
diff changeset
679
bb0f7cb7e2d5 patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15926
diff changeset
680 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
681 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
682
bb0f7cb7e2d5 patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15926
diff changeset
683 " 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
684 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
685 endfunc
18477
e93cab5d0f0f patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents: 18241
diff changeset
686
e93cab5d0f0f patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents: 18241
diff changeset
687 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
688 " 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
689 CheckNotGui
e93cab5d0f0f patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents: 18241
diff changeset
690
e93cab5d0f0f patch 8.1.2233: cannot get the Vim command line arguments
Bram Moolenaar <Bram@vim.org>
parents: 18241
diff changeset
691 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
692 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
693 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
694 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
695 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
696 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
697 endfunc
19906
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
698
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
699 " 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
700 func Test_r_arg()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
701 " 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
702 CheckNotGui
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
703 CheckUnix
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
704 CheckEnglish
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
705 let cmd = GetVimCommand()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
706 " 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
707 let expected =<< trim END
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
708 Swap files found:.*
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
709 In current directory:.*
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
710 In directory \~/tmp:.*
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
711 In directory /var/tmp:.*
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
712 In directory /tmp:.*
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
713 END
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
714 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
715 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
716
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
717 " 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
718 func Test_t_arg()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
719 let before =<< trim [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
720 set tags=Xtags
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
721 [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
722 let after =<< trim [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
723 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
724 call writefile([s], "Xtestout")
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
725 qall
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
726 [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
727
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
728 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
729 \ "first\tXfile1\t/^ \\zsfirst$/",
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
730 \ "second\tXfile1\t/^ \\zssecond$/",
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
731 \ "third\tXfile1\t/^ \\zsthird$/"],
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
732 \ 'Xtags')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
733 call writefile([' first', ' second', ' third'], 'Xfile1')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
734
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
735 if RunVim(before, after, '-t second')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
736 call assert_equal(['Xfile1:L2C5'], readfile('Xtestout'))
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
737 call delete('Xtestout')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
738 endif
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
739
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
740 call delete('Xtags')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
741 call delete('Xfile1')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
742 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
743
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
744 " 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
745 func Test_start_insertmode()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
746 let before =<< trim [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
747 set insertmode
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
748 [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
749 let after =<< trim [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
750 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
751 qall
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
752 [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
753 if RunVim(before, after, '')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
754 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
755 call delete('Xtestout')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
756 endif
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
757 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
758
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
759 " 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
760 func Test_b_arg()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
761 let after =<< trim [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
762 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
763 qall
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
764 [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
765 if RunVim([], after, '-b')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
766 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
767 call delete('Xtestout')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
768 endif
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
769 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
770
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
771 " 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
772 func Test_l_arg()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
773 let after =<< trim [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
774 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
775 call writefile([s], 'Xtestout')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
776 qall
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
777 [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
778 if RunVim([], after, '-l')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
779 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
780 call delete('Xtestout')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
781 endif
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
782 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
783
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
784 " 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
785 func Test_missing_vimrc()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
786 if !CanRunVimInTerminal()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
787 throw 'Skipped: cannot run vim in terminal'
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
788 endif
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
789 let after =<< trim [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
790 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
791 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
792 [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
793 call writefile(after, 'Xafter')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
794
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
795 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
796 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
797 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
798 call TermWait(buf)
19906
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
799 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
800 call TermWait(buf)
19906
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
801 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
802 call StopVimInTerminal(buf)
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
803 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
804 call delete('Xafter')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
805 call delete('Xtestout')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
806 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
807
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
808 " 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
809 func Test_VIMINIT()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
810 let after =<< trim [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
811 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
812 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
813 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
814 qall
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
815 [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
816 call writefile(after, 'Xafter')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
817 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
818 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
819 exe "silent !" . cmd
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
820 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
821 call delete('Xtestout')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
822 call delete('Xafter')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
823 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
824
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
825 " 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
826 func Test_EXINIT()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
827 let after =<< trim [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
828 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
829 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
830 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
831 qall
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
832 [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
833 call writefile(after, 'Xafter')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
834 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
835 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
836 exe "silent !" . cmd
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
837 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
838 call delete('Xtestout')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
839 call delete('Xafter')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
840 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
841
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
842 " 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
843 func Test_exrc()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
844 let after =<< trim [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
845 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
846 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
847 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
848 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
849 qall
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
850 [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
851 call mkdir('Xdir')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
852 call writefile(['let exrc_found=37'], 'Xdir/.exrc')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
853 call writefile(after, 'Xdir/Xafter')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
854 let cmd = GetVimProg() . ' --not-a-term -S Xafter --cmd "cd Xdir" --cmd "set enc=utf8 exrc secure"'
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
855 exe "silent !" . cmd
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
856 call assert_equal([], readfile('Xdir/Xtestout'))
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
857 call delete('Xdir', 'rf')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
858 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
859
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
860 " 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
861 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
862 " 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
863 CheckNotGui
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
864 CheckUnix
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
865 CheckEnglish
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
866 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
867 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
868 \ '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
869 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
870
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
871 " 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
872 func Test_w_arg()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
873 " 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
874 CheckNotGui
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
875 call writefile(["iVim Editor\<Esc>:q!\<CR>"], 'Xscriptin', 'b')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
876 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
877 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
878 call delete('Xscriptout')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
879 endif
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
880 call delete('Xscriptin')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
881
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
882 " 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
883 " the language is English.
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
884 if v:lang == "C" || v:lang =~ '^[Ee]n'
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
885 call mkdir("Xdir")
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
886 let m = system(GetVimCommand() .. " -w Xdir")
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
887 call assert_equal("Cannot open for script output: \"Xdir\"\n", m)
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
888 call delete("Xdir", 'rf')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
889 endif
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
890 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
891
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
892 " 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
893 func Test_s_arg()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
894 " 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
895 CheckNotGui
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
896 CheckEnglish
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
897 " 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
898 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
899 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
900
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
901 call writefile([], 'Xinput')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
902 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
903 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
904 call delete('Xinput')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
905 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
906
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
907 " 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
908 func Test_n_arg()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
909 let after =<< trim [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
910 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
911 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
912 qall
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
913 [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
914 if RunVim([], after, '-n')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
915 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
916 call delete('Xtestout')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
917 endif
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
918 call delete('Xafter')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
919 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
920
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
921 " 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
922 func Test_h_arg()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
923 " 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
924 CheckNotGui
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
925 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
926 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
927 let l = systemlist(GetVimProg() .. ' -?')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
928 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
929 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
930
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
931 " 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
932 func Test_F_arg()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
933 " 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
934 CheckNotGui
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
935 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
936 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
937 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
938
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
939 " 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
940 func Test_E_arg()
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
941 let after =<< trim [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
942 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
943 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
944 qall
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
945 [CODE]
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
946 if RunVim([], after, '-E')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
947 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
948 call delete('Xtestout')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
949 endif
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
950 call delete('Xafter')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
951 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
952
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
953 " 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
954 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
955 " 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
956 CheckNotGui
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
957 CheckEnglish
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
958 let l = systemlist(GetVimProg() .. ' - -')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
959 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
960 endfunc
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
961
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
962 " vim: shiftwidth=2 sts=2 expandtab