From 3ddf7f00e83f5109573f2307100f125a753c5f55 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Sat, 14 Jun 2014 00:34:25 -0400 Subject: [PATCH] `assert` added to test runner --- test/run-test | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/run-test b/test/run-test index d8e4873..1528f56 100755 --- a/test/run-test +++ b/test/run-test @@ -29,6 +29,22 @@ cd "$( dirname "$0" )/../" || { } +## +# Provide command to output assertion on failure +# +# We do not override the `test` builtin, as this would also affect pkgsh +# itself. +# +assert() +{ + test "$@" || { + local -i code=$? + echo "assertion failed: $@" >&2 + return $code + } +} + + main() { local tpath="$1"