3 use Test
::More no_plan
;
7 # This test script tests the VCS::Git::Torrent::References class
9 BEGIN { use_ok
('t::TestUtils') }
10 BEGIN { use_ok
('VCS::Git::Torrent') }
11 BEGIN { use_ok
('VCS::Git::Torrent::Reference') }
13 my $path = mk_tmp_repo
();
14 my $repo = Git
->repository($path);
15 my $tag_id = $repo->command('hash-object', '-w', '-t', 'tag', '../41-peer-references/01-simple.tag');
18 my $t = VCS
::Git
::Torrent
->new(
19 repo_hash
=> '1415' x
10,
23 my $ref = VCS
::Git
::Torrent
::Reference
->new(
28 my $tagged_object = '5e8f6a7807a378259daa3b91314c8c9775fa160e';
29 my $sam = 'Sam Vilain <sam@vilain.net>';
30 my $tagdate = '2008-07-13 15:25:13+1200';
32 is
($ref->tag_id, $tag_id, 'tag_id matches');
33 is
($ref->tagged_object, $tagged_object, 'tagged_object matches');
34 is
($ref->tagger, $sam, 'tagger matches');
35 is
($ref->tagdate, $tagdate, 'tagdate matches');
36 is
($ref->comment, "Simple tag object\n\n", 'comment matches');
38 #foreach(keys(%{$ref->refs})) {
39 # print $_ . "\t" . $ref->{refs}->{$_} . "\n";
42 is
($ref->refs->{'refs/heads/master'}, $tagged_object, 'refs matches');
45 my $tag = VCS
::Git
::Torrent
::Reference
->new
47 tagged_object
=> $tagged_object,
50 comment
=> "Created by $0\n\n",
51 refs
=> { 'refs/heads/master' => $tagged_object },
54 ok
($tag->tag_id, "can write tag");
55 $tag_id = $tag->tag_id;
57 my $type = $repo->command_oneline("cat-file", "-t", $tag_id);
58 is
($type, "tag", "wrote a tag OK");
60 my $data = $repo->command("cat-file", "tag", $tag_id);