tests: Override __fish_print_help

This effectively disables "--help", replacing it with just a stand-in
string.

The upshot is that it makes the test suite immune to whether or not it
can find the documentation - until now it needed to *not* find it,
which is weird.

(also it saves some useless lines)

Fixes #11270
This commit is contained in:
Fabian Boehm
2025-03-13 18:11:55 +01:00
parent 7224776f80
commit 6627d403d3
10 changed files with 19 additions and 39 deletions

View File

@@ -113,40 +113,28 @@ echo comment after conjunction
# --help works
builtin and --help >/dev/null
# CHECKERR: fish: and: missing man page
# CHECKERR: Documentation may not be installed.
# CHECKERR: `help and` will show an online version
# CHECKERR: Documentation for and
echo $status
and --help >/dev/null
# CHECKERR: fish: and: missing man page
# CHECKERR: Documentation may not be installed.
# CHECKERR: `help and` will show an online version
# CHECKERR: Documentation for and
echo $status
# CHECK: 0
# CHECK: 0
builtin or --help >/dev/null
# CHECKERR: fish: or: missing man page
# CHECKERR: Documentation may not be installed.
# CHECKERR: `help or` will show an online version
# CHECKERR: Documentation for or
echo $status
or --help >/dev/null
# CHECKERR: fish: or: missing man page
# CHECKERR: Documentation may not be installed.
# CHECKERR: `help or` will show an online version
# CHECKERR: Documentation for or
echo $status
# CHECK: 0
# CHECK: 0
builtin not --help >/dev/null
# CHECKERR: fish: not: missing man page
# CHECKERR: Documentation may not be installed.
# CHECKERR: `help not` will show an online version
# CHECKERR: Documentation for not
echo $status
not --help >/dev/null
# CHECKERR: fish: not: missing man page
# CHECKERR: Documentation may not be installed.
# CHECKERR: `help not` will show an online version
# CHECKERR: Documentation for not
echo $status
# CHECK: 0
# CHECK: 0

View File

@@ -10,7 +10,7 @@ builtin -nq string
echo $status
#CHECK: 2
builtin -- -q &| grep -q "builtin - run a builtin command\|fish: builtin: missing man page"
builtin -- -q &| grep -q "Documentation for builtin"
echo $status
#CHECK: 0

View File

@@ -342,9 +342,7 @@ echo foo | $pager
#CHECKERR: ^~~~~^
"command" -h
#CHECKERR: fish: command: missing man page
#CHECKERR: Documentation may not be installed.
#CHECKERR: `help command` will show an online version
#CHECKERR: Documentation for command
echo {~,asdf}
# CHECK: /{{.*}} asdf

View File

@@ -10,9 +10,7 @@ echo $status
# CHECK: 34
! -h
# CHECKERR: fish: !: missing man page
# CHECKERR: Documentation may not be installed.
# CHECKERR: `help !` will show an online version
# CHECKERR: Documentation for !
function !
echo overridden! $argv

View File

@@ -11,6 +11,6 @@ echo '.\" Test manpage for and (not real).
and \- conditionally execute a command' >$__fish_data_dir/man/man1/and.1
# help should be redirected to grep instead of appearing on STDOUT
builtin and --help | grep -q "and - conditionally execute a command"
builtin and --help 2>| grep -q "Documentation for and"
echo $status
#CHECK: 0

View File

@@ -57,5 +57,5 @@ else
end
#CHECK: psub directory was deleted
set -l diffs (comm -3 (__fish_print_help psub | psub) (psub -hs banana | psub))
set -l diffs (comm -3 (__fish_print_help psub 2>| psub) (psub -hs banana 2>| psub))
test -z "$diffs"

View File

@@ -241,9 +241,7 @@ echo 7 $status # no passthrough
#CHECK: 7 4
false
set -h >/dev/null
# CHECKERR: fish: set: missing man page
# CHECKERR: Documentation may not be installed.
# CHECKERR: `help set` will show an online version
# CHECKERR: Documentation for set
echo 8 $status # no passthrough
#CHECK: 8 0

View File

@@ -86,9 +86,7 @@ $fish -c 'begin --notanoption; end'
# CHECKERR: ^~~~~~~~~~~~^
$fish -c 'begin --help'
# CHECKERR: fish: begin: missing man page
# CHECKERR: Documentation may not be installed.
# CHECKERR: `help begin` will show an online version
# CHECKERR: Documentation for begin
$fish -c 'echo (for status in foo; end)'
# CHECKERR: fish: for: status: cannot overwrite read-only variable

View File

@@ -46,13 +46,9 @@ not time a=b true
# Currently illegal syntax. Same in zsh. POSIX shells call the external command "time" here.
a=b time true
#CHECKERR: fish: time: missing man page
#CHECKERR: Documentation may not be installed.
#CHECKERR: `help time` will show an online version
#CHECKERR: Documentation for time
not a=b time true
#CHECKERR: fish: time: missing man page
#CHECKERR: Documentation may not be installed.
#CHECKERR: `help time` will show an online version
#CHECKERR: Documentation for time
$fish -c 'time true&'
#CHECKERR: fish: {{.*}}

View File

@@ -0,0 +1,4 @@
function __fish_print_help
echo Documentation for $argv >&2
return 1
end