diff options
author | SZEDER Gábor <szeder.dev@gmail.com> | 2018-02-08 15:56:54 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-02-08 18:54:27 (GMT) |
commit | 0f59128f7bb6ce20889156efd101d1e059377eaa (patch) | |
tree | 7b7d42bfb8deeca2bb5aba12d0e98cf9898205fd /t/test-lib-functions.sh | |
parent | 93b4b0313c8d9d3600fc27b7023dab0d9d9be739 (diff) | |
download | git-0f59128f7bb6ce20889156efd101d1e059377eaa.zip git-0f59128f7bb6ce20889156efd101d1e059377eaa.tar.gz git-0f59128f7bb6ce20889156efd101d1e059377eaa.tar.bz2 |
t: move 'test_i18ncmp' and 'test_i18ngrep' to 'test-lib-functions.sh'
Both 'test_i18ncmp' and 'test_i18ngrep' helper functions are supposed
to be called from our test scripts, so they should be in
'test-lib-functions.sh'.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib-functions.sh')
-rw-r--r-- | t/test-lib-functions.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 1701fe2..92ed029 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -705,6 +705,32 @@ test_cmp_bin() { cmp "$@" } +# 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 +} + # Call any command "$@" but be more verbose about its # failure. This is handy for commands like "test" which do # not output anything when they fail. |