sh: Add tests for 'local -' (save shell options).
This commit is contained in:
parent
4ea862e26e
commit
b624da1ad8
17
tools/regression/bin/sh/builtins/local2.0
Normal file
17
tools/regression/bin/sh/builtins/local2.0
Normal file
@ -0,0 +1,17 @@
|
||||
# $FreeBSD$
|
||||
|
||||
f() {
|
||||
local -
|
||||
set -a
|
||||
case $- in
|
||||
*a*) : ;;
|
||||
*) echo In-function \$- bad
|
||||
esac
|
||||
}
|
||||
case $- in
|
||||
*a*) echo Initial \$- bad
|
||||
esac
|
||||
f
|
||||
case $- in
|
||||
*a*) echo Final \$- bad
|
||||
esac
|
26
tools/regression/bin/sh/builtins/local3.0
Normal file
26
tools/regression/bin/sh/builtins/local3.0
Normal file
@ -0,0 +1,26 @@
|
||||
# $FreeBSD$
|
||||
|
||||
f() {
|
||||
local "$@"
|
||||
set -a
|
||||
x=7
|
||||
case $- in
|
||||
*a*) : ;;
|
||||
*) echo In-function \$- bad
|
||||
esac
|
||||
[ "$x" = 7 ] || echo In-function \$x bad
|
||||
}
|
||||
x=1
|
||||
case $- in
|
||||
*a*) echo Initial \$- bad
|
||||
esac
|
||||
f x -
|
||||
case $- in
|
||||
*a*) echo Intermediate \$- bad
|
||||
esac
|
||||
[ "$x" = 1 ] || echo Intermediate \$x bad
|
||||
f - x
|
||||
case $- in
|
||||
*a*) echo Final \$- bad
|
||||
esac
|
||||
[ "$x" = 1 ] || echo Final \$x bad
|
Loading…
x
Reference in New Issue
Block a user