1" Tests for window cmd (:wincmd, :split, :vsplit, :resize and etc...) 2 3func Test_window_cmd_ls0_with_split() 4 set ls=0 5 set splitbelow 6 split 7 quit 8 call assert_equal(0, &lines - &cmdheight - winheight(0)) 9 new | only! 10 " 11 set splitbelow&vim 12 botright split 13 quit 14 call assert_equal(0, &lines - &cmdheight - winheight(0)) 15 new | only! 16 set ls&vim 17endfunc 18 19func Test_window_cmd_cmdwin_with_vsp() 20 let efmt='Expected 0 but got %d (in ls=%d, %s window)' 21 for v in range(0, 2) 22 exec "set ls=" . v 23 vsplit 24 call feedkeys("q:\<CR>") 25 let ac = &lines - (&cmdheight + winheight(0) + !!v) 26 let emsg = printf(efmt, ac, v, 'left') 27 call assert_equal(0, ac, emsg) 28 wincmd w 29 let ac = &lines - (&cmdheight + winheight(0) + !!v) 30 let emsg = printf(efmt, ac, v, 'right') 31 call assert_equal(0, ac, emsg) 32 new | only! 33 endfor 34 set ls&vim 35endfunc 36 37function Test_window_cmd_wincmd_gf() 38 let fname = 'test_gf.txt' 39 let swp_fname = '.' . fname . '.swp' 40 call writefile([], fname) 41 call writefile([], swp_fname) 42 function s:swap_exists() 43 let v:swapchoice = s:swap_choice 44 endfunc 45 augroup test_window_cmd_wincmd_gf 46 autocmd! 47 exec "autocmd SwapExists " . fname . " call s:swap_exists()" 48 augroup END 49 50 call setline(1, fname) 51 " (E)dit anyway 52 let s:swap_choice = 'e' 53 wincmd gf 54 call assert_equal(2, tabpagenr()) 55 call assert_equal(fname, bufname("%")) 56 quit! 57 58 " (Q)uit 59 let s:swap_choice = 'q' 60 wincmd gf 61 call assert_equal(1, tabpagenr()) 62 call assert_notequal(fname, bufname("%")) 63 new | only! 64 65 call delete(fname) 66 call delete(swp_fname) 67 augroup! test_window_cmd_wincmd_gf 68endfunc 69 70" vim: shiftwidth=2 sts=2 expandtab 71