From c598bf99c645e1c5ae2283d39242db6c7c07d654 Mon Sep 17 00:00:00 2001 From: pvincent Date: Sat, 1 Aug 2026 12:14:38 +0400 Subject: [PATCH] miaou-test eval cmd --- test/miaou-bash.test.bash | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/test/miaou-bash.test.bash b/test/miaou-bash.test.bash index 1b48e9a..aec0972 100755 --- a/test/miaou-bash.test.bash +++ b/test/miaou-bash.test.bash @@ -27,8 +27,7 @@ function assert_grep { ((test_count++)) local script="$1" content="$2" 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 echo -n . return @@ -44,9 +43,9 @@ function fail_type { success=false 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)" - - 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 last_error="${stderr[-1]}" @@ -59,11 +58,11 @@ function fail_type { if [[ $success == true ]]; then echo -n . - else - echo -n F - failures+=("$1") - return 1 + return fi + echo -n F + failures+=("$cmd") + return 1 } # main @@ -101,7 +100,7 @@ if [[ $failed -gt 0 ]]; then echo "${ratio}% passed, ${test_count} tests, ${failed} failed!" echo failures: for failure in "${failures[@]}"; do - echo -e "\t- $failure => replay: ./test/stub/scenario.bash $failure" + echo -e "\t- $failure" done exit 1 else