aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/nvim.13
-rw-r--r--runtime/doc/diff.txt3
-rw-r--r--runtime/doc/vim_diff.txt5
-rw-r--r--src/nvim/testdir/test_startup.vim80
-rw-r--r--test/helpers.lua5
5 files changed, 80 insertions, 16 deletions
diff --git a/man/nvim.1 b/man/nvim.1
index 9e7da629f7..305551c7d4 100644
--- a/man/nvim.1
+++ b/man/nvim.1
@@ -113,9 +113,6 @@ associated with a file.
To overwrite a file, add an exclamation mark to the relevant Ex command, such as
.Ic :w! .
.Ic ":help 'readonly'"
-.It Fl Z
-Restricted mode.
-Disable commands that make use of an external shell.
.It Fl m
Resets the 'write' option, to disable file modifications.
Writing to a file is disabled, but buffers can still be modified.
diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt
index 20eaa47b26..2a972483ff 100644
--- a/runtime/doc/diff.txt
+++ b/runtime/doc/diff.txt
@@ -20,8 +20,7 @@ additionally sets up for viewing the differences between the arguments. >
nvim -d file1 file2 [file3 [file4]]
-In addition to the |-d| argument, |-R| may be used for readonly mode
-respectively.
+In addition to the |-d| argument, |-R| may be used for readonly mode.
The second and following arguments may also be a directory name. Vim will
then append the file name of the first argument to the directory name to find
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index ac24f22bc6..0f15aefd17 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -416,8 +416,8 @@ Aliases:
gvimdiff (GUI)
rgview (GUI)
rgvim (GUI)
- rview (alias for "nvim -RZ")
- rvim (alias for "nvim -Z")
+ rview
+ rvim
view (alias for "nvim -R")
vimdiff (alias for "nvim -d" |diff-mode|)
@@ -496,6 +496,7 @@ Startup:
--literal (file args are always literal; to expand wildcards on Windows, use
|:n| e.g. `nvim +"n *"`)
Easy mode: eview, evim, nvim -y
+ Restricted mode: rview, rvim, nvim -Z
Vi mode: nvim -v
Test functions:
diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim
index 12bec745a8..7fe0168356 100644
--- a/src/nvim/testdir/test_startup.vim
+++ b/src/nvim/testdir/test_startup.vim
@@ -2,6 +2,8 @@
source shared.vim
source screendump.vim
+source term_util.vim
+source check.vim
" Check that loading startup.vim works.
func Test_startup_script()
@@ -278,6 +280,68 @@ func Test_V_arg()
" call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nline 1: \" The default vimrc file\..* verbose=15\n", out)
endfunc
+" Test the '-q [errorfile]' argument.
+func Test_q_arg()
+ CheckFeature quickfix
+
+ let lines =<< trim END
+ /* some file with an error */
+ main() {
+ functionCall(arg; arg, arg);
+ return 666
+ }
+ END
+ call writefile(lines, 'Xbadfile.c')
+
+ let after =<< trim [CODE]
+ call writefile([&errorfile, string(getpos("."))], "Xtestout")
+ copen
+ w >> Xtestout
+ qall
+ [CODE]
+
+ " Test with default argument '-q'.
+ call assert_equal('errors.err', &errorfile)
+ call writefile(["Xbadfile.c:4:12: error: expected ';' before '}' token"], 'errors.err')
+ if RunVim([], after, '-q')
+ let lines = readfile('Xtestout')
+ call assert_equal(['errors.err',
+ \ '[0, 4, 12, 0]',
+ \ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"],
+ \ lines)
+ endif
+ call delete('Xtestout')
+ call delete('errors.err')
+
+ " Test with explicit argument '-q Xerrors' (with space).
+ call writefile(["Xbadfile.c:4:12: error: expected ';' before '}' token"], 'Xerrors')
+ if RunVim([], after, '-q Xerrors')
+ let lines = readfile('Xtestout')
+ call assert_equal(['Xerrors',
+ \ '[0, 4, 12, 0]',
+ \ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"],
+ \ lines)
+ endif
+ call delete('Xtestout')
+
+ " Test with explicit argument '-qXerrors' (without space).
+ if RunVim([], after, '-qXerrors')
+ let lines = readfile('Xtestout')
+ call assert_equal(['Xerrors',
+ \ '[0, 4, 12, 0]',
+ \ "Xbadfile.c|4 col 12| error: expected ';' before '}' token"],
+ \ lines)
+ endif
+
+ " Test with a non-existing error file (exits with value 3)
+ let out = system(GetVimCommand() .. ' -q xyz.err')
+ call assert_equal(3, v:shell_error)
+
+ call delete('Xbadfile.c')
+ call delete('Xtestout')
+ call delete('Xerrors')
+endfunc
+
" Test the -V[N]{filename} argument to set the 'verbose' option to N
" and set 'verbosefile' to filename.
func Test_V_file_arg()
@@ -408,13 +472,15 @@ func Test_invalid_args()
let out = split(system(GetVimCommand() .. ' - xxx -cq'), "\n")
call assert_equal(0, v:shell_error)
- " Detect invalid repeated arguments '-t foo -t foo", '-q foo -q foo'.
- for opt in ['-t', '-q']
- let out = split(system(GetVimCommand() .. repeat(' ' .. opt .. ' foo', 2)), "\n")
- call assert_equal(1, v:shell_error)
- call assert_equal('nvim: Too many edit arguments: "' .. opt .. '"', out[0])
- call assert_equal('More info with "nvim -h"', out[1])
- endfor
+ if has('quickfix')
+ " Detect invalid repeated arguments '-t foo -t foo", '-q foo -q foo'.
+ for opt in ['-t', '-q']
+ let out = split(system(GetVimCommand() .. repeat(' ' .. opt .. ' foo', 2)), "\n")
+ call assert_equal(1, v:shell_error)
+ call assert_equal('nvim: Too many edit arguments: "' .. opt .. '"', out[0])
+ call assert_equal('More info with "nvim -h"', out[1])
+ endfor
+ endif
for opt in [' -cq', ' --cmd q', ' +', ' -S foo']
let out = split(system(GetVimCommand() .. repeat(opt, 11)), "\n")
diff --git a/test/helpers.lua b/test/helpers.lua
index 84148dc1a8..8dbd82cb8c 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -777,11 +777,12 @@ end
function module.isCI(name)
local any = (name == nil)
- assert(any or name == 'appveyor' or name == 'travis' or name == 'sourcehut')
+ assert(any or name == 'appveyor' or name == 'travis' or name == 'sourcehut' or name == 'github')
local av = ((any or name == 'appveyor') and nil ~= os.getenv('APPVEYOR'))
local tr = ((any or name == 'travis') and nil ~= os.getenv('TRAVIS'))
local sh = ((any or name == 'sourcehut') and nil ~= os.getenv('SOURCEHUT'))
- return tr or av or sh
+ local gh = ((any or name == 'github') and nil ~= os.getenv('GITHUB_ACTIONS'))
+ return tr or av or sh or gh
end