3647cb105d314d24ec046bde710896a0cd97cb49
[catagits/Gitalist.git] / t / 02git_tag.t
1 use strict;
2 use warnings;
3 use Test::More qw/no_plan/;
4 use Test::Exception;
5 use Data::Dumper;
6
7 BEGIN { use_ok 'Gitalist::Git::Tag' }
8
9 # Create an instance from for-each-ref output
10 my $revline="36c6c6708b8360d7023e8a1649c45bcf9b3bd818 commit refs/tags/0.01   add dir1/file2\0Florian Ragwitz <rafl\@debian.org> 1173210275 +0100";
11 #my $revline="a92fb1c9282f7319099ce7f783c8be7d5360f6e3\0refs/heads/model-cleanup\0Zachary Stevens <zts\@cryptocracy.com> 1277601094 +0100";
12 my $instance = Gitalist::Git::Tag->new($revline);
13 isa_ok($instance, 'Gitalist::Git::Tag');
14
15 # Create an instance, passing last_change as a DateTime
16 use DateTime;
17 my $timespec = [1173210275, '+0100'];
18 my $dt = DateTime->from_epoch(
19     epoch => @$timespec[0],
20     time_zone => @$timespec[1],
21 );
22 my $head = Gitalist::Git::Tag->new(
23     sha1 => '36c6c6708b8360d7023e8a1649c45bcf9b3bd818',
24     name => '0.01',
25     type => 'commit',
26     committer => 'Florian Ragwitz <rafl@debian.org>',
27     last_change => $dt,
28 );
29 isa_ok($head, 'Gitalist::Git::Tag');