Browse Source

no more eval

main
pvincent 1 week ago
parent
commit
c6a63918be
  1. 10
      test/miaou-bash.test.bash

10
test/miaou-bash.test.bash

@ -7,7 +7,7 @@
function assert {
((test_count++))
cmd="./test/stub/scenario.bash $1"
if eval "$cmd" >/dev/null 2>/dev/null 3>_miaou; then
if $cmd >/dev/null 2>/dev/null 3>_miaou; then
if [[ -s _miaou ]]; then
echo -n .
return
@ -28,14 +28,16 @@ function assert_grep {
((test_count++))
local script="$1" content="$2" extra_args=()
[[ $# -gt 3 ]] && shift 3 && extra_args=("$@")
if ./test/stub/scenario.bash "$script" "${extra_args[@]}" >_stdout 2>/dev/null 3>/dev/null; then
#TODO: quote extra_args
cmd="./test/stub/scenario.bash $script"
if $cmd "${extra_args[@]}" >_stdout 2>/dev/null 3>/dev/null; then
if grep -q "$content" _stdout; then
echo -n .
return
fi
fi
echo -n F
failures+=("$script")
failures+=("$cmd")
return 1
}
function fail_type {
@ -46,7 +48,7 @@ function fail_type {
cmd="./test/stub/scenario.bash $1"
# 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
$cmd >/dev/null 2>_stderr 3>_miaou
mapfile -t stderr <_stderr
last_error="${stderr[-1]}"

Loading…
Cancel
Save