From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 1/2] test framework: further deprecate test_i18ngrep
Date: Tue, 31 Oct 2023 14:23:29 +0900 [thread overview]
Message-ID: <20231031052330.3762989-2-gitster@pobox.com> (raw)
In-Reply-To: <20231031052330.3762989-1-gitster@pobox.com>
As an attempt to come up with a useful mechanism to ensure that
certain messages are left untranslated [*], we earlier wrote
GIT_TEST_GETTEXT_POISON off as a failed experiment.
But the output from the test helper was easier to use while
debugging failed tests, compared to the same test writtein with the
plain-vanilla "grep". Especially when a test that expects a certain
string to appear in the output (e.g. "this test must fail with this
message") fails, "grep message output" would just silently fail and
in a &&-chained sequence of commands, it is hard to tell which step
failed. test_i18ngrep explicitly said "we wanted to see a line that
match this pattern but did not see a hit in this file".
What we have as test_i18ngrep in our tree still retains this verbose
output (even though we got rid of the "poison" support). Let's
rename it to test_grep (because it is no longer about i18n at all)
and then make test_i18ngrep a thin wrapper around it. Existing
callers of test_i18ngrep can be mechanically rewritten to instead
use test_grep over time, but it does not have to be done in this
commit.
[Footnote]
* The idea was that human-facing messages are often translated, but
there are messages that should never be translated. We use
"grep" only for the latter kind of messages, and then run tests
in "poison" mode that spew garbage for translatable messages. If
such a test run fails, it means these messages tested with "grep"
were marked for translation by mistake. test_i18ngrep was to be
used for other messages that are to be translated, and was to
always "succeed" when runing under the "poison" mode.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
t/test-lib-functions.sh | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 2f8868caa1..c50bc18861 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1208,14 +1208,16 @@ test_cmp_bin () {
cmp "$@"
}
-# Wrapper for grep which used to be used for
-# GIT_TEST_GETTEXT_POISON=false. Only here as a shim for other
-# in-flight changes. Should not be used and will be removed soon.
+# Deprecated - do not use this in new code
test_i18ngrep () {
+ test_grep "$@"
+}
+
+test_grep () {
eval "last_arg=\${$#}"
test -f "$last_arg" ||
- BUG "test_i18ngrep requires a file to read as the last parameter"
+ BUG "test_grep requires a file to read as the last parameter"
if test $# -lt 2 ||
{ test "x!" = "x$1" && test $# -lt 3 ; }
--
2.42.0-530-g692be87cbb
next prev parent reply other threads:[~2023-10-31 5:23 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 20:59 git bugreport with invalid CLI argument does not report error Sheik
2023-10-25 22:53 ` Emily Shaffer
2023-10-25 23:11 ` Eric Sunshine
2023-10-26 0:55 ` [PATCH v2] bugreport: reject positional arguments emilyshaffer
2023-10-26 3:43 ` Eric Sunshine
2023-10-26 3:52 ` Dragan Simic
2023-10-26 4:03 ` Eric Sunshine
2023-10-26 4:06 ` Dragan Simic
2023-10-26 15:54 ` [PATCH v3] " emilyshaffer
2023-10-26 17:18 ` Eric Sunshine
2023-10-27 14:41 ` Phillip Wood
2023-10-30 0:15 ` Junio C Hamano
2023-10-30 0:26 ` Junio C Hamano
2023-10-30 0:33 ` Junio C Hamano
2023-10-30 1:59 ` Junio C Hamano
2023-10-30 14:11 ` Phillip Wood
2023-10-30 23:31 ` Junio C Hamano
2023-10-31 2:17 ` Junio C Hamano
2023-10-31 5:23 ` [PATCH 0/2] Deprecate test_i18ngrep further Junio C Hamano
2023-10-31 5:23 ` Junio C Hamano [this message]
2023-10-31 5:23 ` [PATCH 2/2] tests: teach callers of test_i18ngrep to use test_grep Junio C Hamano
2023-11-01 14:44 ` Phillip Wood
2023-11-01 23:19 ` Junio C Hamano
2023-10-26 18:22 ` [PATCH v4 0/2] bugreport: reject positional arguments emilyshaffer
2023-10-26 20:13 ` Eric Sunshine
2023-10-26 18:22 ` [PATCH v4 1/2] t0091-bugreport: stop using i18ngrep emilyshaffer
2023-10-29 23:59 ` Junio C Hamano
2023-10-26 18:22 ` [PATCH v4 2/2] bugreport: reject positional arguments emilyshaffer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231031052330.3762989-2-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).