Skip to content
Snippets Groups Projects
Commit 40886bd6 authored by Simon McVittie's avatar Simon McVittie
Browse files

tests: Add shell_like

parent 62b3b0ab
No related branches found
No related tags found
1 merge request!311Build capsule-capture-libs from a bundled copy of libcapsule
......@@ -132,6 +132,29 @@ shell_is () {
fi
}
shell_like () {
local command="$1"
local expected_status="$2"
local expected="$3"
local status=0
shift 3
echo_tap "# \$($command)..."
got="$(eval "$command")" || status="$?"
if [ "x$status" != "x$expected_status" ]; then
fail "$* (status $status != $expected_status)"
fi
if [[ $got == $expected ]]; then
pass "$* ($got matches $expected)"
else
echo_tap "# Got: $got"
echo_tap "# Expected extglob: $expected"
fail "$* ($got does not match extglob $expected)"
fi
}
run_verbose () {
echo_tap "# \$($*)..."
"$@"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment