Thread (2 messages) 2 messages, 2 authors, 2020-11-25

Re: [PATCH v4] help.c: expand options for help.autocorrect

From: SZEDER Gábor <hidden>
Date: 2020-11-25 18:33:06

On Wed, Nov 18, 2020 at 10:15:31AM -0800, Junio C Hamano wrote:
quoted hunk ↗ jump to hunk
Also, I think we would want _some_ test, as the base form of
help.autocorrect is already tested.  Perhaps something like this.

 t/t9003-help-autocorrect.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)
diff --git c/t/t9003-help-autocorrect.sh w/t/t9003-help-autocorrect.sh
index b1c7919c4a..8f1035c3c2 100755
--- c/t/t9003-help-autocorrect.sh
+++ w/t/t9003-help-autocorrect.sh
@@ -49,4 +49,17 @@ test_expect_success 'autocorrect running commands' '
 	test_cmp expect actual
 '
 
+test_expect_success 'autocorrect can be declined altogether' '
+	git config help.autocorrect never &&
+
+	test_must_fail git lfg 2>actual &&
+	if test_have_prereq C_LOCALE_OUTPUT
+	then
+		: cannot test with poisoned i18n
+	else
+		grep "is not a git command" actual &&
+		test_line_count = 1 actual
The two branches of this condition are in the wrong order, as it
doesn't check the expected error message in normal mode, but it does
grep for the specific translated error message when run with
GIT_TEST_GETTEXT_POISON=1 which then fails the test.

I think we should simply use 'test_i18ngrep' instead of that whole
if-else block.  

I wonder what that 'test_line_count = 1' is supposed to check, and am
not sure that it's really necessary.  Anyway, the gettext poisoned
output should be a single line as well, so we can use that same check
both with and without C_LOCALE_OUTPUT.
+	fi
+'
+
 test_done
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help