summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0398
blob: f30e8260fe604878921ade3b2e308d2f5bd0e3ca (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0398
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.0398
Problem:    No test for -o and -O command line arguments.
Solution:   Add a test. (Dominique Pelle, closes #3438)
Files:	    src/testdir/test_startup.vim


*** ../vim-8.1.0397/src/testdir/test_startup.vim	2018-02-03 15:11:32.000000000 +0100
--- src/testdir/test_startup.vim	2018-09-16 16:26:35.258985223 +0200
***************
*** 148,153 ****
--- 148,230 ----
    call delete('Xtestout')
  endfunc
  
+ " Test the -o[N] and -O[N] arguments to open N windows split
+ " horizontally or vertically.
+ func Test_o_arg()
+   let after = [
+ 	\ 'call writefile([winnr("$"),
+ 	\		   winheight(1), winheight(2), &lines,
+ 	\		   winwidth(1), winwidth(2), &columns,
+ 	\		   bufname(winbufnr(1)), bufname(winbufnr(2))],
+ 	\		   "Xtestout")',
+ 	\ 'qall',
+ 	\ ]
+   if RunVim([], after, '-o2')
+     " Open 2 windows split horizontally. Expect:
+     " - 2 windows
+     " - both windows should have the same or almost the same height
+     " - sum of both windows height (+ 3 for both statusline and Ex command)
+     "   should be equal to the number of lines
+     " - both windows should have the same width which should be equal to the
+     "   number of columns
+     " - 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, wh1 - wh2)
+     call assert_equal(string(wh1 + wh2 + 3), ln)
+     call assert_equal(ww1, ww2)
+     call assert_equal(ww1, cn)
+     call assert_equal('', bn1)
+     call assert_equal('', bn2)
+   endif
+ 
+   if RunVim([], after, '-o foo bar')
+     " Same expectations as for -o2 but buffer names should be foo and bar
+     let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout')
+     call assert_equal('2', wn)
+     call assert_inrange(0, 1, wh1 - wh2)
+     call assert_equal(string(wh1 + wh2 + 3), ln)
+     call assert_equal(ww1, ww2)
+     call assert_equal(ww1, cn)
+     call assert_equal('foo', bn1)
+     call assert_equal('bar', bn2)
+   endif
+ 
+   if RunVim([], after, '-O2')
+     " Open 2 windows split vertically. Expect:
+     " - 2 windows
+     " - both windows should have the same or almost the same width
+     " - sum of both windows width (+ 1 separator) should be equal to the
+     "   number of columns
+     " - 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)
+     call assert_equal(string(ww1 + ww2 + 1), cn)
+     call assert_equal(wh1, wh2)
+     call assert_equal(string(wh1 + 2), ln)
+     call assert_equal('', bn1)
+     call assert_equal('', bn2)
+   endif
+ 
+   if RunVim([], after, '-O foo bar')
+     " Same expectations as for -O2 but buffer names should be foo and bar
+     let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout')
+     call assert_equal('2', wn)
+     call assert_inrange(0, 1, ww1 - ww2)
+     call assert_equal(string(ww1 + ww2 + 1), cn)
+     call assert_equal(wh1, wh2)
+     call assert_equal(string(wh1 + 2), ln)
+     call assert_equal('foo', bn1)
+     call assert_equal('bar', bn2)
+   endif
+ 
+   call delete('Xtestout')
+ endfunc
+ 
  func Test_file_args()
    let after = [
  	\ 'call writefile(argv(), "Xtestout")',
*** ../vim-8.1.0397/src/version.c	2018-09-16 15:47:45.629425398 +0200
--- src/version.c	2018-09-16 16:26:03.503223237 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     398,
  /**/

-- 
"Thou shalt not follow the Null Pointer, for at its end Chaos and
Madness lie."

 /// 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    ///