From 743860de40502227b3f0ed64317eb937d24d4a36 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 4 Apr 2023 21:59:06 +0200 Subject: test: replace lfs with luv and vim.fs test: replace lfs with luv luv already pretty much does everything lfs does, so this duplication of dependencies isn't needed. --- test/functional/core/main_spec.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test/functional/core/main_spec.lua') diff --git a/test/functional/core/main_spec.lua b/test/functional/core/main_spec.lua index ab11e14a67..efab40dd11 100644 --- a/test/functional/core/main_spec.lua +++ b/test/functional/core/main_spec.lua @@ -1,4 +1,4 @@ -local lfs = require('lfs') +local luv = require('luv') local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') @@ -28,18 +28,18 @@ describe('Command-line option', function() os.remove(dollar_fname) end) it('treats - as stdin', function() - eq(nil, lfs.attributes(fname)) + eq(nil, luv.fs_stat(fname)) funcs.system( {nvim_prog_abs(), '-u', 'NONE', '-i', 'NONE', '--headless', '--cmd', 'set noswapfile shortmess+=IFW fileformats=unix', '-s', '-', fname}, {':call setline(1, "42")', ':wqall!', ''}) eq(0, eval('v:shell_error')) - local attrs = lfs.attributes(fname) + local attrs = luv.fs_stat(fname) eq(#('42\n'), attrs.size) end) it('does not expand $VAR', function() - eq(nil, lfs.attributes(fname)) + eq(nil, luv.fs_stat(fname)) eq(true, not not dollar_fname:find('%$%w+')) write_file(dollar_fname, ':call setline(1, "100500")\n:wqall!\n') funcs.system( @@ -47,7 +47,7 @@ describe('Command-line option', function() '--cmd', 'set noswapfile shortmess+=IFW fileformats=unix', '-s', dollar_fname, fname}) eq(0, eval('v:shell_error')) - local attrs = lfs.attributes(fname) + local attrs = luv.fs_stat(fname) eq(#('100500\n'), attrs.size) end) it('does not crash after reading from stdin in non-headless mode', function() @@ -121,7 +121,7 @@ describe('Command-line option', function() '--cmd', 'language C', '-s', fname, '-s', dollar_fname, fname_2})) eq(2, eval('v:shell_error')) - eq(nil, lfs.attributes(fname_2)) + eq(nil, luv.fs_stat(fname_2)) end) end) end) -- cgit From 43ded8d3584477ab14731486cfb0e86534f2b2dc Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 1 Jul 2023 03:45:45 -0700 Subject: feat(version): unverbose ":version", ":verbose version" #24195 Problem: `nvim -v` and `:version` prints system vimrc, fallback files, and compilation info by default, which most people don't care about and just clutters up the output. Solution: Omit extra info unless 'verbose' is set. --- test/functional/core/main_spec.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'test/functional/core/main_spec.lua') diff --git a/test/functional/core/main_spec.lua b/test/functional/core/main_spec.lua index efab40dd11..19c7a93730 100644 --- a/test/functional/core/main_spec.lua +++ b/test/functional/core/main_spec.lua @@ -3,6 +3,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local eq = helpers.eq +local matches = helpers.matches local feed = helpers.feed local eval = helpers.eval local clear = helpers.clear @@ -12,21 +13,24 @@ local write_file = helpers.write_file local is_os = helpers.is_os local skip = helpers.skip -describe('Command-line option', function() +describe('command-line option', function() describe('-s', function() local fname = 'Xtest-functional-core-main-s' local fname_2 = fname .. '.2' local nonexistent_fname = fname .. '.nonexistent' local dollar_fname = '$' .. fname + before_each(function() clear() os.remove(fname) os.remove(dollar_fname) end) + after_each(function() os.remove(fname) os.remove(dollar_fname) end) + it('treats - as stdin', function() eq(nil, luv.fs_stat(fname)) funcs.system( @@ -38,6 +42,7 @@ describe('Command-line option', function() local attrs = luv.fs_stat(fname) eq(#('42\n'), attrs.size) end) + it('does not expand $VAR', function() eq(nil, luv.fs_stat(fname)) eq(true, not not dollar_fname:find('%$%w+')) @@ -50,6 +55,7 @@ describe('Command-line option', function() local attrs = luv.fs_stat(fname) eq(#('100500\n'), attrs.size) end) + it('does not crash after reading from stdin in non-headless mode', function() skip(is_os('win')) local screen = Screen.new(40, 8) @@ -100,6 +106,7 @@ describe('Command-line option', function() ]]) ]=] end) + it('errors out when trying to use nonexistent file with -s', function() eq( 'Cannot open for reading: "'..nonexistent_fname..'": no such file or directory\n', @@ -110,6 +117,7 @@ describe('Command-line option', function() '-s', nonexistent_fname})) eq(2, eval('v:shell_error')) end) + it('errors out when trying to use -s twice', function() write_file(fname, ':call setline(1, "1")\n:wqall!\n') write_file(dollar_fname, ':call setline(1, "2")\n:wqall!\n') @@ -124,4 +132,11 @@ describe('Command-line option', function() eq(nil, luv.fs_stat(fname_2)) end) end) + + it('nvim -v, :version', function() + matches('Run ":verbose version"', funcs.execute(':version')) + matches('Compilation: .*Run :checkhealth', funcs.execute(':verbose version')) + matches('Run "nvim %-V1 %-v"', funcs.system({nvim_prog_abs(), '-v'})) + matches('Compilation: .*Run :checkhealth', funcs.system({nvim_prog_abs(), '-V1', '-v'})) + end) end) -- cgit