mbox series

[v2,0/2] bundle tests: modernize, fix missing coverage & test_cmp

Message ID cover-0.2-00000000000-20210721T235251Z-avarab@gmail.com (mailing list archive)
Headers show
Series bundle tests: modernize, fix missing coverage & test_cmp | expand

Message

Ævar Arnfjörð Bjarmason July 21, 2021, 11:53 p.m. UTC
A trivial series to improve the bundle tests a bit. This is split off
from some larger changes to "git bundle" I have cooking, where the
"test_cmp" in 2/2 helped assert & catch regressions.

Ævar Arnfjörð Bjarmason (2):
  bundle tests: use ">file" not ": >file"
  bundle tests: use test_cmp instead of grep

 t/t5607-clone-bundle.sh | 72 ++++++++++++++++++++++++++++++++---------
 1 file changed, 56 insertions(+), 16 deletions(-)

Range-diff against v1:
1:  746d727113b ! 1:  2a77f80725d bundle tests: use ">file" not ": >file"
    @@ Metadata
      ## Commit message ##
         bundle tests: use ">file" not ": >file"
     
    -    Change redundant uses of ":" on the LHS of a ">" to the more commonly
    -    use ">file" pattern.
    +    Change uses of ":" on the LHS of a ">" to the more commonly used
    +    ">file" pattern in t/t5607-clone-bundle.sh.
     
         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
2:  062f34abf1a ! 2:  d5504fd764c bundle tests: use test_cmp instead of grep
    @@ t/t5607-clone-bundle.sh: test_expect_success 'ridiculously long subject in bound
     -	sed -n "/^-/{p;q;}" long-subject-bundle.bdl >boundary &&
     -	grep "^-$OID_REGEX " boundary
     +
    -+	cat >expect.common <<-EOF &&
    ++	if ! test_have_prereq SHA1
    ++	then
    ++		echo "@object-format=sha256"
    ++	fi >expect &&
    ++	cat >>expect <<-EOF &&
     +	-$(git log --pretty=format:"%H %s" -1 HEAD^)
     +	$(git rev-parse HEAD) HEAD
     +	EOF
    ++
     +	if test_have_prereq SHA1
     +	then
    -+		cp expect.common expect
    -+	else
    -+		echo @object-format=sha256 >expect
    -+		cat expect.common >>expect
    -+	fi &&
    -+	if test_have_prereq SHA1
    -+	then
    -+		head -n 3 long-subject-bundle.bdl >bundle-header
    ++		head -n 3 long-subject-bundle.bdl
     +	else
    -+		head -n 4 long-subject-bundle.bdl >bundle-header
    -+	fi &&
    -+	grep -v "^#" bundle-header >actual &&
    ++		head -n 4 long-subject-bundle.bdl
    ++	fi | grep -v "^#" >actual &&
    ++
     +	test_cmp expect actual
      '

Comments

Taylor Blau July 22, 2021, 6:17 p.m. UTC | #1
On Thu, Jul 22, 2021 at 01:53:27AM +0200, Ævar Arnfjörð Bjarmason wrote:
> A trivial series to improve the bundle tests a bit. This is split off
> from some larger changes to "git bundle" I have cooking, where the
> "test_cmp" in 2/2 helped assert & catch regressions.

Thanks, this version looks great to me, so I'd be happy to see it get
picked up.

    Reviewed-by: Taylor Blau <me@ttaylorr.com>

Thanks,
Taylor