Thread (19 messages) flat view 19 messages, 5 authors, 2016-06-16

Re: [PATCH 2/4] Make t1300-repo-config resilient to being run via 'sh -x'

From: Jonathan Nieder <hidden>
Date: 2016-06-15 23:08:52

Johannes Schindelin wrote:
quoted hunk ↗ jump to hunk
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -699,17 +699,13 @@ test_expect_success 'invalid unit' '
 	echo 1auto >expect &&
 	git config aninvalid.unit >actual &&
 	test_cmp expect actual &&
-	cat >expect <<-\EOF &&
-	fatal: bad numeric config value '\''1auto'\'' for '\''aninvalid.unit'\'' in file .git/config: invalid unit
-	EOF
 	test_must_fail git config --int --get aninvalid.unit 2>actual &&
-	test_i18ncmp expect actual
+	grep "^fatal: bad numeric config value .1auto. for .aninvalid.unit. in file .git/config: invalid unit$" actual
Would test_i18ngrep work?
 '
 
 test_expect_success 'invalid stdin config' '
-	echo "fatal: bad config line 1 in standard input " >expect &&
 	echo "[broken" | test_must_fail git config --list --file - >output 2>&1 &&
-	test_cmp expect output
+	grep "^fatal: bad config line 1 in standard input $" output
This test is very strange.  Why do we care that it starts with
"fatal:" as opposed to error?  Why are we testing for an extra space at
the end of the line?

I would expect something like

	test_i18ngrep 'line 1 in standard input' output

to be more useful for testing the useful part of the error message while
remaining resilient against error message changes.

Thanks,
Jonathan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help