summaryrefslogtreecommitdiff
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-04-12 22:57:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-04-13 22:52:47 (GMT)
commit127df8c6cfd42ea666df9221d208b33b712d9994 (patch)
treed88d91a86a591f4ac129a5d5b0552a30e8baccdb /t/test-lib.sh
parentc36f94123bb16d412fc0f7c49d655bfe4259c4b6 (diff)
downloadgit-127df8c6cfd42ea666df9221d208b33b712d9994.zip
git-127df8c6cfd42ea666df9221d208b33b712d9994.tar.gz
git-127df8c6cfd42ea666df9221d208b33b712d9994.tar.bz2
i18n: do not overuse C_LOCALE_OUTPUT (grep)
Instead of skipping the whole test, introduce test_i18ngrep wrapper that pretends a successful result under GETTEXT_POISON build. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 3e7c2bb..763b9c5 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1085,6 +1085,24 @@ test_i18ncmp () {
test -n "$GETTEXT_POISON" || test_cmp "$@"
}
+# Use this instead of "grep expected-string actual" to see if the
+# output from a git command that can be translated either contains an
+# expected string, or does not contain an unwanted one. When running
+# under GETTEXT_POISON this pretends that the command produced expected
+# results.
+test_i18ngrep () {
+ if test -n "$GETTEXT_POISON"
+ then
+ : # pretend success
+ elif test "x!" = "x$1"
+ then
+ shift
+ ! grep "$@"
+ else
+ grep "$@"
+ fi
+}
+
# test whether the filesystem supports symbolic links
ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
rm -f y