Re: [PATCH 1/7] completion: make the 'basic' test more tester-friendly
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Nov 17, 2012, 23:00 UTC
- Message-ID
- <20121117230022.GA3815@elie.Belkin>
- In-Reply-To
- <1353150353-29874-2-git-send-email-szeder@ira.uka.de>
SZEDER Gábor wrote:
> The 'basic' test uses 'grep -q' to filter the resulting possible > completion words while looking for the presence or absence of certain > git commands, and relies on grep's exit status to indicate a failure.
[...]
> To make testers' life easier provide some output about the failed > condition: store the results of the filtering in a file and compare > its contents to the expected results by the good old test_cmp helper.
Looks good. I wonder if this points to the need for a test_grep helper more generally.
[...]
Show 5 quoted lines
> run_completion "git f" && > - ! grep -q -v "^f" out > + >expected && > + sed -n "/^[^f]/p" out >out2 && > + test_cmp expected out2
Functional change: before, this would fail if "out" contained a blank line, while afterward it does not. I doubt that matters, though.
Thanks and hope that helps, Jonathan