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>
SZEDER Gábor committed
Feb 8, 2018 at 16:56 UTC
0f59128f7bb6ce20889156efd101d1e059377eaa
2 files changed
+26
-26
t/test-lib-functions.sh
+26
@@ -705,6 +705,32 @@ test_cmp_bin() {
705
cmp "$@"
706
}
707
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
+
734
# Call any command "$@" but be more verbose about its
735
# failure. This is handy for commands like "test" which do
736
# not output anything when they fail.
t/test-lib.sh
-26
@@ -1062,32 +1062,6 @@ else
1062
test_set_prereq C_LOCALE_OUTPUT
1063
fi
1064
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
-
1065
test_lazy_prereq PIPE '
1066
# test whether the filesystem supports FIFOs
1067
test_have_prereq !MINGW,!CYGWIN &&