Mercurial > vim
comparison src/testdir/test_man.vim @ 9636:ccbb8e393d80 v7.4.2095
commit https://github.com/vim/vim/commit/61c04493b00f85d0b97436260a9ef9ab82143b78
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 23 15:35:35 2016 +0200
patch 7.4.2095
Problem: Man test fails when run with the GUI.
Solution: Adjust for different behavior of GUI. Add assert_inrange().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 23 Jul 2016 15:45:05 +0200 |
parents | cd9c4bbe1d03 |
children | d2a834aa7cc0 |
comparison
equal
deleted
inserted
replaced
9635:974a40c76e19 | 9636:ccbb8e393d80 |
---|---|
1 runtime ftplugin/man.vim | 1 runtime ftplugin/man.vim |
2 | 2 |
3 function Test_g_ft_man_open_mode() | 3 function Test_g_ft_man_open_mode() |
4 let l:w = winwidth(1) | |
5 vnew | 4 vnew |
6 let l:h = winheight(1) | 5 let l:h = winheight(1) |
7 q | 6 q |
7 let l:w = winwidth(1) | |
8 | 8 |
9 " split horizontally | 9 " split horizontally |
10 let wincnt = winnr('$') | 10 let wincnt = winnr('$') |
11 Man 'vim' | 11 Man vim |
12 if wincnt == winnr('$') | 12 if wincnt == winnr('$') |
13 " Vim manual page cannot be found. | 13 " Vim manual page cannot be found. |
14 return | 14 return |
15 endif | 15 endif |
16 call assert_equal(l:w, winwidth(1)) | 16 |
17 call assert_inrange(l:w - 2, l:w + 2, winwidth(1)) | |
17 call assert_true(l:h > winheight(1)) | 18 call assert_true(l:h > winheight(1)) |
18 call assert_equal(1, tabpagenr('$')) | 19 call assert_equal(1, tabpagenr('$')) |
19 call assert_equal(1, tabpagenr()) | 20 call assert_equal(1, tabpagenr()) |
20 q | 21 q |
21 | 22 |
22 " split horizontally | 23 " split horizontally |
23 let g:ft_man_open_mode = "horz" | 24 let g:ft_man_open_mode = "horz" |
24 Man 'vim' | 25 Man vim |
25 call assert_equal(l:w, winwidth(1)) | 26 call assert_inrange(l:w - 2, l:w + 2, winwidth(1)) |
26 call assert_true(l:h > winheight(1)) | 27 call assert_true(l:h > winheight(1)) |
27 call assert_equal(1, tabpagenr('$')) | 28 call assert_equal(1, tabpagenr('$')) |
28 call assert_equal(1, tabpagenr()) | 29 call assert_equal(1, tabpagenr()) |
29 q | 30 q |
30 | 31 |
31 " split vertically | 32 " split vertically |
32 let g:ft_man_open_mode = "vert" | 33 let g:ft_man_open_mode = "vert" |
33 Man 'vim' | 34 Man vim |
34 call assert_true(l:w > winwidth(1)) | 35 call assert_true(l:w > winwidth(1)) |
35 call assert_equal(l:h, winheight(1)) | 36 call assert_equal(l:h, winheight(1)) |
36 call assert_equal(1, tabpagenr('$')) | 37 call assert_equal(1, tabpagenr('$')) |
37 call assert_equal(1, tabpagenr()) | 38 call assert_equal(1, tabpagenr()) |
38 q | 39 q |
39 | 40 |
40 " separate tab | 41 " separate tab |
41 let g:ft_man_open_mode = "tab" | 42 let g:ft_man_open_mode = "tab" |
42 Man 'vim' | 43 Man vim |
43 call assert_equal(l:w, winwidth(1)) | 44 call assert_inrange(l:w - 2, l:w + 2, winwidth(1)) |
44 call assert_equal(l:h, winheight(1)) | 45 call assert_inrange(l:h - 1, l:h + 1, winheight(1)) |
45 call assert_equal(2, tabpagenr('$')) | 46 call assert_equal(2, tabpagenr('$')) |
46 call assert_equal(2, tabpagenr()) | 47 call assert_equal(2, tabpagenr()) |
47 q | 48 q |
48 endfunction | 49 endfunction |
49 | 50 |
50 function Test_nomodifiable() | 51 function Test_nomodifiable() |
51 let wincnt = winnr('$') | 52 let wincnt = winnr('$') |
52 Man 'vim' | 53 Man vim |
53 if wincnt == winnr('$') | 54 if wincnt == winnr('$') |
54 " Vim manual page cannot be found. | 55 " Vim manual page cannot be found. |
55 return | 56 return |
56 endif | 57 endif |
57 call assert_false(&l:modifiable) | 58 call assert_false(&l:modifiable) |