From 16336c486ecb5a60e85a870904316308c7d7fc3f Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 25 Sep 2022 02:20:47 +0200 Subject: feat(gen_help_html.lua): adapt to new parser - adapt to parser changes from https://github.com/vigoux/tree-sitter-vimdoc/pull/16 - numerous other generator improvements --- test/functional/options/defaults_spec.lua | 58 ++++++++++++++++++------------- 1 file changed, 33 insertions(+), 25 deletions(-) (limited to 'test/functional/options') diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua index 4e2f2ab63e..130ed73c34 100644 --- a/test/functional/options/defaults_spec.lua +++ b/test/functional/options/defaults_spec.lua @@ -220,7 +220,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')) @@ -332,17 +334,19 @@ describe('XDG defaults', function() 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={ + 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) @@ -405,13 +409,15 @@ 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={ + 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) @@ -478,12 +484,14 @@ 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) -- cgit From df646572c53f55268a5dbb61628d7c3b302d5663 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Fri, 30 Sep 2022 09:53:52 +0200 Subject: docs: fix typos (#20394) Co-authored-by: Raphael Co-authored-by: smjonas Co-authored-by: zeertzjq --- test/functional/options/keymap_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/options') 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') 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() -- cgit From 23080a4d7a9043913cb4875e18118731a4562032 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 30 Oct 2022 07:10:39 +0800 Subject: fix(mouse): ensure no scrolling with "ver:0" in 'mousescroll' (#20861) --- test/functional/options/mousescroll_spec.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/functional/options') 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() -- cgit From 5eb5f4948826e9d47685ea9e257409cc3e693614 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 22 Nov 2022 01:13:30 +0100 Subject: test: simplify platform detection (#21020) Extend the capabilities of is_os to detect more platforms such as freebsd and openbsd. Also remove `iswin()` helper function as it can be replaced by `is_os("win")`. --- test/functional/options/autochdir_spec.lua | 2 +- test/functional/options/defaults_spec.lua | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'test/functional/options') 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 130ed73c34..c0d820f40e 100644 --- a/test/functional/options/defaults_spec.lua +++ b/test/functional/options/defaults_spec.lua @@ -12,13 +12,13 @@ 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 describe('startup defaults', function() describe(':filetype', function() @@ -240,7 +240,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) @@ -279,7 +279,7 @@ describe('XDG defaults', 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', }) @@ -327,10 +327,10 @@ 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() @@ -497,7 +497,7 @@ describe('XDG defaults', function() 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' @@ -549,9 +549,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. @@ -704,7 +704,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:', -- cgit From 6ec7bcb6184f562157eebc8d0f25f78ba333c6a5 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 16 Jan 2023 20:43:13 +0100 Subject: test: avoid noise in NVIM_LOG_FILE Problem: Tests that _intentionally_ fail certain conditions cause noise in $NVIM_LOG_FILE: $NVIM_LOG_FILE: /home/runner/work/neovim/neovim/build/.nvimlog (last 100 lines) WRN 2023-01-16T18:26:27.673 T599.7799.0 unsubscribe:519: RPC: ch 1: tried to unsubscribe unknown event 'doesnotexist' WRN 2023-01-16T18:29:00.557 ?.11151 server_start:163: Failed to start server: no such file or directory: /X/X/X/... WRN 2023-01-16T18:33:07.269 127.0.0.1:12345 server_start:163: Failed to start server: address already in use: 127.0.0.1 ... -- Output to stderr: module 'vim.shared' not found: no field package.preload['vim.shared'] no file './vim/shared.lua' no file '/home/runner/nvim-deps/usr/share/lua/5.1/vim/shared.lua' no file '/home/runner/nvim-deps/usr/share/lua/5.1/vim/shared/init.lua' no file '/home/runner/nvim-deps/usr/lib/lua/5.1/vim/shared.lua' no file '/home/runner/nvim-deps/usr/lib/lua/5.1/vim/shared/init.lua' no file './vim/shared.so' ... E970: Failed to initialize builtin lua modules Solution: - Log to a private $NVIM_LOG_FILE in tests that intentionally fail and cause ERR log messages. - Assert that the expected messages are actually logged. --- test/functional/options/defaults_spec.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/functional/options') diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua index c0d820f40e..92b385c3b5 100644 --- a/test/functional/options/defaults_spec.lua +++ b/test/functional/options/defaults_spec.lua @@ -3,6 +3,8 @@ 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 retry = helpers.retry local meths = helpers.meths local command = helpers.command local clear = helpers.clear @@ -20,6 +22,8 @@ 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() local function expect_filetype(expected) @@ -275,6 +279,10 @@ 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, ",")') @@ -337,6 +345,7 @@ describe('XDG defaults', function() 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) @@ -351,6 +360,10 @@ describe('XDG defaults', function() end) it('are correctly set', function() + retry(nil, 1000, function() + 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' @@ -412,6 +425,7 @@ describe('XDG defaults', function() 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', @@ -422,6 +436,9 @@ describe('XDG defaults', function() end) it('are not expanded', function() + retry(nil, 1000, function() + 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' -- cgit From 665a7dafaf892b31285f35a43a90fc6e968fd7da Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 17 Jan 2023 00:12:59 +0100 Subject: refactor(tests): lift retry() into assert_log() --- test/functional/options/defaults_spec.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'test/functional/options') diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua index 92b385c3b5..6a28885bf0 100644 --- a/test/functional/options/defaults_spec.lua +++ b/test/functional/options/defaults_spec.lua @@ -4,7 +4,6 @@ local Screen = require('test.functional.ui.screen') local assert_alive = helpers.assert_alive local assert_log = helpers.assert_log -local retry = helpers.retry local meths = helpers.meths local command = helpers.command local clear = helpers.clear @@ -360,9 +359,7 @@ describe('XDG defaults', function() end) it('are correctly set', function() - retry(nil, 1000, function() - assert_log('Failed to start server: no such file or directory: /X/X/X', testlog, 10) - end) + assert_log('Failed to start server: no such file or directory: /X/X/X', testlog, 10) local vimruntime, libdir = vimruntime_and_libdir() @@ -436,9 +433,8 @@ describe('XDG defaults', function() end) it('are not expanded', function() - retry(nil, 1000, function() - assert_log('Failed to start server: no such file or directory: %$XDG_RUNTIME_DIR%/', testlog, 10) - end) + assert_log('Failed to start server: no such file or directory: %$XDG_RUNTIME_DIR%/', testlog, 10) + local vimruntime, libdir = vimruntime_and_libdir() eq((('$XDG_DATA_HOME/nvim' .. ',$XDG_DATA_DIRS/nvim' -- cgit From 6c2f02cbd02e8fd90e8ffae271dad3df48a54c4a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 17 Jan 2023 01:54:35 +0100 Subject: fix: failing XDG test on Windows CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Failing Windows CI: FAILED test/functional\options\defaults_spec.lua @ 361: XDG defaults with too long XDG variables are correctly set test\helpers.lua:134: Pattern "Failed to start server: no such file or directory: /X/X/X" not found in log (last 10 lines): Xtest-defaults-log: FAILED test/functional\options\defaults_spec.lua @ 435: XDG defaults with XDG variables that can be expanded are not expanded test\helpers.lua:134: Pattern "Failed to start server: no such file or directory: %$XDG_RUNTIME_DIR%/" not found in log (last 10 lines): Xtest-defaults-log: Solution: The assert_log() statements are not relevant on Windows, because there XDG_RUNTIME_DIR is not used for creating servers, it uses \\.pipe\…. --- test/functional/options/defaults_spec.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test/functional/options') diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua index 6a28885bf0..84ec43f4cb 100644 --- a/test/functional/options/defaults_spec.lua +++ b/test/functional/options/defaults_spec.lua @@ -359,7 +359,9 @@ describe('XDG defaults', function() end) it('are correctly set', function() - assert_log('Failed to start server: no such file or directory: /X/X/X', testlog, 10) + 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() @@ -433,7 +435,9 @@ describe('XDG defaults', function() end) it('are not expanded', function() - assert_log('Failed to start server: no such file or directory: %$XDG_RUNTIME_DIR%/', testlog, 10) + 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' -- cgit