aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/window_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-12-27 22:49:44 +0100
committerJustin M. Keyes <justinkz@gmail.com>2018-12-27 22:49:44 +0100
commitc1015121ec626cab6cb384f544bc0be1a1760c0e (patch)
tree6cc9a5d1899a4486a24c491e07d17a7dd01f9503 /test/functional/api/window_spec.lua
parent4f030ec24e0e148bbb83aedaef7dd629e5fef130 (diff)
parente1876c7ad1b5e30c0a9919e2c4587d11550c8507 (diff)
downloadrneovim-c1015121ec626cab6cb384f544bc0be1a1760c0e.tar.gz
rneovim-c1015121ec626cab6cb384f544bc0be1a1760c0e.tar.bz2
rneovim-c1015121ec626cab6cb384f544bc0be1a1760c0e.zip
Merge 'upstream/master' into pr-win-erw7
Diffstat (limited to 'test/functional/api/window_spec.lua')
-rw-r--r--test/functional/api/window_spec.lua18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index 27d7aa11b4..4496e1f644 100644
--- a/test/functional/api/window_spec.lua
+++ b/test/functional/api/window_spec.lua
@@ -11,6 +11,7 @@ local NIL = helpers.NIL
local meth_pcall = helpers.meth_pcall
local meths = helpers.meths
local command = helpers.command
+local expect_err = helpers.expect_err
-- check if str is visible at the beginning of some line
local function is_visible(str)
@@ -31,7 +32,7 @@ local function is_visible(str)
return false
end
-describe('api/win', function()
+describe('API/win', function()
before_each(clear)
describe('get_buf', function()
@@ -45,6 +46,21 @@ describe('api/win', function()
end)
end)
+ describe('set_buf', function()
+ it('works', function()
+ nvim('command', 'new')
+ local windows = nvim('list_wins')
+ neq(window('get_buf', windows[2]), window('get_buf', windows[1]))
+ window('set_buf', windows[2], window('get_buf', windows[1]))
+ eq(window('get_buf', windows[2]), window('get_buf', windows[1]))
+ end)
+
+ it('validates args', function()
+ expect_err('Invalid buffer id$', window, 'set_buf', nvim('get_current_win'), 23)
+ expect_err('Invalid window id$', window, 'set_buf', 23, nvim('get_current_buf'))
+ end)
+ end)
+
describe('{get,set}_cursor', function()
it('works', function()
eq({1, 0}, curwin('get_cursor'))