aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/tabpage_spec.lua
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-10-16 14:23:36 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-10-16 14:23:36 -0300
commit388e75e4b0f602ac5dd70e1ceeb1d1a18a37c51e (patch)
tree8ae4c703deff5a369cd35c7580351e320faa6d93 /test/functional/api/tabpage_spec.lua
parent0a2d9fa8c88b6e263b9baa9b639c23321272f9bf (diff)
parent0c2ec77ae0c0bde70b168313f89fa3259682a056 (diff)
downloadrneovim-388e75e4b0f602ac5dd70e1ceeb1d1a18a37c51e.tar.gz
rneovim-388e75e4b0f602ac5dd70e1ceeb1d1a18a37c51e.tar.bz2
rneovim-388e75e4b0f602ac5dd70e1ceeb1d1a18a37c51e.zip
Merge PR #1296 'Use the lua client to run functional tests'
Diffstat (limited to 'test/functional/api/tabpage_spec.lua')
-rw-r--r--test/functional/api/tabpage_spec.lua42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/functional/api/tabpage_spec.lua b/test/functional/api/tabpage_spec.lua
new file mode 100644
index 0000000000..9937e0c72e
--- /dev/null
+++ b/test/functional/api/tabpage_spec.lua
@@ -0,0 +1,42 @@
+-- Sanity checks for tabpage_* API calls via msgpack-rpc
+local helpers = require('test.functional.helpers')
+local clear, nvim, tabpage, curtab, eq, ok =
+ helpers.clear, helpers.nvim, helpers.tabpage, helpers.curtab, helpers.eq,
+ helpers.ok
+
+describe('tabpage_* functions', function()
+ before_each(clear)
+
+ describe('get_windows and get_window', function()
+ it('works', function()
+ nvim('command', 'tabnew')
+ nvim('command', 'vsplit')
+ local tab1, tab2 = unpack(nvim('get_tabpages'))
+ local win1, win2, win3 = unpack(nvim('get_windows'))
+ eq({win1}, tabpage('get_windows', tab1))
+ eq({win2, win3}, tabpage('get_windows', tab2))
+ eq(win2, tabpage('get_window', tab2))
+ nvim('set_current_window', win3)
+ eq(win3, tabpage('get_window', tab2))
+ end)
+ end)
+
+ describe('{get,set}_var', function()
+ it('works', function()
+ curtab('set_var', 'lua', {1, 2, {['3'] = 1}})
+ eq({1, 2, {['3'] = 1}}, curtab('get_var', 'lua'))
+ eq({1, 2, {['3'] = 1}}, nvim('eval', 't:lua'))
+ end)
+ end)
+
+ describe('is_valid', function()
+ it('works', function()
+ nvim('command', 'tabnew')
+ local tab = nvim('get_tabpages')[2]
+ nvim('set_current_tabpage', tab)
+ ok(tabpage('is_valid', tab))
+ nvim('command', 'tabclose')
+ ok(not tabpage('is_valid', tab))
+ end)
+ end)
+end)