summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1292
blob: 96bc5047350f18e9479e5a6625cf94f41b6de852 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1292
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.1292
Problem:    Invalid command line arguments not tested.
Solution:   Add a test. (Dominique Pelle, closes #4346)
Files:	    src/testdir/test_startup.vim


*** ../vim-8.1.1291/src/testdir/test_startup.vim	2019-04-21 15:54:29.606587753 +0200
--- src/testdir/test_startup.vim	2019-05-07 22:08:46.442674152 +0200
***************
*** 385,390 ****
--- 385,480 ----
    call delete('Xtestout')
  endfunc
  
+ func Test_invalid_args()
+   if !has('unix') || has('gui_running')
+     " can't get output of Vim.
+     return
+   endif
+ 
+   for opt in ['-Y', '--does-not-exist']
+     let out = split(system(GetVimCommand() .. ' ' .. opt), "\n")
+     call assert_equal(1, v:shell_error)
+     call assert_match('^VIM - Vi IMproved .* (.*)$',              out[0])
+     call assert_equal('Unknown option argument: "' .. opt .. '"', out[1])
+     call assert_equal('More info with: "vim -h"',                 out[2])
+   endfor
+ 
+   for opt in ['-c', '-i', '-s', '-t', '-T', '-u', '-U', '-w', '-W', '--cmd', '--startuptime']
+     let out = split(system(GetVimCommand() .. ' '  .. opt), "\n")
+     call assert_equal(1, v:shell_error)
+     call assert_match('^VIM - Vi IMproved .* (.*)$',             out[0])
+     call assert_equal('Argument missing after: "' .. opt .. '"', out[1])
+     call assert_equal('More info with: "vim -h"',                out[2])
+   endfor
+ 
+   if has('clientserver')
+     " FIXME: need to add --servername to this list
+     " but it causes vim-8.1.1282 to crash!
+     for opt in ['--remote', '--remote-send', '--remote-silent', '--remote-expr',
+           \     '--remote-tab', '--remote-tab-wait',
+           \     '--remote-tab-wait-silent', '--remote-tab-silent',
+           \     '--remote-wait', '--remote-wait-silent',
+           \    ]
+       let out = split(system(GetVimCommand() .. ' '  .. opt), "\n")
+       call assert_equal(1, v:shell_error)
+       call assert_match('^VIM - Vi IMproved .* (.*)$',             out[0])
+       call assert_equal('Argument missing after: "' .. opt .. '"', out[1])
+       call assert_equal('More info with: "vim -h"',                out[2])
+     endfor
+   endif
+ 
+   " FIXME: commented out as this causes vim-8.1.1282 to crash!
+   "if has('clipboard')
+   "  let out = split(system(GetVimCommand() .. ' --display'), "\n")
+   "  call assert_equal(1, v:shell_error)
+   "  call assert_match('^VIM - Vi IMproved .* (.*)$',         out[0])
+   "  call assert_equal('Argument missing after: "--display"', out[1])
+   "  call assert_equal('More info with: "vim -h"',            out[2])
+   "endif
+ 
+   let out = split(system(GetVimCommand() .. ' -ix'), "\n")
+   call assert_equal(1, v:shell_error)
+   call assert_match('^VIM - Vi IMproved .* (.*)$',          out[0])
+   call assert_equal('Garbage after option argument: "-ix"', out[1])
+   call assert_equal('More info with: "vim -h"',             out[2])
+ 
+   let out = split(system(GetVimCommand() .. ' - xxx'), "\n")
+   call assert_equal(1, v:shell_error)
+   call assert_match('^VIM - Vi IMproved .* (.*)$',    out[0])
+   call assert_equal('Too many edit arguments: "xxx"', out[1])
+   call assert_equal('More info with: "vim -h"',       out[2])
+ 
+   " Detect invalid repeated arguments '-t foo -t foo", '-q foo -q foo'.
+   for opt in ['-t', '-q']
+     let out = split(system(GetVimCommand() .. repeat(' ' .. opt .. ' foo', 2)), "\n")
+     call assert_equal(1, v:shell_error)
+     call assert_match('^VIM - Vi IMproved .* (.*)$',              out[0])
+     call assert_equal('Too many edit arguments: "' .. opt .. '"', out[1])
+     call assert_equal('More info with: "vim -h"',                 out[2])
+   endfor
+ 
+   for opt in [' -cq', ' --cmd q', ' +', ' -S foo']
+     let out = split(system(GetVimCommand() .. repeat(opt, 11)), "\n")
+     call assert_equal(1, v:shell_error)
+     " FIXME: The error message given by Vim is not ideal in case of repeated
+     " -S foo since it does not mention -S.
+     call assert_match('^VIM - Vi IMproved .* (.*)$',                                    out[0])
+     call assert_equal('Too many "+command", "-c command" or "--cmd command" arguments', out[1])
+     call assert_equal('More info with: "vim -h"',                                       out[2])
+   endfor
+ 
+   " FIXME: commented out as this causes vim-8.1.1282 to crash!
+   "if has('gui_gtk')
+   "  for opt in ['--socketid x', '--socketid 0xg']
+   "    let out = split(system(GetVimCommand() .. ' ' .. opt), "\n")
+   "    call assert_equal(1, v:shell_error)
+   "    call assert_match('^VIM - Vi IMproved .* (.*)$',        out[0])
+   "    call assert_equal('Invalid argument for: "--socketid"', out[1])
+   "    call assert_equal('More info with: "vim -h"',           out[2])
+   "  endfor
+   "endif
+ endfunc
+ 
  func Test_file_args()
    let after = [
  	\ 'call writefile(argv(), "Xtestout")',
*** ../vim-8.1.1291/src/version.c	2019-05-07 22:06:48.679310672 +0200
--- src/version.c	2019-05-07 22:10:23.630205185 +0200
***************
*** 769,770 ****
--- 769,772 ----
  {   /* Add new patch number below this line */
+ /**/
+     1292,
  /**/

-- 
Dogs must have a permit signed by the mayor in order to congregate in groups
of three or more on private property.
		[real standing law in Oklahoma, United States of America]

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///