Added `declare` as an alias for `set` expectation
parent
93b6b6d7f5
commit
8a73619b0d
|
@ -64,3 +64,12 @@ _expect--set()
|
|||
esac
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# Alias for `set`
|
||||
#
|
||||
_expect--declare()
|
||||
{
|
||||
_expect--set "$@"
|
||||
}
|
||||
|
||||
|
|
|
@ -26,12 +26,16 @@ declare -- empty=""
|
|||
declare -- one="1"'
|
||||
|
||||
|
||||
declare curchk
|
||||
function setchk()
|
||||
{
|
||||
_expect--set 0 4 <(:) <( echo "$stubenv" ) "$@"
|
||||
_expect--$curchk 0 4 <(:) <( echo "$stubenv" ) "$@"
|
||||
}
|
||||
|
||||
|
||||
for name in set declare; do
|
||||
curchk=$name
|
||||
|
||||
describe set
|
||||
describe = and == operators
|
||||
it succeeds on string equality
|
||||
|
@ -72,7 +76,8 @@ describe set
|
|||
to succeed
|
||||
end
|
||||
|
||||
# note that this also ensures that *all* arguments are part of the match
|
||||
# note that this also ensures that *all* arguments are part of the
|
||||
# match
|
||||
it fails on a mismatch
|
||||
expect setchk \
|
||||
long =~ fo+ baX baz\$
|
||||
|
@ -198,10 +203,11 @@ describe set
|
|||
# primarily for safety and strict documentation, but no other tests make
|
||||
# sense at the moment
|
||||
it fails on unrecognized operators
|
||||
# shell injection (not that this is realistically a problem, because we
|
||||
# can execute arbitrary shell code anyway)
|
||||
# shell injection (not that this is realistically a problem, because
|
||||
# we can execute arbitrary shell code anyway)
|
||||
expect setchk var "!= foo -a 1 -eq" 1
|
||||
to fail
|
||||
end
|
||||
end
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in New Issue