On Fri, Jul 15, 2016 at 09:32:45PM +0900, Mike Hommey wrote:
> > > +test_expect_success 'blame wholesale copy and more in the index' '
> > > +
> > > + {
> > > + echo ABC
> > > + echo DEF
> > > + echo XXXX
> > > + echo YYYY
> > > + echo GHIJK
> > > + } >horse &&
> >
> > A more common way to do this in our test scripts is by using here
> > documents. However, in this case I would suggest
> >
> > test_write_lines ABC DEF XXXX YYYY GHIJK >horse
>
> I merely copied the pattern used in other places in the same test file.
> Using test_write_lines or something else (what are "here documents"?)
> would break consistency. I can also change the other similar blocks at
> the same time, though, whichever you prefer.
A here document is this:
cat <<-\EOF
ABC
DEF
XXXX
YYYY
GHIJK
EOF
The "<<" starts the here-doc. The "-" tells the shell to strip leading
tabs (so you can keep it indented with the rest of the code. The "\"
tells the shell not to interpolate (not a big deal here, but great for
more complicated input). The "EOF" tells it where to stop.
Matching surrounding style is always reasonable, though I do think this
particular file is a bit of an oddball. Most of our scripts use here
documents. Either is OK in this case, IMHO.
Personally I do not find test_write_lines particularly readable, but I
guess some people do, which is why it exists.
-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html