Re: [PATCH next] git-notes: add test case for multi-line notes
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 14, 2009, 15:34 UTC
- Message-ID
- <alpine.DEB.1.00.0901141627440.3586@pacific.mpi-cbg.de>
- In-Reply-To
- <496DF936.3060308@trolltech.com>
Hi,
On Wed, 14 Jan 2009, Tor Arne Vestbø wrote:
Show 6 quoted lines
> The tests adds a third commit with a multi-line note. The output of > git log -2 is then checked to see if the note lines are wrapped > correctly, and that there's a line separator between the two commits. > > Also, changed from using 'git diff' to test expect vs. output to use > 'test_cmp', as I had problems getting correct results using the former.
You could skip the part that you had problems, as the test_cmp is obviously the correct thing to do.
Show 12 quoted lines
> diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh > index ba42c45..76bb6dd 100755 > --- a/t/t3301-notes.sh > +++ b/t/t3301-notes.sh > @@ -8,8 +8,8 @@ test_description='Test commit notes' > . ./test-lib.sh > > cat > fake_editor.sh << \EOF > -echo "$MSG" > "$1" > -echo "$MSG" >& 2 > +echo -e "$MSG" > "$1" > +echo -e "$MSG" >& 2
I seem to recall that we had plenty of fun substituting "echo -e" with "printf" whenever it entered the repository (... again...), as some platforms -- ahem, macosx, ahem -- are a bit peculiar with such options.
So you might want to make sure no % is passed as "$MSG", and use printf instead.
Show 8 quoted lines
> +test_expect_success 'create multi-line notes (setup)' ' > + : > a3 && > + git add a3 && > + test_tick && > + git commit -m 3rd && > + MSG="b3\nc3c3c3c3\nd3d3d3" git notes edit > + > +'
Minor style nit: maybe you want to have an empty line at the beginning, too...
Show 15 quoted lines
> +cat > expect-multiline << EOF > +commit 1584215f1d29c65e99c6c6848626553fdd07fd75 > +Author: A U Thor <author@example.com> > +Date: Thu Apr 7 15:15:13 2005 -0700 > + > + 3rd > + > +Notes: > + b3 > + c3c3c3c3 > + d3d3d3 > +EOF > + > +echo >> expect-multiline > +cat expect >> expect-multiline
Yeah. My initial reaction was: "you could have that echo inside the cat <<EOF", but this is clearer. Except that you should make sure that nothing is printed (M$' echo outputs something if you pass no parameters); printf "\n" would be my choice.
Other than that, very good: ACK.
Ciao, Dscho