aboutsummaryrefslogtreecommitdiff
path: root/test/functional/options
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/options')
-rw-r--r--test/functional/options/autochdir_spec.lua2
-rw-r--r--test/functional/options/defaults_spec.lua99
-rw-r--r--test/functional/options/keymap_spec.lua2
-rw-r--r--test/functional/options/mousescroll_spec.lua18
4 files changed, 82 insertions, 39 deletions
diff --git a/test/functional/options/autochdir_spec.lua b/test/functional/options/autochdir_spec.lua
index 74959a8e76..0b6fe9533c 100644
--- a/test/functional/options/autochdir_spec.lua
+++ b/test/functional/options/autochdir_spec.lua
@@ -16,7 +16,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.iswin() and expected:gsub('/', '\\') or expected, funcs.getcwd())
+ eq(helpers.is_os('win') and expected:gsub('/', '\\') or expected, funcs.getcwd())
end)
it('is not overwritten by getwinvar() call #17609',function()
diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua
index 4e2f2ab63e..84ec43f4cb 100644
--- a/test/functional/options/defaults_spec.lua
+++ b/test/functional/options/defaults_spec.lua
@@ -3,6 +3,7 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local assert_alive = helpers.assert_alive
+local assert_log = helpers.assert_log
local meths = helpers.meths
local command = helpers.command
local clear = helpers.clear
@@ -12,13 +13,15 @@ local eq = helpers.eq
local ok = helpers.ok
local funcs = helpers.funcs
local insert = helpers.insert
-local iswin = helpers.iswin
local neq = helpers.neq
local mkdir = helpers.mkdir
local rmdir = helpers.rmdir
local alter_slashes = helpers.alter_slashes
local tbl_contains = helpers.tbl_contains
local expect_exit = helpers.expect_exit
+local is_os = helpers.is_os
+
+local testlog = 'Xtest-defaults-log'
describe('startup defaults', function()
describe(':filetype', function()
@@ -220,7 +223,9 @@ describe('startup defaults', function()
end)
it("'packpath'", function()
- clear()
+ clear{
+ args_rm={'runtimepath'},
+ }
-- Defaults to &runtimepath.
eq(meths.get_option('runtimepath'), meths.get_option('packpath'))
@@ -238,7 +243,7 @@ describe('startup defaults', function()
describe('$NVIM_LOG_FILE', function()
local xdgdir = 'Xtest-startup-xdg-logpath'
- local xdgstatedir = iswin() and xdgdir..'/nvim-data' or xdgdir..'/nvim'
+ local xdgstatedir = is_os('win') and xdgdir..'/nvim-data' or xdgdir..'/nvim'
after_each(function()
os.remove('Xtest-logpath')
rmdir(xdgdir)
@@ -273,11 +278,15 @@ describe('XDG defaults', function()
-- Need separate describe() blocks to not run clear() twice.
-- Do not put before_each() here for the same reasons.
+ after_each(function()
+ os.remove(testlog)
+ end)
+
it("&runtimepath data-dir matches stdpath('data') #9910", function()
clear()
local rtp = eval('split(&runtimepath, ",")')
local rv = {}
- local expected = (iswin()
+ local expected = (is_os('win')
and { [[\nvim-data\site]], [[\nvim-data\site\after]], }
or { '/nvim/site', '/nvim/site/after', })
@@ -325,28 +334,35 @@ describe('XDG defaults', function()
return vimruntime, libdir
end
- local env_sep = iswin() and ';' or ':'
- local data_dir = iswin() and 'nvim-data' or 'nvim'
- local state_dir = iswin() and 'nvim-data' or 'nvim'
- local root_path = iswin() and 'C:' or ''
+ local env_sep = is_os('win') and ';' or ':'
+ local data_dir = is_os('win') and 'nvim-data' or 'nvim'
+ local state_dir = is_os('win') and 'nvim-data' or 'nvim'
+ local root_path = is_os('win') and 'C:' or ''
describe('with too long XDG variables', function()
before_each(function()
- clear({env={
- XDG_CONFIG_HOME=(root_path .. ('/x'):rep(4096)),
- XDG_CONFIG_DIRS=(root_path .. ('/a'):rep(2048)
- .. env_sep.. root_path .. ('/b'):rep(2048)
- .. (env_sep .. root_path .. '/c'):rep(512)),
- XDG_DATA_HOME=(root_path .. ('/X'):rep(4096)),
- XDG_RUNTIME_DIR=(root_path .. ('/X'):rep(4096)),
- XDG_STATE_HOME=(root_path .. ('/X'):rep(4096)),
- XDG_DATA_DIRS=(root_path .. ('/A'):rep(2048)
- .. env_sep .. root_path .. ('/B'):rep(2048)
- .. (env_sep .. root_path .. '/C'):rep(512)),
+ clear({
+ args_rm={'runtimepath'},
+ env={
+ NVIM_LOG_FILE=testlog,
+ XDG_CONFIG_HOME=(root_path .. ('/x'):rep(4096)),
+ XDG_CONFIG_DIRS=(root_path .. ('/a'):rep(2048)
+ .. env_sep.. root_path .. ('/b'):rep(2048)
+ .. (env_sep .. root_path .. '/c'):rep(512)),
+ XDG_DATA_HOME=(root_path .. ('/X'):rep(4096)),
+ XDG_RUNTIME_DIR=(root_path .. ('/X'):rep(4096)),
+ XDG_STATE_HOME=(root_path .. ('/X'):rep(4096)),
+ XDG_DATA_DIRS=(root_path .. ('/A'):rep(2048)
+ .. env_sep .. root_path .. ('/B'):rep(2048)
+ .. (env_sep .. root_path .. '/C'):rep(512)),
}})
end)
it('are correctly set', function()
+ if not is_os('win') then
+ assert_log('Failed to start server: no such file or directory: /X/X/X', testlog, 10)
+ end
+
local vimruntime, libdir = vimruntime_and_libdir()
eq(((root_path .. ('/x'):rep(4096) .. '/nvim'
@@ -405,17 +421,24 @@ describe('XDG defaults', function()
describe('with XDG variables that can be expanded', function()
before_each(function()
- clear({env={
- XDG_CONFIG_HOME='$XDG_DATA_HOME',
- XDG_CONFIG_DIRS='$XDG_DATA_DIRS',
- XDG_DATA_HOME='$XDG_CONFIG_HOME',
- XDG_RUNTIME_DIR='$XDG_RUNTIME_DIR',
- XDG_STATE_HOME='$XDG_CONFIG_HOME',
- XDG_DATA_DIRS='$XDG_CONFIG_DIRS',
+ clear({
+ args_rm={'runtimepath'},
+ env={
+ NVIM_LOG_FILE=testlog,
+ XDG_CONFIG_HOME='$XDG_DATA_HOME',
+ XDG_CONFIG_DIRS='$XDG_DATA_DIRS',
+ XDG_DATA_HOME='$XDG_CONFIG_HOME',
+ XDG_RUNTIME_DIR='$XDG_RUNTIME_DIR',
+ XDG_STATE_HOME='$XDG_CONFIG_HOME',
+ XDG_DATA_DIRS='$XDG_CONFIG_DIRS',
}})
end)
it('are not expanded', function()
+ if not is_os('win') then
+ assert_log('Failed to start server: no such file or directory: %$XDG_RUNTIME_DIR%/', testlog, 10)
+ end
+
local vimruntime, libdir = vimruntime_and_libdir()
eq((('$XDG_DATA_HOME/nvim'
.. ',$XDG_DATA_DIRS/nvim'
@@ -478,18 +501,20 @@ describe('XDG defaults', function()
describe('with commas', function()
before_each(function()
- clear({env={
- XDG_CONFIG_HOME=', , ,',
- XDG_CONFIG_DIRS=',-,-,' .. env_sep .. '-,-,-',
- XDG_DATA_HOME=',=,=,',
- XDG_STATE_HOME=',=,=,',
- XDG_DATA_DIRS=',≡,≡,' .. env_sep .. '≡,≡,≡',
+ clear({
+ args_rm={'runtimepath'},
+ env={
+ XDG_CONFIG_HOME=', , ,',
+ XDG_CONFIG_DIRS=',-,-,' .. env_sep .. '-,-,-',
+ XDG_DATA_HOME=',=,=,',
+ XDG_STATE_HOME=',=,=,',
+ XDG_DATA_DIRS=',≡,≡,' .. env_sep .. '≡,≡,≡',
}})
end)
it('are escaped properly', function()
local vimruntime, libdir = vimruntime_and_libdir()
- local path_sep = iswin() and '\\' or '/'
+ local path_sep = is_os('win') and '\\' or '/'
eq(('\\, \\, \\,' .. path_sep .. 'nvim'
.. ',\\,-\\,-\\,' .. path_sep .. 'nvim'
.. ',-\\,-\\,-' .. path_sep .. 'nvim'
@@ -541,9 +566,9 @@ end)
describe('stdpath()', function()
-- 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 datadir = iswin() and 'nvim-data' or 'nvim'
- local statedir = iswin() and 'nvim-data' or 'nvim'
- local env_sep = iswin() and ';' or ':'
+ local datadir = is_os('win') and 'nvim-data' or 'nvim'
+ local statedir = is_os('win') and 'nvim-data' or 'nvim'
+ local env_sep = is_os('win') and ';' or ':'
it('acceptance', function()
clear() -- Do not explicitly set any env vars.
@@ -696,7 +721,7 @@ describe('stdpath()', function()
context('returns a List', function()
-- Some OS specific variables the system would have set.
local function base_env()
- if iswin() then
+ if is_os('win') then
return {
HOME='C:\\Users\\docwhat', -- technically, is not a usual PATH
HOMEDRIVE='C:',
diff --git a/test/functional/options/keymap_spec.lua b/test/functional/options/keymap_spec.lua
index a814c35a39..4fdc6ef4be 100644
--- a/test/functional/options/keymap_spec.lua
+++ b/test/functional/options/keymap_spec.lua
@@ -184,7 +184,7 @@ describe("'keymap' / :lmap", function()
feed('il<esc>')
expect('alllaaa')
end)
- -- This is a problem introduced when introducting :lmap and macro
+ -- This is a problem introduced when introducing :lmap and macro
-- compatibility. There are no plans to fix this as the complexity involved
-- seems too great.
pending('mappings not applied to macro replay of :lnoremap', function()
diff --git a/test/functional/options/mousescroll_spec.lua b/test/functional/options/mousescroll_spec.lua
index 2c9b2d175e..5bff45a836 100644
--- a/test/functional/options/mousescroll_spec.lua
+++ b/test/functional/options/mousescroll_spec.lua
@@ -97,6 +97,24 @@ describe("'mousescroll'", function()
eq(10, screencol())
scroll('left')
eq(10, screencol())
+
+ -- vertical scrolling is still disabled with non-zero 'scrolloff' value
+ command('set scrolloff=1')
+
+ eq(10, screenrow())
+ scroll('up')
+ eq(10, screenrow())
+ scroll('down')
+ eq(10, screenrow())
+
+ -- also in insert mode
+ feed('i')
+
+ eq(10, screenrow())
+ scroll('up')
+ eq(10, screenrow())
+ scroll('down')
+ eq(10, screenrow())
end)
local test_vertical_scrolling = function()