annotate src/testdir/test_startup.vim @ 16590:5c212dd3cd64 v8.1.1298

patch 8.1.1298: invalid argument test fails without X clipboard commit https://github.com/vim/vim/commit/5416b75031138182387399f8fe5e17a884414e1a Author: Bram Moolenaar <Bram@vim.org> Date: Wed May 8 18:36:43 2019 +0200 patch 8.1.1298: invalid argument test fails without X clipboard Problem: Invalid argument test fails without X clipboard. Solution: Test -display only with the +xterm_clipboard feature.
author Bram Moolenaar <Bram@vim.org>
date Wed, 08 May 2019 18:45:05 +0200
parents c56fe1427025
children 9c90cf08cfa8
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
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
5
9678
8c9e13109df8 commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 " Check that loading startup.vim works.
8c9e13109df8 commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func Test_startup_script()
8c9e13109df8 commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 set compatible
8c9e13109df8 commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 source $VIMRUNTIME/defaults.vim
8c9e13109df8 commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
8c9e13109df8 commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 call assert_equal(0, &compatible)
8c9e13109df8 commit https://github.com/vim/vim/commit/b9a46fec3e79d1fc8c406084a41733c647a5e535
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 endfunc
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
13
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
14 " 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
15 " 1. plugins in non-after directories
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
16 " 2. packages
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
17 " 3. plugins in after directories
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
18 func Test_after_comes_later()
9782
d6a69f968249 commit https://github.com/vim/vim/commit/328604307ba26e3182eb0b096e820f9cd346c2dd
Christian Brabandt <cb@256bit.org>
parents: 9780
diff changeset
19 if !has('packages')
d6a69f968249 commit https://github.com/vim/vim/commit/328604307ba26e3182eb0b096e820f9cd346c2dd
Christian Brabandt <cb@256bit.org>
parents: 9780
diff changeset
20 return
d6a69f968249 commit https://github.com/vim/vim/commit/328604307ba26e3182eb0b096e820f9cd346c2dd
Christian Brabandt <cb@256bit.org>
parents: 9780
diff changeset
21 endif
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
22 let before = [
9788
3fdf6caf42f7 commit https://github.com/vim/vim/commit/446cce6d537b036467033975a86729dbdc83f860
Christian Brabandt <cb@256bit.org>
parents: 9782
diff changeset
23 \ 'set nocp viminfo+=nviminfo',
3fdf6caf42f7 commit https://github.com/vim/vim/commit/446cce6d537b036467033975a86729dbdc83f860
Christian Brabandt <cb@256bit.org>
parents: 9782
diff changeset
24 \ 'set guioptions+=M',
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
25 \ 'let $HOME = "/does/not/exist"',
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
26 \ 'set loadplugins',
11595
42cd59477698 patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents: 11457
diff changeset
27 \ 'set rtp=Xhere,Xafter,Xanother',
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
28 \ 'set packpath=Xhere,Xafter',
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
29 \ 'set nomore',
11595
42cd59477698 patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents: 11457
diff changeset
30 \ 'let g:sequence = ""',
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
31 \ ]
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
32 let after = [
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
33 \ 'redir! > Xtestout',
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
34 \ 'scriptnames',
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
35 \ 'redir END',
11595
42cd59477698 patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents: 11457
diff changeset
36 \ 'redir! > Xsequence',
42cd59477698 patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents: 11457
diff changeset
37 \ 'echo g:sequence',
42cd59477698 patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents: 11457
diff changeset
38 \ 'redir END',
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
39 \ 'quit',
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
40 \ ]
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
41 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
42 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
43 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
44 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
45 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
46 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
47
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
48 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
49 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
50
9794
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
51 if RunVim(before, after, '')
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
52
9780
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
53 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
54 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
55 let found = []
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
56 for line in lines
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
57 for one in expected
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
58 if line =~ one
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
59 call add(found, one)
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
60 endif
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
61 endfor
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
62 endfor
9780
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
63 call assert_equal(expected, found)
103ad8a18ebc commit https://github.com/vim/vim/commit/83b3c3d8a0fa1afed06c13163b9f72c0925f2a61
Christian Brabandt <cb@256bit.org>
parents: 9778
diff changeset
64 endif
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
65
11595
42cd59477698 patch 8.0.0680: plugins in start packages are sourced twice
Christian Brabandt <cb@256bit.org>
parents: 11457
diff changeset
66 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
67
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
68 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
69 call delete('Xsequence')
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
70 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
71 call delete('Xanother', 'rf')
9778
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
72 call delete('Xafter', 'rf')
4360b2b46125 commit https://github.com/vim/vim/commit/66459b7c98c67f8a9d39de8f08e8e8f1fca0e359
Christian Brabandt <cb@256bit.org>
parents: 9678
diff changeset
73 endfunc
9794
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
74
11457
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
75 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
76 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
77 return
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
78 endif
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
79 let before = [
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
80 \ 'set nocp viminfo+=nviminfo',
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
81 \ 'set guioptions+=M',
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
82 \ 'let $HOME = "/does/not/exist"',
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
83 \ 'set loadplugins',
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
84 \ 'set rtp=Xhere',
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
85 \ 'set packpath=Xhere',
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
86 \ 'set nomore',
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
87 \ ]
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
88 let after = [
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
89 \ 'quit',
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
90 \ ]
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
91 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
92 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
93 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
94 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
95
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
96 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
97
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
98 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
99 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
100 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
101 endif
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
102
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
103 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
104 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
105 endfunc
5a1656d79707 patch 8.0.0612: pack dirs are added to 'runtimepath' too late
Christian Brabandt <cb@256bit.org>
parents: 11307
diff changeset
106
9794
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
107 func Test_help_arg()
9796
1f1ed7959860 commit https://github.com/vim/vim/commit/3321e9d8a36c91c62d8ba3d43430b5c213b87f8b
Christian Brabandt <cb@256bit.org>
parents: 9794
diff changeset
108 if !has('unix') && has('gui')
1f1ed7959860 commit https://github.com/vim/vim/commit/3321e9d8a36c91c62d8ba3d43430b5c213b87f8b
Christian Brabandt <cb@256bit.org>
parents: 9794
diff changeset
109 " 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
110 return
1f1ed7959860 commit https://github.com/vim/vim/commit/3321e9d8a36c91c62d8ba3d43430b5c213b87f8b
Christian Brabandt <cb@256bit.org>
parents: 9794
diff changeset
111 endif
9794
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
112 if RunVim([], [], '--help >Xtestout')
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
113 let lines = readfile('Xtestout')
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
114 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
115 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
116
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
117 " 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
118 let found = []
9794
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
119 for line in lines
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
120 if line =~ '-R.*Readonly mode'
9830
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9808
diff changeset
121 call add(found, 'Readonly mode')
9794
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
122 endif
9830
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9808
diff changeset
123 " 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
124 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
125 call add(found, "--version")
9794
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
126 endif
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
127 endfor
9830
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9808
diff changeset
128 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
129 endif
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
130 call delete('Xtestout')
fd32f719d34f commit https://github.com/vim/vim/commit/472a0a880a709c027f4b19cfa56c08e78818112d
Christian Brabandt <cb@256bit.org>
parents: 9788
diff changeset
131 endfunc
9804
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
132
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
133 func Test_compatible_args()
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
134 let after = [
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
135 \ 'call writefile([string(&compatible)], "Xtestout")',
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
136 \ 'set viminfo+=nviminfo',
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
137 \ 'quit',
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
138 \ ]
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
139 if RunVim([], after, '-C')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
140 let lines = readfile('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
141 call assert_equal('1', lines[0])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
142 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
143
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
144 if RunVim([], after, '-N')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
145 let lines = readfile('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
146 call assert_equal('0', lines[0])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
147 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
148
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
149 call delete('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
150 endfunc
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
151
14772
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
152 " Test the -o[N] and -O[N] arguments to open N windows split
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
153 " horizontally or vertically.
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
154 func Test_o_arg()
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
155 let after = [
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
156 \ 'call writefile([winnr("$"),
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
157 \ winheight(1), winheight(2), &lines,
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
158 \ winwidth(1), winwidth(2), &columns,
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
159 \ bufname(winbufnr(1)), bufname(winbufnr(2))],
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
160 \ "Xtestout")',
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
161 \ 'qall',
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
162 \ ]
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
163 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
164 " 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
165 " - 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
166 " - 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
167 " - 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
168 " 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
169 " - 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
170 " 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
171 " - 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
172 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
173 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
174 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
175 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
176 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
177 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
178 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
179 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
180 endif
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
181
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
182 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
183 " 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
184 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
185 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
186 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
187 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
188 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
189 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
190 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
191 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
192 endif
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
193
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
194 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
195 " 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
196 " - 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
197 " - 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
198 " - 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
199 " 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
200 " - 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
201 " - 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
202 " 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
203 " - 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
204 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
205 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
206 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
207 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
208 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
209 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
210 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
211 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
212 endif
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
213
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
214 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
215 " 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
216 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
217 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
218 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
219 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
220 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
221 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
222 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
223 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
224 endif
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
225
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
226 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
227 endfunc
66e241c3a2f0 patch 8.1.0398: no test for -o and -O command line arguments
Christian Brabandt <cb@256bit.org>
parents: 13162
diff changeset
228
14788
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
229 " 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
230 func Test_p_arg()
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
231 let after = [
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
232 \ 'call writefile(split(execute("tabs"), "\n"), "Xtestout")',
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
233 \ 'qall',
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
234 \ ]
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
235 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
236 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
237 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
238 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
239 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
240 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
241 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
242 endif
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
243
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
244 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
245 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
246 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
247 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
248 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
249 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
250 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
251 endif
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
252
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
253 call delete('Xtestout')
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
254 endfunc
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
255
14794
9be43810b5ec patch 8.1.0409: startup test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14788
diff changeset
256 " 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
257 func Test_V_arg()
14794
9be43810b5ec patch 8.1.0409: startup test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14788
diff changeset
258 if has('gui_running')
9be43810b5ec patch 8.1.0409: startup test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14788
diff changeset
259 " Can't catch the output of gvim.
9be43810b5ec patch 8.1.0409: startup test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14788
diff changeset
260 return
9be43810b5ec patch 8.1.0409: startup test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14788
diff changeset
261 endif
14788
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
262 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
263 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
264
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
265 let out = system(GetVimCommand() . ' --clean -es -X -V2 -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
266 call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nSearching for \"filetype\.vim\".*\n", out)
9be43810b5ec patch 8.1.0409: startup test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14788
diff changeset
267 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
268
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
269 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
270 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
271 endfunc
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
272
15284
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
273 " 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
274 func Test_q_arg()
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
275 let source_file = has('win32') ? '..\memfile.c' : '../memfile.c'
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
276 let after = [
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
277 \ 'call writefile([&errorfile, string(getpos("."))], "Xtestout")',
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
278 \ 'copen',
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
279 \ 'w >> Xtestout',
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
280 \ 'qall'
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
281 \ ]
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
282
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
283 " 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
284 call assert_equal('errors.err', &errorfile)
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
285 call writefile(["../memfile.c:1482:5: error: expected ';' before '}' token"], 'errors.err')
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
286 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
287 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
288 call assert_equal(['errors.err',
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
289 \ '[0, 1482, 5, 0]',
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
290 \ source_file . "|1482 col 5| error: expected ';' before '}' token"],
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
291 \ lines)
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
292 endif
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
293 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
294 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
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 explicit argument '-q Xerrors' (with space).
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
297 call writefile(["../memfile.c:1482:5: error: expected ';' before '}' token"], 'Xerrors')
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
298 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
299 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
300 call assert_equal(['Xerrors',
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
301 \ '[0, 1482, 5, 0]',
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
302 \ source_file . "|1482 col 5| error: expected ';' before '}' token"],
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
303 \ lines)
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
304 endif
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
305 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
306
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
307 " 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
308 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
309 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
310 call assert_equal(['Xerrors',
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
311 \ '[0, 1482, 5, 0]',
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
312 \ source_file . "|1482 col 5| error: expected ';' before '}' token"],
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
313 \ lines)
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
314 endif
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
315
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
316 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
317 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
318 endfunc
c31e4b1fa4fd patch 8.1.0650: command line argument -q [errorfile] is not tested
Bram Moolenaar <Bram@vim.org>
parents: 14828
diff changeset
319
14810
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
320 " 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
321 " 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
322 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
323 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
324 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
325 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
326 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
327 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
328 endif
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
329
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
330 call delete('Xverbosefile')
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
331 endfunc
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
332
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
333 " 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
334 " -m resets 'write'
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
335 " -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
336 " -R sets 'readonly'
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
337 func Test_m_M_R()
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
338 let after = [
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
339 \ 'call writefile([&write, &modifiable, &readonly, &updatecount], "Xtestout")',
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
340 \ 'qall',
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
341 \ ]
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
342 if RunVim([], after, '')
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
343 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
344 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
345 endif
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
346 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
347 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
348 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
349 endif
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
350 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
351 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
352 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
353 endif
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
354 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
355 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
356 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
357 endif
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
358
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
359 call delete('Xtestout')
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
360 endfunc
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
361
14788
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
362 " 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
363 func Test_A_F_H_arg()
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
364 let after = [
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
365 \ 'call writefile([&rightleft, &arabic, &fkmap, &hkmap], "Xtestout")',
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
366 \ 'qall',
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
367 \ ]
14794
9be43810b5ec patch 8.1.0409: startup test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14788
diff changeset
368 " 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
369 " '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
370 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
371 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
372 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
373 endif
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
374
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
375 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
376 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
377 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
378 endif
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
379
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
380 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
381 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
382 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
383 endif
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
384
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
385 call delete('Xtestout')
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
386 endfunc
0aff6e5f3d55 patch 8.1.0406: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14772
diff changeset
387
16578
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
388 func Test_invalid_args()
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
389 if !has('unix') || has('gui_running')
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
390 " can't get output of Vim.
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
391 return
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
392 endif
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
393
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
394 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
395 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
396 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
397 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
398 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
399 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
400 endfor
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
401
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
402 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
403 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
404 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
405 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
406 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
407 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
408 endfor
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
409
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
410 if has('clientserver')
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
411 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
412 \ '--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
413 \ '--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
414 \ '--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
415 \ '--servername',
16578
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
416 \ ]
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
417 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
418 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
419 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
420 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
421 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
422 endfor
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
423 endif
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
424
16588
c56fe1427025 patch 8.1.1297: invalid argument test fails without GTK
Bram Moolenaar <Bram@vim.org>
parents: 16586
diff changeset
425 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
426 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
427 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
428 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
429 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
430 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
431 endif
16578
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
432
16590
5c212dd3cd64 patch 8.1.1298: invalid argument test fails without X clipboard
Bram Moolenaar <Bram@vim.org>
parents: 16588
diff changeset
433 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
434 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
435 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
436 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
437 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
438 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
439 endif
c56fe1427025 patch 8.1.1297: invalid argument test fails without GTK
Bram Moolenaar <Bram@vim.org>
parents: 16586
diff changeset
440
16578
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
441 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
442 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
443 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
444 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
445 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
446
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
447 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
448 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
449 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
450 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
451 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
452
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
453 " Detect invalid repeated arguments '-t foo -t foo", '-q foo -q foo'.
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
454 for opt in ['-t', '-q']
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
455 let out = split(system(GetVimCommand() .. repeat(' ' .. opt .. ' foo', 2)), "\n")
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
456 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
457 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
458 call assert_equal('Too many edit arguments: "' .. opt .. '"', out[1])
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
459 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
460 endfor
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
461
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
462 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
463 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
464 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
465 " 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
466 " -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
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 "+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
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 endfor
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
471
16586
5ebb2c87d1f5 patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents: 16578
diff changeset
472 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
473 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
474 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
475 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
476 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
477 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
478 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
479 endfor
5ebb2c87d1f5 patch 8.1.1296: crash when using invalid command line argument
Bram Moolenaar <Bram@vim.org>
parents: 16578
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 endfunc
5726af4931e3 patch 8.1.1292: invalid command line arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 16385
diff changeset
482
9804
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
483 func Test_file_args()
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
484 let after = [
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
485 \ 'call writefile(argv(), "Xtestout")',
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
486 \ 'qall',
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
487 \ ]
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
488 if RunVim([], after, '')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
489 let lines = readfile('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
490 call assert_equal(0, len(lines))
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
491 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
492
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
493 if RunVim([], after, 'one')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
494 let lines = readfile('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
495 call assert_equal(1, len(lines))
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
496 call assert_equal('one', lines[0])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
497 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
498
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
499 if RunVim([], after, 'one two three')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
500 let lines = readfile('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
501 call assert_equal(3, len(lines))
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
502 call assert_equal('one', lines[0])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
503 call assert_equal('two', lines[1])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
504 call assert_equal('three', lines[2])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
505 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
506
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
507 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
508 let lines = readfile('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
509 call assert_equal(2, len(lines))
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
510 call assert_equal('one', lines[0])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
511 call assert_equal('two', lines[1])
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 -- -c echo two')
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(4, 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 call assert_equal('-c', lines[1])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
519 call assert_equal('echo', lines[2])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
520 call assert_equal('two', lines[3])
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
521 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
522
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
523 call delete('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
524 endfunc
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
525
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
526 func Test_startuptime()
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
527 if !has('startuptime')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
528 return
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
529 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
530 let after = ['qall']
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
531 if RunVim([], after, '--startuptime Xtestout one')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
532 let lines = readfile('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
533 let expected = ['--- VIM STARTING ---', 'parsing arguments',
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
534 \ '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
535 let found = []
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
536 for line in lines
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
537 for exp in expected
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
538 if line =~ exp
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
539 call add(found, exp)
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
540 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
541 endfor
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
542 endfor
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
543 call assert_equal(expected, found)
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
544 endif
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
545 call delete('Xtestout')
4ef933b816e7 commit https://github.com/vim/vim/commit/ba98bef1910094179bf90b9467b6e2d2f9462601
Christian Brabandt <cb@256bit.org>
parents: 9796
diff changeset
546 endfunc
9806
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
547
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
548 func Test_read_stdin()
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
549 let after = [
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
550 \ 'write Xtestout',
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
551 \ 'quit!',
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
552 \ ]
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
553 if RunVimPiped([], after, '-', 'echo something | ')
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
554 let lines = readfile('Xtestout')
9808
0470742f7346 commit https://github.com/vim/vim/commit/e4a76ad0e74a31bbd9f1b1ac5b816d714d19a412
Christian Brabandt <cb@256bit.org>
parents: 9806
diff changeset
555 " 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
556 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
557 endif
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
558 call delete('Xtestout')
108b62925cb0 commit https://github.com/vim/vim/commit/3a938383396d4ab352bbb4d806938302debdae2c
Christian Brabandt <cb@256bit.org>
parents: 9804
diff changeset
559 endfunc
11032
516391d8865f patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
560
13162
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
561 func Test_set_shell()
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
562 let after = [
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
563 \ 'call writefile([&shell], "Xtestout")',
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
564 \ 'quit!',
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
565 \ ]
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
566 let $SHELL = '/bin/with space/sh'
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
567 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
568 let lines = readfile('Xtestout')
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
569 " MS-Windows adds a space after the word
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
570 call assert_equal('/bin/with\ space/sh', lines[0])
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
571 endif
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
572 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
573 endfunc
51521b8a370c patch 8.0.1455: if $SHELL contains a space then 'shell' is incorrect
Christian Brabandt <cb@256bit.org>
parents: 12545
diff changeset
574
11032
516391d8865f patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
575 func Test_progpath()
516391d8865f patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
576 " 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
577 " 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
578 if has('unix')
516391d8865f patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
579 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
580 elseif has('win32')
516391d8865f patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
581 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
582 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
583 endif
516391d8865f patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
584
516391d8865f patch 8.0.0405: v:progpath may become invalid after :cd
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
585 " 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
586 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
587 endfunc
11258
84f71a8a5f2c patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents: 11032
diff changeset
588
84f71a8a5f2c patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents: 11032
diff changeset
589 func Test_silent_ex_mode()
84f71a8a5f2c patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents: 11032
diff changeset
590 if !has('unix') || has('gui_running')
84f71a8a5f2c patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents: 11032
diff changeset
591 " can't get output of Vim.
84f71a8a5f2c patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents: 11032
diff changeset
592 return
84f71a8a5f2c patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents: 11032
diff changeset
593 endif
84f71a8a5f2c patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents: 11032
diff changeset
594
84f71a8a5f2c patch 8.0.0515: ml_get errors in silent Ex mode
Christian Brabandt <cb@256bit.org>
parents: 11032
diff changeset
595 " 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
596 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
597 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
598 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
599
3bcdfad55b19 patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents: 11258
diff changeset
600 func Test_default_term()
3bcdfad55b19 patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents: 11258
diff changeset
601 if !has('unix') || has('gui_running')
3bcdfad55b19 patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents: 11258
diff changeset
602 " can't get output of Vim.
3bcdfad55b19 patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents: 11258
diff changeset
603 return
3bcdfad55b19 patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents: 11258
diff changeset
604 endif
3bcdfad55b19 patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents: 11258
diff changeset
605
3bcdfad55b19 patch 8.0.0538: no test for falling back to default term value
Christian Brabandt <cb@256bit.org>
parents: 11258
diff changeset
606 let save_term = $TERM
11307
6e1c19d3de03 patch 8.0.0539: startup test fails on Mac
Christian Brabandt <cb@256bit.org>
parents: 11305
diff changeset
607 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
608 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
609 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
610 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
611 endfunc
12545
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
612
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
613 func Test_zzz_startinsert()
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
614 " Test :startinsert
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
615 call writefile(['123456'], 'Xtestout')
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
616 let after = [
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
617 \ ':startinsert',
14810
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
618 \ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")'
12545
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
619 \ ]
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
620 if RunVim([], after, 'Xtestout')
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
621 let lines = readfile('Xtestout')
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
622 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
623 endif
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
624 " Test :startinsert!
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
625 call writefile(['123456'], 'Xtestout')
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
626 let after = [
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
627 \ ':startinsert!',
14810
d47c8d294d1a patch 8.1.0417: several command line arguments are not tested
Christian Brabandt <cb@256bit.org>
parents: 14794
diff changeset
628 \ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")'
12545
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
629 \ ]
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
630 if RunVim([], after, 'Xtestout')
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
631 let lines = readfile('Xtestout')
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
632 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
633 endif
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
634 call delete('Xtestout')
241fbf588b95 patch 8.0.1151: "vim -c startinsert!" doesn't append
Christian Brabandt <cb@256bit.org>
parents: 11595
diff changeset
635 endfunc
15926
ca0a0b64809c patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents: 15284
diff changeset
636
ca0a0b64809c patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents: 15284
diff changeset
637 func Test_issue_3969()
ca0a0b64809c patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents: 15284
diff changeset
638 if has('gui_running')
ca0a0b64809c patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents: 15284
diff changeset
639 " Can't catch the output of gvim.
ca0a0b64809c patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents: 15284
diff changeset
640 return
ca0a0b64809c patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents: 15284
diff changeset
641 endif
ca0a0b64809c patch 8.1.0969: message written during startup is truncated
Bram Moolenaar <Bram@vim.org>
parents: 15284
diff changeset
642 " 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
643 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
644 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
645 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
646
bb0f7cb7e2d5 patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15926
diff changeset
647 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
648 if !CanRunVimInTerminal()
bb0f7cb7e2d5 patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15926
diff changeset
649 return
bb0f7cb7e2d5 patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15926
diff changeset
650 endif
bb0f7cb7e2d5 patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15926
diff changeset
651
bb0f7cb7e2d5 patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15926
diff changeset
652 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
653 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
654
bb0f7cb7e2d5 patch 8.1.1197: when starting with multiple tabs file messages is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15926
diff changeset
655 " 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
656 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
657 endfunc