Re: [PATCH 2/4] Make t1300-repo-config resilient to being run via 'sh -x'
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Mar 22, 2016, 17:59 UTC
- Message-ID
- <20160322175948.GG28749@google.com>
- In-Reply-To
- <b4df45088aa68d8410895f66a814dd6780e2e451.1458668543.git.johannes.schindelin@gmx.de>
Johannes Schindelin wrote:
Show 12 quoted lines
> --- 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?
Show 7 quoted lines
> ' > > 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