From 5493fcd52f2eaab4b6a81c366529e80ca3dec535 Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Fri, 31 May 2024 08:25:40 -0500 Subject: test: remove checks for failed tests on Windows --- test/functional/core/startup_spec.lua | 6 ------ 1 file changed, 6 deletions(-) (limited to 'test/functional/core/startup_spec.lua') diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index a53625ab1b..1bb4ce2946 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -400,9 +400,6 @@ describe('startup', function() read_file('Xtest_startup_ttyout') ) end) - if is_os('win') then - assert_log('stream write failed. RPC canceled; closing channel', testlog) - end end) it('input from pipe: has("ttyin")==0 has("ttyout")==1', function() @@ -435,9 +432,6 @@ describe('startup', function() read_file('Xtest_startup_ttyout') ) end) - if is_os('win') then - assert_log('stream write failed. RPC canceled; closing channel', testlog) - end end) it('input from pipe (implicit) #7679', function() -- cgit From 5a8a34dafa2aa9e11df405745008543eef644bdc Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 22 Jun 2024 21:17:36 +0800 Subject: fix(filetype): source ftdetect/* after creating scripts.vim autocmds (#29445) --- test/functional/core/startup_spec.lua | 40 +++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) (limited to 'test/functional/core/startup_spec.lua') diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index 1bb4ce2946..45f8294b16 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -1325,31 +1325,59 @@ describe('runtime:', function() end) it("loads ftdetect/*.{vim,lua} respecting 'rtp' order", function() - local ftdetect_folder = table.concat({ xconfig, 'nvim', 'ftdetect' }, pathsep) - local after_ftdetect_folder = table.concat({ xconfig, 'nvim', 'after', 'ftdetect' }, pathsep) + local rtp_folder = table.concat({ xconfig, 'nvim' }, pathsep) + local after_rtp_folder = table.concat({ rtp_folder, 'after' }, pathsep) + local ftdetect_folder = table.concat({ rtp_folder, 'ftdetect' }, pathsep) + local after_ftdetect_folder = table.concat({ after_rtp_folder, 'ftdetect' }, pathsep) mkdir_p(ftdetect_folder) mkdir_p(after_ftdetect_folder) finally(function() rmdir(ftdetect_folder) rmdir(after_ftdetect_folder) end) + write_file(table.concat({ rtp_folder, 'scripts.vim' }, pathsep), [[let g:aseq ..= 'S']]) + write_file(table.concat({ after_rtp_folder, 'scripts.vim' }, pathsep), [[let g:aseq ..= 's']]) -- A .lua file is loaded after a .vim file if they only differ in extension. -- All files in after/ftdetect/ are loaded after all files in ftdetect/. - write_file(table.concat({ ftdetect_folder, 'new-ft.vim' }, pathsep), [[let g:seq ..= 'A']]) + write_file( + table.concat({ ftdetect_folder, 'new-ft.vim' }, pathsep), + [[ + let g:seq ..= 'A' + autocmd BufRead,BufNewFile FTDETECT let g:aseq ..= 'A' + ]] + ) write_file( table.concat({ ftdetect_folder, 'new-ft.lua' }, pathsep), - [[vim.g.seq = vim.g.seq .. 'B']] + [[ + vim.g.seq = vim.g.seq .. 'B' + vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { + pattern = 'FTDETECT', + command = "let g:aseq ..= 'B'", + }) + ]] ) write_file( table.concat({ after_ftdetect_folder, 'new-ft.vim' }, pathsep), - [[let g:seq ..= 'a']] + [[ + let g:seq ..= 'a' + autocmd BufRead,BufNewFile FTDETECT let g:aseq ..= 'a' + ]] ) write_file( table.concat({ after_ftdetect_folder, 'new-ft.lua' }, pathsep), - [[vim.g.seq = vim.g.seq .. 'b']] + [[ + vim.g.seq = vim.g.seq .. 'b' + vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { + pattern = 'FTDETECT', + command = "let g:aseq ..= 'b'", + }) + ]] ) clear { args_rm = { '-u' }, args = { '--cmd', 'let g:seq = ""' }, env = xenv } eq('ABab', eval('g:seq')) + command('let g:aseq = ""') + command('edit FTDETECT') + eq('SsABab', eval('g:aseq')) end) end) -- cgit From 93347a67bf913c72ab2c1ba0aa4b26cc4ba6d1a8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 6 Aug 2024 22:20:26 +0800 Subject: fix(filetype): fix :filetype detect error with -u NONE (#29991) :filetype detect should enable filetype detection when it hasn't been enabled before. --- test/functional/core/startup_spec.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/functional/core/startup_spec.lua') diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index 45f8294b16..8d6ba9712a 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -112,6 +112,13 @@ describe('startup', function() |*2 ]]) end) + + it(':filetype detect enables filetype detection with -u NONE', function() + clear() + eq('filetype detection:OFF plugin:OFF indent:OFF', exec_capture('filetype')) + command('filetype detect') + eq('filetype detection:ON plugin:OFF indent:OFF', exec_capture('filetype')) + end) end) describe('startup', function() -- cgit From ed832b9ddf45705abe9d7f4a50cedc27072c8e16 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 8 Sep 2024 21:29:20 +0200 Subject: refactor(test): rename alter_slashes, invert its behavior - `alter_slashes` belongs in `testutil.lua`, not `testnvim.lua`. - `alter_slashes` is an unusual name. Rename it to `fix_slashes`. - invert its behavior, to emphasize that `/` slashes are the preferred, pervasive convention, not `\` slashes. --- test/functional/core/startup_spec.lua | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'test/functional/core/startup_spec.lua') diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index 8d6ba9712a..f48bcb9360 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -27,7 +27,6 @@ local sleep = vim.uv.sleep local startswith = vim.startswith local write_file = t.write_file local api = n.api -local alter_slashes = n.alter_slashes local is_os = t.is_os local dedent = t.dedent local tbl_map = vim.tbl_map @@ -40,22 +39,15 @@ local testlog = 'Xtest-startupspec-log' describe('startup', function() it('--clean', function() clear() - ok( - string.find( - alter_slashes(api.nvim_get_option_value('runtimepath', {})), - fn.stdpath('config'), - 1, - true - ) ~= nil + matches( + vim.pesc(t.fix_slashes(fn.stdpath('config'))), + t.fix_slashes(api.nvim_get_option_value('runtimepath', {})) ) + clear('--clean') ok( - string.find( - alter_slashes(api.nvim_get_option_value('runtimepath', {})), - fn.stdpath('config'), - 1, - true - ) == nil + not t.fix_slashes(api.nvim_get_option_value('runtimepath', {})) + :match(vim.pesc(t.fix_slashes(fn.stdpath('config')))) ) end) -- cgit