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