aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_window_cmd.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/testdir/test_window_cmd.vim')
-rw-r--r--src/nvim/testdir/test_window_cmd.vim29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim
index 039de0c623..a200bf7d42 100644
--- a/src/nvim/testdir/test_window_cmd.vim
+++ b/src/nvim/testdir/test_window_cmd.vim
@@ -72,7 +72,7 @@ endfunc
func Test_window_quit()
e Xa
split Xb
- call assert_equal(2, winnr('$'))
+ call assert_equal(2, '$'->winnr())
call assert_equal('Xb', bufname(winbufnr(1)))
call assert_equal('Xa', bufname(winbufnr(2)))
@@ -88,7 +88,7 @@ func Test_window_horizontal_split()
3wincmd s
call assert_equal(2, winnr('$'))
call assert_equal(3, winheight(0))
- call assert_equal(winwidth(1), winwidth(2))
+ call assert_equal(winwidth(1), 2->winwidth())
call assert_fails('botright topleft wincmd s', 'E442:')
bw
@@ -267,7 +267,7 @@ func Test_window_height()
wincmd +
call assert_equal(wh1, winheight(1))
- call assert_equal(wh2, winheight(2))
+ call assert_equal(wh2, 2->winheight())
2wincmd _
call assert_equal(2, winheight(1))
@@ -452,7 +452,7 @@ func Test_window_newtab()
wincmd T
call assert_equal(2, tabpagenr('$'))
call assert_equal(['Xb', 'Xa'], map(tabpagebuflist(1), 'bufname(v:val)'))
- call assert_equal(['Xc' ], map(tabpagebuflist(2), 'bufname(v:val)'))
+ call assert_equal(['Xc' ], map(2->tabpagebuflist(), 'bufname(v:val)'))
%bw!
endfunc
@@ -577,8 +577,11 @@ endfunc
function! Fun_RenewFile()
" Need to wait a bit for the timestamp to be older.
- sleep 2
- silent execute '!echo "1" > tmp.txt'
+ let old_ftime = getftime("tmp.txt")
+ while getftime("tmp.txt") == old_ftime
+ sleep 100m
+ silent execute '!echo "1" > tmp.txt'
+ endwhile
sp
wincmd p
edit! tmp.txt
@@ -814,13 +817,25 @@ func Test_winnr()
tabnew
call assert_equal(8, tabpagewinnr(1, 'j'))
- call assert_equal(2, tabpagewinnr(1, 'k'))
+ call assert_equal(2, 1->tabpagewinnr('k'))
call assert_equal(4, tabpagewinnr(1, 'h'))
call assert_equal(6, tabpagewinnr(1, 'l'))
only | tabonly
endfunc
+func Test_winrestview()
+ split runtest.vim
+ normal 50%
+ let view = winsaveview()
+ close
+ split runtest.vim
+ eval view->winrestview()
+ call assert_equal(view, winsaveview())
+
+ bwipe!
+endfunc
+
func Test_win_splitmove()
edit a
leftabove split b