aboutsummaryrefslogtreecommitdiff
path: root/test/functional/options
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
commitff7ed8f586589d620a806c3758fac4a47a8e7e15 (patch)
tree729bbcb92231538fa61dab6c3d890b025484b7f5 /test/functional/options
parent376914f419eb08fdf4c1a63a77e1f035898a0f10 (diff)
parent28c04948a1c887a1cc0cb64de79fa32631700466 (diff)
downloadrneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.gz
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.bz2
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/options')
-rw-r--r--test/functional/options/autochdir_spec.lua20
-rw-r--r--test/functional/options/chars_spec.lua53
-rw-r--r--test/functional/options/cursorbind_spec.lua11
-rw-r--r--test/functional/options/defaults_spec.lua103
-rw-r--r--test/functional/options/keymap_spec.lua12
-rw-r--r--test/functional/options/modified_spec.lua20
-rw-r--r--test/functional/options/mousescroll_spec.lua22
-rw-r--r--test/functional/options/num_options_spec.lua9
-rw-r--r--test/functional/options/shortmess_spec.lua28
-rw-r--r--test/functional/options/tabstop_spec.lua8
-rw-r--r--test/functional/options/winfixbuf_spec.lua55
11 files changed, 221 insertions, 120 deletions
diff --git a/test/functional/options/autochdir_spec.lua b/test/functional/options/autochdir_spec.lua
index 11f71912a9..c490ab67a9 100644
--- a/test/functional/options/autochdir_spec.lua
+++ b/test/functional/options/autochdir_spec.lua
@@ -1,9 +1,11 @@
-local helpers = require('test.functional.helpers')(after_each)
-local clear = helpers.clear
-local eq = helpers.eq
-local fn = helpers.fn
-local command = helpers.command
-local mkdir = helpers.mkdir
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local eq = t.eq
+local fn = n.fn
+local command = n.command
+local mkdir = t.mkdir
describe("'autochdir'", function()
it('given on the shell gets processed properly', function()
@@ -16,7 +18,7 @@ describe("'autochdir'", function()
-- With 'autochdir' on, we should get the directory of tty-test.c.
clear('--cmd', 'set autochdir', targetdir .. '/tty-test.c')
- eq(helpers.is_os('win') and expected:gsub('/', '\\') or expected, fn.getcwd())
+ eq(t.is_os('win') and expected:gsub('/', '\\') or expected, fn.getcwd())
end)
it('is not overwritten by getwinvar() call #17609', function()
@@ -38,7 +40,7 @@ describe("'autochdir'", function()
eq(dir_a, fn.getcwd())
fn.getwinvar(2, 'foo')
eq(dir_a, fn.getcwd())
- helpers.rmdir(dir_a)
- helpers.rmdir(dir_b)
+ n.rmdir(dir_a)
+ n.rmdir(dir_b)
end)
end)
diff --git a/test/functional/options/chars_spec.lua b/test/functional/options/chars_spec.lua
index e9c20b5da9..8e63e07e09 100644
--- a/test/functional/options/chars_spec.lua
+++ b/test/functional/options/chars_spec.lua
@@ -1,12 +1,14 @@
-local helpers = require('test.functional.helpers')(after_each)
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear, command = helpers.clear, helpers.command
-local pcall_err = helpers.pcall_err
-local eval = helpers.eval
-local eq = helpers.eq
-local insert = helpers.insert
-local feed = helpers.feed
-local api = helpers.api
+
+local clear, command = n.clear, n.command
+local pcall_err = t.pcall_err
+local eval = n.eval
+local eq = t.eq
+local insert = n.insert
+local feed = n.feed
+local api = n.api
describe("'fillchars'", function()
local screen
@@ -22,7 +24,7 @@ describe("'fillchars'", function()
eq('', eval('&fillchars'))
screen:expect([[
^ |
- ~ |*3
+ {1:~ }|*3
|
]])
end)
@@ -30,13 +32,14 @@ describe("'fillchars'", function()
it('supports whitespace', function()
screen:expect([[
^ |
- ~ |*3
+ {1:~ }|*3
|
]])
command('set fillchars=eob:\\ ')
screen:expect([[
^ |
- |*4
+ {1: }|*3
+ |
]])
end)
@@ -44,7 +47,7 @@ describe("'fillchars'", function()
command('set fillchars=eob:ñ')
screen:expect([[
^ |
- ñ |*3
+ {1:ñ }|*3
|
]])
end)
@@ -53,7 +56,7 @@ describe("'fillchars'", function()
command('set fillchars=eob:å̲')
screen:expect([[
^ |
- å̲ |*3
+ {1:å̲ }|*3
|
]])
end)
@@ -112,8 +115,8 @@ describe("'fillchars'", function()
command('vsplit')
command('set fillchars=fold:x')
screen:expect([[
- ^+-- 2 lines: fooxxxxxxxx│+-- 2 lines: fooxxxxxxx|
- ~ │~ |*3
+ {13:^+-- 2 lines: fooxxxxxxxx}│{13:+-- 2 lines: fooxxxxxxx}|
+ {1:~ }│{1:~ }|*3
|
]])
end)
@@ -126,8 +129,8 @@ describe("'fillchars'", function()
command('vsplit')
command('setl fillchars=fold:x')
screen:expect([[
- ^+-- 2 lines: fooxxxxxxxx│+-- 2 lines: foo·······|
- ~ │~ |*3
+ {13:^+-- 2 lines: fooxxxxxxxx}│{13:+-- 2 lines: foo·······}|
+ {1:~ }│{1:~ }|*3
|
]])
end)
@@ -141,8 +144,8 @@ describe("'fillchars'", function()
command('vsplit')
command('set fillchars&')
screen:expect([[
- ^+-- 2 lines: foo········│+-- 2 lines: fooxxxxxxx|
- ~ │~ |*3
+ {13:^+-- 2 lines: foo········}│{13:+-- 2 lines: fooxxxxxxx}|
+ {1:~ }│{1:~ }|*3
|
]])
end)
@@ -163,8 +166,8 @@ describe("'listchars'", function()
command('vsplit')
command('set listchars=tab:<->')
screen:expect([[
- <------><------>^<------> │<------><------><------>|
- ~ │~ |*3
+ {1:<------><------>^<------>} │{1:<------><------><------>}|
+ {1:~ }│{1:~ }|*3
|
]])
end)
@@ -176,8 +179,8 @@ describe("'listchars'", function()
command('vsplit')
command('setl listchars<')
screen:expect([[
- > > ^> │<------><------><------>|
- ~ │~ |*3
+ {1:> > ^> } │{1:<------><------><------>}|
+ {1:~ }│{1:~ }|*3
|
]])
end)
@@ -189,8 +192,8 @@ describe("'listchars'", function()
command('vsplit')
command('set listchars=tab:>-,eol:$')
screen:expect([[
- >------->-------^>-------$│<------><------><------>|
- ~ │~ |*3
+ {1:>------->-------^>-------$}│{1:<------><------><------>}|
+ {1:~ }│{1:~ }|*3
|
]])
end)
diff --git a/test/functional/options/cursorbind_spec.lua b/test/functional/options/cursorbind_spec.lua
index cafdc83de2..19551b928f 100644
--- a/test/functional/options/cursorbind_spec.lua
+++ b/test/functional/options/cursorbind_spec.lua
@@ -1,9 +1,10 @@
-local helpers = require('test.functional.helpers')(after_each)
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = helpers.clear
-local command = helpers.command
-local exec = helpers.exec
-local feed = helpers.feed
+
+local clear = n.clear
+local command = n.command
+local exec = n.exec
+local feed = n.feed
before_each(clear)
diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua
index d27fa375ee..f61139d92d 100644
--- a/test/functional/options/defaults_spec.lua
+++ b/test/functional/options/defaults_spec.lua
@@ -1,26 +1,27 @@
-local helpers = require('test.functional.helpers')(after_each)
-
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local assert_alive = helpers.assert_alive
-local assert_log = helpers.assert_log
-local api = helpers.api
-local command = helpers.command
-local clear = helpers.clear
-local exc_exec = helpers.exc_exec
-local exec_lua = helpers.exec_lua
-local eval = helpers.eval
-local eq = helpers.eq
-local ok = helpers.ok
-local fn = helpers.fn
-local insert = helpers.insert
-local neq = helpers.neq
-local mkdir = helpers.mkdir
-local rmdir = helpers.rmdir
-local alter_slashes = helpers.alter_slashes
+local assert_alive = n.assert_alive
+local assert_log = t.assert_log
+local api = n.api
+local command = n.command
+local clear = n.clear
+local exc_exec = n.exc_exec
+local exec_lua = n.exec_lua
+local eval = n.eval
+local eq = t.eq
+local ok = t.ok
+local fn = n.fn
+local insert = n.insert
+local neq = t.neq
+local mkdir = t.mkdir
+local rmdir = n.rmdir
+local alter_slashes = n.alter_slashes
local tbl_contains = vim.tbl_contains
-local expect_exit = helpers.expect_exit
-local is_os = helpers.is_os
+local expect_exit = n.expect_exit
+local check_close = n.check_close
+local is_os = t.is_os
local testlog = 'Xtest-defaults-log'
@@ -32,7 +33,7 @@ describe('startup defaults', function()
command('filetype')
screen:expect([[
^ |
- ~ |*2
+ {1:~ }|*2
]] .. expected)
end
@@ -132,9 +133,9 @@ describe('startup defaults', function()
command('vsp')
screen:expect([[
1 │1 |
- ^+-- 2 lines: 2··········│+-- 2 lines: 2·········|
+ {13:^+-- 2 lines: 2··········}│{13:+-- 2 lines: 2·········}|
4 │4 |
- ~ │~ |
+ {1:~ }│{1:~ }|
|
]])
@@ -142,9 +143,9 @@ describe('startup defaults', function()
command('set ambiwidth=double')
screen:expect([[
1 |1 |
- ^+-- 2 lines: 2----------|+-- 2 lines: 2---------|
+ {13:^+-- 2 lines: 2----------}|{13:+-- 2 lines: 2---------}|
4 |4 |
- ~ |~ |
+ {1:~ }|{1:~ }|
|
]])
@@ -152,9 +153,9 @@ describe('startup defaults', function()
fn.setcellwidths({ { 0x2502, 0x2502, 1 } })
screen:expect([[
1 │1 |
- ^+-- 2 lines: 2----------│+-- 2 lines: 2---------|
+ {13:^+-- 2 lines: 2----------}│{13:+-- 2 lines: 2---------}|
4 │4 |
- ~ │~ |
+ {1:~ }│{1:~ }|
|
]])
@@ -162,9 +163,9 @@ describe('startup defaults', function()
fn.setcellwidths({ { 0x2502, 0x2502, 2 } })
screen:expect([[
1 |1 |
- ^+-- 2 lines: 2----------|+-- 2 lines: 2---------|
+ {13:^+-- 2 lines: 2----------}|{13:+-- 2 lines: 2---------}|
4 |4 |
- ~ |~ |
+ {1:~ }|{1:~ }|
|
]])
@@ -172,9 +173,9 @@ describe('startup defaults', function()
command('set ambiwidth=single')
screen:expect([[
1 |1 |
- ^+-- 2 lines: 2··········|+-- 2 lines: 2·········|
+ {13:^+-- 2 lines: 2··········}|{13:+-- 2 lines: 2·········}|
4 |4 |
- ~ |~ |
+ {1:~ }|{1:~ }|
|
]])
end)
@@ -274,6 +275,7 @@ describe('XDG defaults', function()
-- Do not put before_each() here for the same reasons.
after_each(function()
+ check_close()
os.remove(testlog)
end)
@@ -378,7 +380,7 @@ describe('XDG defaults', function()
.. root_path
.. ('/b'):rep(2048)
.. '/nvim'
- .. (',' .. root_path .. '/c/nvim'):rep(512)
+ .. (',' .. root_path .. '/c/nvim')
.. ','
.. root_path
.. ('/X'):rep(4096)
@@ -393,12 +395,12 @@ describe('XDG defaults', function()
.. root_path
.. ('/B'):rep(2048)
.. '/nvim/site'
- .. (',' .. root_path .. '/C/nvim/site'):rep(512)
+ .. (',' .. root_path .. '/C/nvim/site')
.. ','
.. vimruntime
.. ','
.. libdir
- .. (',' .. root_path .. '/C/nvim/site/after'):rep(512)
+ .. (',' .. root_path .. '/C/nvim/site/after')
.. ','
.. root_path
.. ('/B'):rep(2048)
@@ -413,7 +415,7 @@ describe('XDG defaults', function()
.. '/'
.. data_dir
.. '/site/after'
- .. (',' .. root_path .. '/c/nvim/after'):rep(512)
+ .. (',' .. root_path .. '/c/nvim/after')
.. ','
.. root_path
.. ('/b'):rep(2048)
@@ -449,7 +451,7 @@ describe('XDG defaults', function()
.. root_path
.. ('/b'):rep(2048)
.. '/nvim'
- .. (',' .. root_path .. '/c/nvim'):rep(512)
+ .. (',' .. root_path .. '/c/nvim')
.. ','
.. root_path
.. ('/X'):rep(4096)
@@ -464,12 +466,12 @@ describe('XDG defaults', function()
.. root_path
.. ('/B'):rep(2048)
.. '/nvim/site'
- .. (',' .. root_path .. '/C/nvim/site'):rep(512)
+ .. (',' .. root_path .. '/C/nvim/site')
.. ','
.. vimruntime
.. ','
.. libdir
- .. (',' .. root_path .. '/C/nvim/site/after'):rep(512)
+ .. (',' .. root_path .. '/C/nvim/site/after')
.. ','
.. root_path
.. ('/B'):rep(2048)
@@ -484,7 +486,7 @@ describe('XDG defaults', function()
.. '/'
.. data_dir
.. '/site/after'
- .. (',' .. root_path .. '/c/nvim/after'):rep(512)
+ .. (',' .. root_path .. '/c/nvim/after')
.. ','
.. root_path
.. ('/b'):rep(2048)
@@ -865,6 +867,11 @@ describe('XDG defaults', function()
end)
describe('stdpath()', function()
+ after_each(function()
+ check_close()
+ os.remove(testlog)
+ end)
+
-- Windows appends 'nvim-data' instead of just 'nvim' to prevent collisions
-- due to XDG_CONFIG_HOME, XDG_DATA_HOME and XDG_STATE_HOME being the same.
local function maybe_data(name)
@@ -890,7 +897,7 @@ describe('stdpath()', function()
it('reacts to $NVIM_APPNAME', function()
local appname = 'NVIM_APPNAME_TEST' .. ('_'):rep(106)
- clear({ env = { NVIM_APPNAME = appname } })
+ clear({ env = { NVIM_APPNAME = appname, NVIM_LOG_FILE = testlog } })
eq(appname, fn.fnamemodify(fn.stdpath('config'), ':t'))
eq(appname, fn.fnamemodify(fn.stdpath('cache'), ':t'))
eq(maybe_data(appname), fn.fnamemodify(fn.stdpath('log'), ':t'))
@@ -928,6 +935,9 @@ describe('stdpath()', function()
-- Valid appnames:
test_appname('a/b', 0)
test_appname('a/b\\c', 0)
+ if not is_os('win') then
+ assert_log('Failed to start server: no such file or directory:', testlog)
+ end
end)
describe('returns a String', function()
@@ -1220,6 +1230,8 @@ describe('stdpath()', function()
end)
describe('errors', function()
+ before_each(clear)
+
it('on unknown strings', function()
eq('Vim(call):E6100: "capybara" is not a valid stdpath', exc_exec('call stdpath("capybara")'))
eq('Vim(call):E6100: "" is not a valid stdpath', exc_exec('call stdpath("")'))
@@ -1235,7 +1247,8 @@ end)
describe('autocommands', function()
it('closes terminal with default shell on success', function()
- api.nvim_set_option_value('shell', helpers.testprg('shell-test'), {})
+ clear()
+ api.nvim_set_option_value('shell', n.testprg('shell-test'), {})
command('set shellcmdflag=EXIT shellredir= shellpipe= shellquote= shellxquote=')
-- Should not block other events
@@ -1243,11 +1256,11 @@ describe('autocommands', function()
command('au BufEnter * let g:n = g:n + 1')
command('terminal')
- eq(eval('get(g:, "n", 0)'), 1)
+ eq(1, eval('get(g:, "n", 0)'))
- helpers.retry(nil, 1000, function()
- neq(api.nvim_get_option_value('buftype', { buf = 0 }), 'terminal')
- eq(eval('get(g:, "n", 0)'), 2)
+ t.retry(nil, 1000, function()
+ neq('terminal', api.nvim_get_option_value('buftype', { buf = 0 }))
+ eq(2, eval('get(g:, "n", 0)'))
end)
end)
end)
diff --git a/test/functional/options/keymap_spec.lua b/test/functional/options/keymap_spec.lua
index 7be58888bc..f76525699f 100644
--- a/test/functional/options/keymap_spec.lua
+++ b/test/functional/options/keymap_spec.lua
@@ -1,8 +1,10 @@
-local helpers = require('test.functional.helpers')(after_each)
-local clear, feed, eq = helpers.clear, helpers.feed, helpers.eq
-local expect, command, eval = helpers.expect, helpers.command, helpers.eval
-local insert, call = helpers.insert, helpers.call
-local exec_capture, dedent = helpers.exec_capture, helpers.dedent
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, feed, eq = n.clear, n.feed, t.eq
+local expect, command, eval = n.expect, n.command, n.eval
+local insert, call = n.insert, n.call
+local exec_capture, dedent = n.exec_capture, t.dedent
-- First test it's implemented using the :lmap and :lnoremap commands, then
-- check those mappings behave as expected.
diff --git a/test/functional/options/modified_spec.lua b/test/functional/options/modified_spec.lua
new file mode 100644
index 0000000000..956deb70ff
--- /dev/null
+++ b/test/functional/options/modified_spec.lua
@@ -0,0 +1,20 @@
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local eq = t.eq
+local api = n.api
+
+describe("'modified'", function()
+ before_each(function()
+ clear()
+ end)
+
+ it("can be unset after changing 'fileformat'", function()
+ for _, ff in ipairs({ 'unix', 'dos', 'mac' }) do
+ api.nvim_set_option_value('fileformat', ff, {})
+ api.nvim_set_option_value('modified', false, {})
+ eq(false, api.nvim_get_option_value('modified', {}), 'fileformat=' .. ff)
+ end
+ end)
+end)
diff --git a/test/functional/options/mousescroll_spec.lua b/test/functional/options/mousescroll_spec.lua
index 96af8987b8..2ccf934fd4 100644
--- a/test/functional/options/mousescroll_spec.lua
+++ b/test/functional/options/mousescroll_spec.lua
@@ -1,21 +1,23 @@
-local helpers = require('test.functional.helpers')(after_each)
-local command = helpers.command
-local clear = helpers.clear
-local eval = helpers.eval
-local eq = helpers.eq
-local exc_exec = helpers.exc_exec
-local feed = helpers.feed
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local command = n.command
+local clear = n.clear
+local eval = n.eval
+local eq = t.eq
+local exc_exec = n.exc_exec
+local feed = n.feed
local scroll = function(direction)
- return helpers.request('nvim_input_mouse', 'wheel', direction, '', 0, 2, 2)
+ return n.request('nvim_input_mouse', 'wheel', direction, '', 0, 2, 2)
end
local screenrow = function()
- return helpers.call('screenrow')
+ return n.call('screenrow')
end
local screencol = function()
- return helpers.call('screencol')
+ return n.call('screencol')
end
describe("'mousescroll'", function()
diff --git a/test/functional/options/num_options_spec.lua b/test/functional/options/num_options_spec.lua
index 0614bcf814..3ac6f3f121 100644
--- a/test/functional/options/num_options_spec.lua
+++ b/test/functional/options/num_options_spec.lua
@@ -1,8 +1,9 @@
-- Tests for :setlocal and :setglobal
-local helpers = require('test.functional.helpers')(after_each)
-local clear, feed_command, eval, eq, api =
- helpers.clear, helpers.feed_command, helpers.eval, helpers.eq, helpers.api
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
+
+local clear, feed_command, eval, eq, api = n.clear, n.feed_command, n.eval, t.eq, n.api
local function should_fail(opt, value, errmsg)
feed_command('setglobal ' .. opt .. '=' .. value)
@@ -12,7 +13,7 @@ local function should_fail(opt, value, errmsg)
eq(errmsg, eval('v:errmsg'):match('E%d*'))
feed_command('let v:errmsg = ""')
local status, err = pcall(api.nvim_set_option_value, opt, value, {})
- eq(status, false)
+ eq(false, status)
eq(errmsg, err:match('E%d*'))
eq('', eval('v:errmsg'))
end
diff --git a/test/functional/options/shortmess_spec.lua b/test/functional/options/shortmess_spec.lua
index 6bc00ca1c5..dcbf9d15e0 100644
--- a/test/functional/options/shortmess_spec.lua
+++ b/test/functional/options/shortmess_spec.lua
@@ -1,10 +1,12 @@
-local helpers = require('test.functional.helpers')(after_each)
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = helpers.clear
-local command = helpers.command
-local eq = helpers.eq
-local eval = helpers.eval
-local feed = helpers.feed
+
+local clear = n.clear
+local command = n.command
+local eq = t.eq
+local eval = n.eval
+local feed = n.feed
describe("'shortmess'", function()
local screen
@@ -22,7 +24,7 @@ describe("'shortmess'", function()
feed(':edit foo<CR>')
screen:expect([[
^ |
- ~ |*3
+ {1:~ }|*3
"foo" [New] |
]])
eq(1, eval('bufnr("%")'))
@@ -31,7 +33,7 @@ describe("'shortmess'", function()
feed(':edit bar<CR>')
screen:expect([[
^ |
- ~ |*3
+ {1:~ }|*3
:edit bar |
]])
eq(2, eval('bufnr("%")'))
@@ -43,21 +45,21 @@ describe("'shortmess'", function()
feed(':edit foo<CR>')
screen:expect([[
^ |
- ~ |*3
+ {1:~ }|*3
"foo" [New] |
]])
eq(1, eval('bufnr("%")'))
feed(':edit bar<CR>')
screen:expect([[
^ |
- ~ |*3
+ {1:~ }|*3
"bar" [New] |
]])
eq(2, eval('bufnr("%")'))
feed(':bprevious<CR>')
screen:expect([[
^ |
- ~ |*3
+ {1:~ }|*3
"foo" [New] --No lines in buffer-- |
]])
eq(1, eval('bufnr("%")'))
@@ -66,14 +68,14 @@ describe("'shortmess'", function()
feed(':bnext<CR>')
screen:expect([[
^ |
- ~ |*3
+ {1:~ }|*3
:bnext |
]])
eq(2, eval('bufnr("%")'))
feed(':bprevious<CR>')
screen:expect([[
^ |
- ~ |*3
+ {1:~ }|*3
:bprevious |
]])
eq(1, eval('bufnr("%")'))
diff --git a/test/functional/options/tabstop_spec.lua b/test/functional/options/tabstop_spec.lua
index 9070db8257..4ddbb13a0e 100644
--- a/test/functional/options/tabstop_spec.lua
+++ b/test/functional/options/tabstop_spec.lua
@@ -1,8 +1,8 @@
-local helpers = require('test.functional.helpers')(after_each)
+local n = require('test.functional.testnvim')()
-local assert_alive = helpers.assert_alive
-local clear = helpers.clear
-local feed = helpers.feed
+local assert_alive = n.assert_alive
+local clear = n.clear
+local feed = n.feed
describe("'tabstop' option", function()
before_each(function()
diff --git a/test/functional/options/winfixbuf_spec.lua b/test/functional/options/winfixbuf_spec.lua
new file mode 100644
index 0000000000..124f194b5a
--- /dev/null
+++ b/test/functional/options/winfixbuf_spec.lua
@@ -0,0 +1,55 @@
+local n = require('test.functional.testnvim')()
+
+local clear = n.clear
+local exec_lua = n.exec_lua
+
+describe("Nvim API calls with 'winfixbuf'", function()
+ before_each(function()
+ clear()
+ end)
+
+ it("Calling vim.api.nvim_win_set_buf with 'winfixbuf'", function()
+ local results = exec_lua([[
+ local function _setup_two_buffers()
+ local buffer = vim.api.nvim_create_buf(true, true)
+
+ vim.api.nvim_create_buf(true, true) -- Make another buffer
+
+ local current_window = 0
+ vim.api.nvim_set_option_value("winfixbuf", true, {win=current_window})
+
+ return buffer
+ end
+
+ local other_buffer = _setup_two_buffers()
+ local current_window = 0
+ local results, _ = pcall(vim.api.nvim_win_set_buf, current_window, other_buffer)
+
+ return results
+ ]])
+
+ assert(results == false)
+ end)
+
+ it("Calling vim.api.nvim_set_current_buf with 'winfixbuf'", function()
+ local results = exec_lua([[
+ local function _setup_two_buffers()
+ local buffer = vim.api.nvim_create_buf(true, true)
+
+ vim.api.nvim_create_buf(true, true) -- Make another buffer
+
+ local current_window = 0
+ vim.api.nvim_set_option_value("winfixbuf", true, {win=current_window})
+
+ return buffer
+ end
+
+ local other_buffer = _setup_two_buffers()
+ local results, _ = pcall(vim.api.nvim_set_current_buf, other_buffer)
+
+ return results
+ ]])
+
+ assert(results == false)
+ end)
+end)