|
|
@ -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 miaou-bash ./test/stub/scenario.bash "$script" "${extra_args[@]}" >_stdout 2>/dev/null 3>/dev/null; then |
|
|
|
|
|
|
|
|
if ./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)" |
|
|
|
|
|
|
|
|
miaou-bash ./test/stub/scenario.bash $1 >/dev/null 2>_stderr 3>_miaou |
|
|
|
|
|
|
|
|
eval "$cmd" >/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 |
|
|
|
|
|
echo -n F |
|
|
|
|
|
failures+=("$1") |
|
|
|
|
|
return 1 |
|
|
|
|
|
|
|
|
return |
|
|
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 |
|
|
|