MIAOU-BASH is a collection of settings and helpers for leveraging BASH. Developer-friendly, it may be used as solo package with or without the miaou project.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

21 lines
466 B

#!/usr/bin/env bash
# functions
function assert {
./test/stub/scenario.bash "$1" >/dev/null || (echo "error in: $1" && exit 1)
}
function fail_type {
stderr=$(./test/stub/scenario.bash "$1" 2>&1 >/dev/null)
code="$?"
regex="TYPE: $2"
[[ "$code" != 0 ]] && [[ "$stderr" =~ $regex ]] || (echo "error in: $1" && exit 1)
}
# main
assert success
fail_type subshell_term 'SUBSHELL TERM'
fail_type unbound_variable 'UNBOUND VARIABLE'
fail_type false 'FALSE'