summaryrefslogtreecommitdiff
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-31 19:00:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-05-31 19:00:27 (GMT)
commitdd4c0ce908f4ea89375aefb5566d4bf9ec21db5c (patch)
tree1a1c1787a30292b22b8b6247074932108ac2e1a6 /t/test-lib.sh
parentb3c89315a33fbded4a8c5d533ca8ddc6087e4c23 (diff)
parentc9ea118e75b1b8f8cc744e372576b4cf63594e0d (diff)
downloadgit-dd4c0ce908f4ea89375aefb5566d4bf9ec21db5c.zip
git-dd4c0ce908f4ea89375aefb5566d4bf9ec21db5c.tar.gz
git-dd4c0ce908f4ea89375aefb5566d4bf9ec21db5c.tar.bz2
Merge branch 'ab/i18n-fixup' into maint
* ab/i18n-fixup: (24 commits) i18n: use test_i18n{cmp,grep} in t7600, t7607, t7611 and t7811 i18n: use test_i18n{grep,cmp} in t7508 i18n: use test_i18ngrep in t7506 i18n: use test_i18ngrep and test_i18ncmp in t7502 i18n: use test_i18ngrep in t7501 i18n: use test_i18ncmp in t7500 i18n: use test_i18ngrep in t7201 i18n: use test_i18ncmp and test_i18ngrep in t7102 and t7110 i18n: use test_i18ncmp and test_i18ngrep in t5541, t6040, t6120, t7004, t7012 and t7060 i18n: use test_i18ncmp and test_i18ngrep in t3700, t4001 and t4014 i18n: use test_i18ncmp and test_i18ngrep in t3203, t3501 and t3507 i18n: use test_i18ngrep in t2020, t2204, t3030, and t3200 i18n: use test_i18ngrep in lib-httpd and t2019 i18n: do not overuse C_LOCALE_OUTPUT (grep) i18n: use test_i18ncmp in t1200 and t2200 i18n: .git file is not a human readable message (t5601) i18n: do not overuse C_LOCALE_OUTPUT i18n: mark init-db messages for translation i18n: mark checkout plural warning for translation i18n: mark checkout --detach messages for translation ...
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 8a274fb..a3fe16d 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1080,6 +1080,32 @@ else
test_set_prereq C_LOCALE_OUTPUT
fi
+# Use this instead of test_cmp to compare files that contain expected and
+# actual output from git commands that can be translated. When running
+# under GETTEXT_POISON this pretends that the command produced expected
+# results.
+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