Files
nixpkgs/pkgs/development/interpreters/lua-5/tests/assert.sh
T
Matthieu Coudron ff5b2d7d00 lua.tests: add test for relative import
better error message as well
extracted from https://github.com/NixOS/nixpkgs/pull/273342

written by heyarne
2024-02-06 23:21:41 +01:00

22 lines
430 B
Bash

# Always failing assertion with a message.
#
# Example:
# fail "It should have been but it wasn't to be"
function fail() {
echo "$1"
exit 1
}
function assertStringEqual() {
if ! diff <(echo "$1") <(echo "$2") ; then
fail "expected \"$1\" to be equal to \"$2\""
fi
}
function assertStringContains() {
if ! echo "$1" | grep -q "$2" ; then
fail "expected \"$1\" to contain \"$2\""
fi
}