aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-11-15 12:06:10 -0500
committerJames McCoy <jamessan@jamessan.com>2016-12-28 14:57:38 -0500
commit00466410701802214aba5c95f1cbb2e5086a37f5 (patch)
tree475ac94ef210e89b2a36deb9bbcfc0dbf212c7f0 /src/nvim/testdir
parent99a8cd3be0509e97b649edc1599bfb74bf2b4802 (diff)
downloadrneovim-00466410701802214aba5c95f1cbb2e5086a37f5.tar.gz
rneovim-00466410701802214aba5c95f1cbb2e5086a37f5.tar.bz2
rneovim-00466410701802214aba5c95f1cbb2e5086a37f5.zip
vim-patch:7.4.2204
Problem: It is not easy to get information about buffers, windows and tabpages. Solution: Add getbufinfo(), getwininfo() and gettabinfo(). (Yegappan Lakshmanan) https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/Makefile1
-rw-r--r--src/nvim/testdir/test_bufwintabinfo.vim38
2 files changed, 39 insertions, 0 deletions
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index e27be54fc9..84a0c0b889 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -30,6 +30,7 @@ SCRIPTS := \
# Tests using runtest.vim.vim.
# Keep test_alot*.res as the last one, sort the others.
NEW_TESTS = \
+ test_bufwintabinfo.res \
test_cmdline.res \
test_cscope.res \
test_diffmode.res \
diff --git a/src/nvim/testdir/test_bufwintabinfo.vim b/src/nvim/testdir/test_bufwintabinfo.vim
new file mode 100644
index 0000000000..236ca30f99
--- /dev/null
+++ b/src/nvim/testdir/test_bufwintabinfo.vim
@@ -0,0 +1,38 @@
+" Tests for the getbufinfo(), getwininfo() and gettabinfo() functions
+
+function Test_getbufwintabinfo()
+ 1,$bwipeout
+ edit Xtestfile1
+ edit Xtestfile2
+ let buflist = getbufinfo()
+ call assert_equal(2, len(buflist))
+ call assert_match('Xtestfile1', buflist[0].name)
+ call assert_match('Xtestfile2', getbufinfo('Xtestfile2')[0].name)
+ call assert_equal([], getbufinfo(2016))
+ edit Xtestfile1
+ hide edit Xtestfile2
+ hide enew
+ call assert_equal(3, len(getbufinfo({'bufloaded':1})))
+
+ only
+ let w1_id = win_getid()
+ new
+ let w2_id = win_getid()
+ tabnew | let w3_id = win_getid()
+ new | let w4_id = win_getid()
+ new | let w5_id = win_getid()
+ tabfirst
+ let winlist = getwininfo()
+ call assert_equal(5, len(winlist))
+ call assert_equal(2, winlist[3].tpnr)
+ let winfo = getwininfo(w5_id)[0]
+ call assert_equal(2, winfo.tpnr)
+ call assert_equal([], getwininfo(3))
+
+ let tablist = gettabinfo()
+ call assert_equal(2, len(tablist))
+ call assert_equal(3, len(tablist[1].windows))
+ call assert_equal([], gettabinfo(3))
+
+ tabonly | only
+endfunction