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
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0406
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.0406
Problem: Several command line arguments are not tested.
Solution: Add tests for -A, -F, -H, -p and -V. (Dominique Pelle,
closes #3446)
Files: src/testdir/test_startup.vim
*** ../vim-8.1.0405/src/testdir/test_startup.vim 2018-09-16 16:28:08.358268312 +0200
--- src/testdir/test_startup.vim 2018-09-18 22:34:16.977798058 +0200
***************
*** 199,205 ****
" - both windows should have the same height
" - window height (+ 2 for the statusline and Ex command) should be equal
" to the number of lines
! " - buffer of both windowns should have no name
let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout')
call assert_equal('2', wn)
call assert_inrange(0, 1, ww1 - ww2)
--- 199,205 ----
" - both windows should have the same height
" - window height (+ 2 for the statusline and Ex command) should be equal
" to the number of lines
! " - buffer of both windows should have no name
let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout')
call assert_equal('2', wn)
call assert_inrange(0, 1, ww1 - ww2)
***************
*** 223,228 ****
--- 223,291 ----
endif
call delete('Xtestout')
+ endfunc
+
+ " Test the -p[N] argument to open N tabpages.
+ func Test_p_arg()
+ let after = [
+ \ 'call writefile(split(execute("tabs"), "\n"), "Xtestout")',
+ \ 'qall',
+ \ ]
+ if RunVim([], after, '-p2')
+ let lines = readfile('Xtestout')
+ call assert_equal(4, len(lines))
+ call assert_equal('Tab page 1', lines[0])
+ call assert_equal('> [No Name]', lines[1])
+ call assert_equal('Tab page 2', lines[2])
+ call assert_equal(' [No Name]', lines[3])
+ endif
+
+ if RunVim([], after, '-p foo bar')
+ let lines = readfile('Xtestout')
+ call assert_equal(4, len(lines))
+ call assert_equal('Tab page 1', lines[0])
+ call assert_equal('> foo', lines[1])
+ call assert_equal('Tab page 2', lines[2])
+ call assert_equal(' bar', lines[3])
+ endif
+
+ call delete('Xtestout')
+ endfunc
+
+ " Test the -V[N] argument to set the 'version' option to [N]
+ func Test_V_arg()
+ let out = system(GetVimCommand() . ' --clean -es -X -V0 -c "set verbose?" -cq')
+ call assert_equal(" verbose=0\n", out)
+
+ let out = system(GetVimCommand() . ' --clean -es -X -V2 -c "set verbose?" -cq')
+ call assert_match("^sourcing \"$VIMRUNTIME/defaults\.vim\"\r\nSearching for \"filetype\.vim\".*\n verbose=2\n$", out)
+
+ let out = system(GetVimCommand() . ' --clean -es -X -V15 -c "set verbose?" -cq')
+ call assert_match("\+*\nsourcing \"$VIMRUNTIME/defaults\.vim\"\r\nline 1: \" The default vimrc file\..*\n verbose=15\n\+*", out)
+ endfunc
+
+ " Test the -A, -F and -H arguments (Arabic, Farsi and Hebrew modes).
+ func Test_A_F_H_arg()
+ let after = [
+ \ 'call writefile([&rightleft, &arabic, &fkmap, &hkmap], "Xtestout")',
+ \ 'qall',
+ \ ]
+ if has('arabic') && RunVim([], after, '-A')
+ let lines = readfile('Xtestout')
+ call assert_equal(['1', '1', '0', '0'], lines)
+ endif
+
+ if has('farsi') && RunVim([], after, '-F')
+ let lines = readfile('Xtestout')
+ call assert_equal(['1', '0', '1', '0'], lines)
+ endif
+
+ if has('rightleft') && RunVim([], after, '-H')
+ let lines = readfile('Xtestout')
+ call assert_equal(['1', '0', '0', '1'], lines)
+ endif
+
+ call delete('Xtestout')
endfunc
func Test_file_args()
*** ../vim-8.1.0405/src/version.c 2018-09-18 22:29:59.888041388 +0200
--- src/version.c 2018-09-18 22:35:58.352883122 +0200
***************
*** 796,797 ****
--- 796,799 ----
{ /* Add new patch number below this line */
+ /**/
+ 406,
/**/
--
From "know your smileys":
:----} You lie like Pinocchio
/// 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 ///
|