mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
tests/invocation: Remove local
Instead this runs the `test_file` function in a subshell, which is the POSIXy way of doing this. Overly magic? Sure. Standard? Indeed.
This commit is contained in:
parent
3e2e44b673
commit
84593e1519
@ -147,23 +147,22 @@ filter() {
|
|||||||
|
|
||||||
##
|
##
|
||||||
# Actual testing of a .invoke file.
|
# Actual testing of a .invoke file.
|
||||||
test_file() {
|
test_file() (
|
||||||
local file="$1"
|
file="$1"
|
||||||
local dir="$(dirname "$file")"
|
dir="$(dirname "$file")"
|
||||||
local base="$(basename "$file" .invoke)"
|
base="$(basename "$file" .invoke)"
|
||||||
local test_config="${dir}/${base}.config"
|
test_config="${dir}/${base}.config"
|
||||||
local test_stdout="${dir}/${base}.tmp.out"
|
test_stdout="${dir}/${base}.tmp.out"
|
||||||
local test_stderr="${dir}/${base}.tmp.err"
|
test_stderr="${dir}/${base}.tmp.err"
|
||||||
local want_stdout="${dir}/${base}.out"
|
want_stdout="${dir}/${base}.out"
|
||||||
local grep_stdout="${dir}/${base}.grep"
|
grep_stdout="${dir}/${base}.grep"
|
||||||
local want_stderr="${dir}/${base}.err"
|
want_stderr="${dir}/${base}.err"
|
||||||
local empty="${dir}/${base}.empty"
|
empty="${dir}/${base}.empty"
|
||||||
local filter
|
rc=0
|
||||||
local rc=0
|
test_args_literal=
|
||||||
local test_args_literal
|
test_args=
|
||||||
local test_args
|
out_status=0
|
||||||
local out_status=0
|
err_status=0
|
||||||
local err_status=0
|
|
||||||
|
|
||||||
# Literal arguments, for printing
|
# Literal arguments, for printing
|
||||||
test_args_literal="$(cat "$file")"
|
test_args_literal="$(cat "$file")"
|
||||||
@ -269,7 +268,7 @@ test_file() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
return $rc
|
return $rc
|
||||||
}
|
)
|
||||||
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user