2022-09-13 17:35:47 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# --- begin runfiles.bash initialization v2 ---
|
|
|
|
# Copy-pasted from the Bazel Bash runfiles library v2.
|
2023-12-08 08:30:39 +00:00
|
|
|
set -o nounset -o pipefail
|
|
|
|
f=bazel_tools/tools/bash/runfiles/runfiles.bash
|
2022-09-13 17:35:47 +00:00
|
|
|
# shellcheck disable=SC1090
|
2023-12-08 08:30:39 +00:00
|
|
|
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null ||
|
|
|
|
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null ||
|
|
|
|
source "$0.runfiles/$f" 2>/dev/null ||
|
|
|
|
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null ||
|
|
|
|
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null ||
|
|
|
|
{
|
|
|
|
echo >&2 "ERROR: cannot find $f"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
f=
|
|
|
|
set -e
|
2022-09-13 17:35:47 +00:00
|
|
|
# --- end runfiles.bash initialization v2 ---
|
|
|
|
|
|
|
|
assertions_sh_location=aspect_bazel_lib/shlib/lib/assertions.sh
|
2023-12-08 08:30:39 +00:00
|
|
|
assertions_sh="$(rlocation "${assertions_sh_location}")" ||
|
2022-09-13 17:35:47 +00:00
|
|
|
(echo >&2 "Failed to locate ${assertions_sh_location}" && exit 1)
|
|
|
|
# shellcheck source=SCRIPTDIR/../../../lib/assertions.sh
|
|
|
|
source "${assertions_sh}"
|
|
|
|
|
|
|
|
assert_fail_sh_location=aspect_bazel_lib/shlib/tests/lib_tests/assertions_tests/assert_fail.sh
|
2023-12-08 08:30:39 +00:00
|
|
|
assert_fail_sh="$(rlocation "${assert_fail_sh_location}")" ||
|
2022-09-13 17:35:47 +00:00
|
|
|
(echo >&2 "Failed to locate ${assert_fail_sh_location}" && exit 1)
|
|
|
|
# shellcheck source=SCRIPTDIR/assert_fail.sh
|
|
|
|
source "${assert_fail_sh}"
|
|
|
|
|
|
|
|
# MARK - Test assert_equal
|
|
|
|
|
|
|
|
reset_fail_err_msgs
|
|
|
|
assert_equal "hello" "goodbye"
|
|
|
|
assert_fail "Expected to be equal."
|
|
|
|
reset_fail_err_msgs
|
|
|
|
|
|
|
|
reset_fail_err_msgs
|
|
|
|
assert_equal "hello" "goodbye" "Custom prefix."
|
|
|
|
assert_fail "Custom prefix. Expected to be equal."
|
|
|
|
reset_fail_err_msgs
|
|
|
|
|
|
|
|
reset_fail_err_msgs
|
|
|
|
assert_equal "hello" "hello"
|
|
|
|
assert_no_fail
|
|
|
|
reset_fail_err_msgs
|