From: Junio C Hamano Date: Fri, 19 Aug 2016 22:31:21 GMT Subject: Re: [PATCH] diff-highlight: add some tests. Message-ID: In-Reply-To: <20160819210431.usy6x3x6sdhe3vbp@sigill.intra.peff.net> Jeff King writes: > For that matter, I'm not sure that: > > cat >a <<-\EOF && > aaa > bbb > ccc > EOF > > cat >b <<-\EOF && > aaa > 0bb > ccc > EOF > > dh_test a b <<\EOF > aaa > -${CW}b${CR}bb > +${CW}0${CR}bb > EOF > > isn't more readable, too. It's more lines, certainly, but it makes it > very easy to see what the input files look like, rather than cramming > "\n" into the middle of a string (the existing code does make the diff > easy to see for _this_ case, because the pre- and post-image line up > vertically, but that is only the case for pure transliterations like > this). Yeah, the simplicity and obviousness certainly is very tempting. With something like CW=$(printf "\033[7m") # white CR=$(printf "\033[27m") # reset upfront, the test helper does not even need to worry about feeding a random string through printf as if it is a format string.