mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-01-03 15:21:41 +01:00
test: add function to explicitly check for external dependencies
Useful when binary is called indirectly (e.g. from emacs).
This commit is contained in:
parent
d095902266
commit
f0fbdad04b
1 changed files with 14 additions and 0 deletions
|
@ -555,12 +555,26 @@ test_declare_external_prereq () {
|
||||||
|
|
||||||
hash $binary 2>/dev/null || eval "
|
hash $binary 2>/dev/null || eval "
|
||||||
$binary () {
|
$binary () {
|
||||||
|
test_missing_external_prereq_${binary}_=t
|
||||||
echo -n \"\$test_subtest_missing_external_prereqs_\" | grep -e \" $name \" ||
|
echo -n \"\$test_subtest_missing_external_prereqs_\" | grep -e \" $name \" ||
|
||||||
test_subtest_missing_external_prereqs_=\"$test_subtest_missing_external_prereqs_ $name\"
|
test_subtest_missing_external_prereqs_=\"$test_subtest_missing_external_prereqs_ $name\"
|
||||||
false
|
false
|
||||||
}"
|
}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Explicitly require external prerequisite. Useful when binary is
|
||||||
|
# called indirectly (e.g. from emacs).
|
||||||
|
# Returns success if dependency is available, failure otherwise.
|
||||||
|
test_require_external_prereq () {
|
||||||
|
binary="$1"
|
||||||
|
if [ "$(eval echo -n \$test_missing_external_prereq_${binary}_)" = t ]; then
|
||||||
|
# dependency is missing, call the replacement function to note it
|
||||||
|
eval "$binary"
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# You are not expected to call test_ok_ and test_failure_ directly, use
|
# You are not expected to call test_ok_ and test_failure_ directly, use
|
||||||
# the text_expect_* functions instead.
|
# the text_expect_* functions instead.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue