aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-09-05 15:31:45 -0400
committerGitHub <noreply@github.com>2020-09-05 12:31:45 -0700
commit2cea6ab0126a6197452fea6ce839874ad3fce9d6 (patch)
tree1676dc23561b8fb15153319fdf7343c966077fe1
parent7b1b271f43e9ceca3b195e7e3d56147d38919c2b (diff)
downloadrneovim-2cea6ab0126a6197452fea6ce839874ad3fce9d6.tar.gz
rneovim-2cea6ab0126a6197452fea6ce839874ad3fce9d6.tar.bz2
rneovim-2cea6ab0126a6197452fea6ce839874ad3fce9d6.zip
vim-patch:8.2.1586: :resize command not fully tested (#12853)
Problem: :resize command not fully tested. Solution: Add a couple of tests. (Dominique Pellé, closes vim/vim#6857) https://github.com/vim/vim/commit/fe6dce873954a216eedb686bd5006710ffff4b89
-rw-r--r--src/nvim/testdir/test_window_cmd.vim42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim
index aaa291f87d..9f47ee2904 100644
--- a/src/nvim/testdir/test_window_cmd.vim
+++ b/src/nvim/testdir/test_window_cmd.vim
@@ -841,4 +841,46 @@ func Test_winnr()
only | tabonly
endfunc
+func Test_window_resize()
+ " Vertical :resize (absolute, relative, min and max size).
+ vsplit
+ vert resize 8
+ call assert_equal(8, winwidth(0))
+ vert resize +2
+ call assert_equal(10, winwidth(0))
+ vert resize -2
+ call assert_equal(8, winwidth(0))
+ vert resize
+ call assert_equal(&columns - 2, winwidth(0))
+ vert resize 0
+ call assert_equal(1, winwidth(0))
+ vert resize 99999
+ call assert_equal(&columns - 2, winwidth(0))
+
+ %bwipe!
+
+ " Horizontal :resize (with absolute, relative size, min and max size).
+ split
+ resize 8
+ call assert_equal(8, winheight(0))
+ resize +2
+ call assert_equal(10, winheight(0))
+ resize -2
+ call assert_equal(8, winheight(0))
+ resize
+ call assert_equal(&lines - 4, winheight(0))
+ resize 0
+ call assert_equal(1, winheight(0))
+ resize 99999
+ call assert_equal(&lines - 4, winheight(0))
+
+ " :resize with explicit window number.
+ let other_winnr = winnr('j')
+ exe other_winnr .. 'resize 10'
+ call assert_equal(10, winheight(other_winnr))
+ call assert_equal(&lines - 10 - 3, winheight(0))
+
+ %bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab