Skip to content

Commit 0f59128

Browse files
szedergitster
authored andcommitted
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 <[email protected]> Reviewed-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 93b4b03 commit 0f59128

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

t/test-lib-functions.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,32 @@ test_cmp_bin() {
705705
cmp "$@"
706706
}
707707

708+
# Use this instead of test_cmp to compare files that contain expected and
709+
# actual output from git commands that can be translated. When running
710+
# under GETTEXT_POISON this pretends that the command produced expected
711+
# results.
712+
test_i18ncmp () {
713+
test -n "$GETTEXT_POISON" || test_cmp "$@"
714+
}
715+
716+
# Use this instead of "grep expected-string actual" to see if the
717+
# output from a git command that can be translated either contains an
718+
# expected string, or does not contain an unwanted one. When running
719+
# under GETTEXT_POISON this pretends that the command produced expected
720+
# results.
721+
test_i18ngrep () {
722+
if test -n "$GETTEXT_POISON"
723+
then
724+
: # pretend success
725+
elif test "x!" = "x$1"
726+
then
727+
shift
728+
! grep "$@"
729+
else
730+
grep "$@"
731+
fi
732+
}
733+
708734
# Call any command "$@" but be more verbose about its
709735
# failure. This is handy for commands like "test" which do
710736
# not output anything when they fail.

t/test-lib.sh

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,32 +1062,6 @@ else
10621062
test_set_prereq C_LOCALE_OUTPUT
10631063
fi
10641064

1065-
# Use this instead of test_cmp to compare files that contain expected and
1066-
# actual output from git commands that can be translated. When running
1067-
# under GETTEXT_POISON this pretends that the command produced expected
1068-
# results.
1069-
test_i18ncmp () {
1070-
test -n "$GETTEXT_POISON" || test_cmp "$@"
1071-
}
1072-
1073-
# Use this instead of "grep expected-string actual" to see if the
1074-
# output from a git command that can be translated either contains an
1075-
# expected string, or does not contain an unwanted one. When running
1076-
# under GETTEXT_POISON this pretends that the command produced expected
1077-
# results.
1078-
test_i18ngrep () {
1079-
if test -n "$GETTEXT_POISON"
1080-
then
1081-
: # pretend success
1082-
elif test "x!" = "x$1"
1083-
then
1084-
shift
1085-
! grep "$@"
1086-
else
1087-
grep "$@"
1088-
fi
1089-
}
1090-
10911065
test_lazy_prereq PIPE '
10921066
# test whether the filesystem supports FIFOs
10931067
test_have_prereq !MINGW,!CYGWIN &&

0 commit comments

Comments
 (0)