|
|
@ -12,7 +12,7 @@ readonly TMP_DIRECTORY TMP_OUT TMP_ERR TMP_MIAOU |
|
|
|
|
|
|
|
|
function assert { |
|
|
function assert { |
|
|
((test_count++)) |
|
|
((test_count++)) |
|
|
cmd="./test/stub/scenario.bash $1" |
|
|
|
|
|
|
|
|
cmd="$MIAOU_BASH_DIR/test/stub/scenario.bash $1" |
|
|
if $cmd >/dev/null 2>/dev/null 3>"$TMP_MIAOU"; then |
|
|
if $cmd >/dev/null 2>/dev/null 3>"$TMP_MIAOU"; then |
|
|
if [[ -s "$TMP_MIAOU" ]]; then |
|
|
if [[ -s "$TMP_MIAOU" ]]; then |
|
|
echo -n . |
|
|
echo -n . |
|
|
@ -34,7 +34,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=("$@") |
|
|
cmd="./test/stub/scenario.bash $script" |
|
|
|
|
|
|
|
|
cmd="$MIAOU_BASH_DIR/test/stub/scenario.bash $script" |
|
|
if $cmd "${extra_args[@]}" >"$TMP_OUT" 2>/dev/null 3>/dev/null; then |
|
|
if $cmd "${extra_args[@]}" >"$TMP_OUT" 2>/dev/null 3>/dev/null; then |
|
|
if grep -q "$content" "$TMP_OUT"; then |
|
|
if grep -q "$content" "$TMP_OUT"; then |
|
|
echo -n . |
|
|
echo -n . |
|
|
@ -54,7 +54,7 @@ function fail_type { |
|
|
success=false |
|
|
success=false |
|
|
hint_message="${3:-}" |
|
|
hint_message="${3:-}" |
|
|
|
|
|
|
|
|
cmd="./test/stub/scenario.bash $1" |
|
|
|
|
|
|
|
|
cmd="$MIAOU_BASH_DIR/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)" |
|
|
$cmd >/dev/null 2>"$TMP_ERR" 3>"$TMP_MIAOU" |
|
|
$cmd >/dev/null 2>"$TMP_ERR" 3>"$TMP_MIAOU" |
|
|
mapfile -t stderr <"$TMP_ERR" |
|
|
mapfile -t stderr <"$TMP_ERR" |
|
|
@ -78,7 +78,7 @@ function fail_type { |
|
|
|
|
|
|
|
|
function fail_stderr_grep { |
|
|
function fail_stderr_grep { |
|
|
((test_count++)) |
|
|
((test_count++)) |
|
|
cmd="./test/stub/scenario.bash $1" |
|
|
|
|
|
|
|
|
cmd="$MIAOU_BASH_DIR/test/stub/scenario.bash $1" |
|
|
stderr_line="$2" |
|
|
stderr_line="$2" |
|
|
if ! $cmd 2>"$TMP_ERR" 3>/dev/null && grep -q "$stderr_line" "$TMP_ERR"; then |
|
|
if ! $cmd 2>"$TMP_ERR" 3>/dev/null && grep -q "$stderr_line" "$TMP_ERR"; then |
|
|
echo -n . |
|
|
echo -n . |
|
|
@ -94,8 +94,7 @@ function fail_stderr_count { |
|
|
((test_count++)) |
|
|
((test_count++)) |
|
|
local regex count="$2" |
|
|
local regex count="$2" |
|
|
|
|
|
|
|
|
cmd="./test/stub/scenario.bash $1" |
|
|
|
|
|
# mapfile -t stderr <<<"$(miaou-bash ./test/stub/scenario.bash "$1" 2>&1 >/dev/null 3>/dev/null)" |
|
|
|
|
|
|
|
|
cmd="$MIAOU_BASH_DIR/test/stub/scenario.bash $1" |
|
|
if ! $cmd >/dev/null 2>"$TMP_ERR" 3>/dev/null; then |
|
|
if ! $cmd >/dev/null 2>"$TMP_ERR" 3>/dev/null; then |
|
|
mapfile -t stderr <"$TMP_ERR" |
|
|
mapfile -t stderr <"$TMP_ERR" |
|
|
if [[ "${#stderr[@]}" == "$count" ]]; then |
|
|
if [[ "${#stderr[@]}" == "$count" ]]; then |
|
|
@ -113,7 +112,7 @@ function fail_miaou_count { |
|
|
((test_count++)) |
|
|
((test_count++)) |
|
|
local regex count="$2" |
|
|
local regex count="$2" |
|
|
|
|
|
|
|
|
cmd="./test/stub/scenario.bash $1" |
|
|
|
|
|
|
|
|
cmd="$MIAOU_BASH_DIR/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)" |
|
|
if ! $cmd >/dev/null 2>/dev/null 3>"$TMP_MIAOU"; then |
|
|
if ! $cmd >/dev/null 2>/dev/null 3>"$TMP_MIAOU"; then |
|
|
mapfile -t miaou <"$TMP_MIAOU" |
|
|
mapfile -t miaou <"$TMP_MIAOU" |
|
|
@ -131,6 +130,8 @@ function fail_miaou_count { |
|
|
|
|
|
|
|
|
set -uo pipefail |
|
|
set -uo pipefail |
|
|
|
|
|
|
|
|
|
|
|
[[ ! -v MIAOU_BASH_DIR ]] && >&2 echo MIAOU_BASH_DIR missing && builtin exit 1 |
|
|
|
|
|
|
|
|
test_count=0 |
|
|
test_count=0 |
|
|
failures=() |
|
|
failures=() |
|
|
mkdir -p "$TMP_DIRECTORY" |
|
|
mkdir -p "$TMP_DIRECTORY" |
|
|
|