`match' handler now defined in terms of output abstraction
Consequently, now supports `on' clause.env
parent
8858a8dce3
commit
914dafc62a
|
@ -165,9 +165,12 @@ __expect--output-clause()
|
|||
# in regex(3))
|
||||
_expect--match()
|
||||
{
|
||||
shift "$2"
|
||||
local -r pat="$1"
|
||||
__expect--output-cmd '__expect--match-do' "$@"
|
||||
}
|
||||
|
||||
__expect--match-do()
|
||||
{
|
||||
local -r pat="$1"
|
||||
[[ "$(cat)" =~ $pat ]]
|
||||
}
|
||||
|
||||
|
|
|
@ -119,6 +119,14 @@ describe match
|
|||
to succeed
|
||||
end
|
||||
|
||||
# by convention, stderr file passed as third argument
|
||||
it can assert against stderr output
|
||||
{
|
||||
expect _expect--match 0 3 /dev/fd/3 "stderr" on stderr
|
||||
to succeed
|
||||
} 3< <( echo "test stderr" )
|
||||
end
|
||||
|
||||
it ignores exit code
|
||||
expect _expect--match 1 2 "foo" <<< "foo"
|
||||
to succeed
|
||||
|
|
Loading…
Reference in New Issue