X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fimport.t;h=4ec3c4f32e2b060a5e22956e734bc6bd4482de08;hb=9bd675d33ad1e49bd2ebe12a1d216216e61380de;hp=eee47447d3c9fbada1f9addee0f19423551e8cf4;hpb=30a72ab33290a9ce57955bbd0799e394feab91ea;p=public-inbox.git diff --git a/t/import.t b/t/import.t index eee47447..4ec3c4f3 100644 --- a/t/import.t +++ b/t/import.t @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2018 all contributors +# Copyright (C) 2016-2019 all contributors # License: AGPL-3.0+ use strict; use warnings; @@ -11,6 +11,7 @@ use IO::File; use Fcntl qw(:DEFAULT); use File::Temp qw/tempdir tempfile/; my $dir = tempdir('pi-import-XXXXXX', TMPDIR => 1, CLEANUP => 1); +require './t/common.perl'; is(system(qw(git init -q --bare), $dir), 0, 'git init successful'); my $git = PublicInbox::Git->new($dir); @@ -27,11 +28,12 @@ my $mime = PublicInbox::MIME->create( ], body => "hello world\n", ); +my $v2 = require_git(2.6, 1); -$im->{want_object_info} = 1 if 'v2'; +$im->{want_object_info} = 1 if $v2; like($im->add($mime), qr/\A:\d+\z/, 'added one message'); -if ('v2') { +if ($v2) { my $info = $im->{last_object}; like($info->[0], qr/\A[a-f0-9]{40}\z/, 'got last object_id'); is($mime->as_string, ${$info->[2]}, 'string matches');