This allows use to write test with less effort as we can reuse functions
Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org --- tests/lib.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/lib.sh
diff --git a/tests/lib.sh b/tests/lib.sh new file mode 100644 index 000000000..7749d5158 --- /dev/null +++ b/tests/lib.sh @@ -0,0 +1,20 @@ +#!/usr/bin/bash + +LIB_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" + +. ${LIB_DIR}/lib_color.sh + +test_that() { + + if ! "$@" ; then + echo -e "${CLR_RED_BG} Test failed: ${*} ${CLR_RESET}" + return 1 + else + echo -e "${CLR_GREEN_BG} Test succeded: ${*} ${CLR_RESET}" + return 0 + fi +} + +var_has_value() { + [[ "${!1}" == "${2}" ]] +}