miaou-test eval cmd
This commit is contained in:
@@ -27,8 +27,7 @@ function assert_grep {
|
|||||||
((test_count++))
|
((test_count++))
|
||||||
local script="$1" content="$2" extra_args=()
|
local script="$1" content="$2" extra_args=()
|
||||||
[[ $# -gt 3 ]] && shift 3 && extra_args=("$@")
|
[[ $# -gt 3 ]] && shift 3 && extra_args=("$@")
|
||||||
|
if ./test/stub/scenario.bash "$script" "${extra_args[@]}" >_stdout 2>/dev/null 3>/dev/null; then
|
||||||
if miaou-bash ./test/stub/scenario.bash "$script" "${extra_args[@]}" >_stdout 2>/dev/null 3>/dev/null; then
|
|
||||||
if grep -q "$content" _stdout; then
|
if grep -q "$content" _stdout; then
|
||||||
echo -n .
|
echo -n .
|
||||||
return
|
return
|
||||||
@@ -44,9 +43,9 @@ function fail_type {
|
|||||||
success=false
|
success=false
|
||||||
hint_message="${3:-}"
|
hint_message="${3:-}"
|
||||||
|
|
||||||
|
cmd="./test/stub/scenario.bash $1"
|
||||||
# mapfile -t stderr <<<"$(miaou-bash ./test/stub/scenario.bash "$1" 2>&1 >/dev/null 3>/dev/null)"
|
# mapfile -t stderr <<<"$(miaou-bash ./test/stub/scenario.bash "$1" 2>&1 >/dev/null 3>/dev/null)"
|
||||||
|
eval "$cmd" >/dev/null 2>_stderr 3>_miaou
|
||||||
miaou-bash ./test/stub/scenario.bash $1 >/dev/null 2>_stderr 3>_miaou
|
|
||||||
mapfile -t stderr <_stderr
|
mapfile -t stderr <_stderr
|
||||||
|
|
||||||
last_error="${stderr[-1]}"
|
last_error="${stderr[-1]}"
|
||||||
@@ -59,11 +58,11 @@ function fail_type {
|
|||||||
|
|
||||||
if [[ $success == true ]]; then
|
if [[ $success == true ]]; then
|
||||||
echo -n .
|
echo -n .
|
||||||
else
|
return
|
||||||
echo -n F
|
|
||||||
failures+=("$1")
|
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
|
echo -n F
|
||||||
|
failures+=("$cmd")
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# main
|
# main
|
||||||
@@ -101,7 +100,7 @@ if [[ $failed -gt 0 ]]; then
|
|||||||
echo "${ratio}% passed, ${test_count} tests, ${failed} failed!"
|
echo "${ratio}% passed, ${test_count} tests, ${failed} failed!"
|
||||||
echo failures:
|
echo failures:
|
||||||
for failure in "${failures[@]}"; do
|
for failure in "${failures[@]}"; do
|
||||||
echo -e "\t- $failure => replay: ./test/stub/scenario.bash $failure"
|
echo -e "\t- $failure"
|
||||||
done
|
done
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user