X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F02git_object.t;h=750398e520d9c1a38668fe9c5175ff4bbdbd77d2;hb=65ffc9fb8f3438e5b9ebded39b172e9f817ccef5;hp=4ce679cd85013ec8175500019e503b4ccb1f10ef;hpb=e75df318e3db0c062c7ab019593c3cc9a6a84a26;p=catagits%2FGitalist.git diff --git a/t/02git_object.t b/t/02git_object.t index 4ce679c..750398e 100644 --- a/t/02git_object.t +++ b/t/02git_object.t @@ -1,13 +1,13 @@ use strict; use warnings; use FindBin qw/$Bin/; -use Test::More qw/no_plan/; +use Test::More; use Test::Exception; use Data::Dumper; use Path::Class; -use Gitalist::Git::Project; -my $project = Gitalist::Git::Project->new( +use Gitalist::Git::Repository; +my $repository = Gitalist::Git::Repository->new( dir("$Bin/lib/repositories/repo1"), ); @@ -19,7 +19,7 @@ BEGIN { } my $object = Gitalist::Git::Object::Tree->new( - project => $project, + repository => $repository, sha1 => '729a7c3f6ba5453b42d16a43692205f67fb23bc1', type => 'tree', file => 'dir1', @@ -30,19 +30,19 @@ is($object->sha1,'729a7c3f6ba5453b42d16a43692205f67fb23bc1', 'sha1 is correct'); is($object->type, 'tree', 'type is correct'); is($object->file, 'dir1', 'file is correct'); is($object->mode, 16384, 'mode is correct'); -is($object->modestr, 'd---------', "modestr is correct" ); +is($object->modestr, 'drwxr-xr-x', "modestr is correct" ); is($object->size, 33, "size is correct"); # Create object from sha1. my $obj2 = Gitalist::Git::Object::Blob->new( - project => $project, + repository => $repository, sha1 => '5716ca5987cbf97d6bb54920bea6adde242d87e6', ); isa_ok($obj2, 'Gitalist::Git::Object::Blob', 'blob object'); is($obj2->sha1,'5716ca5987cbf97d6bb54920bea6adde242d87e6', 'sha1 is correct'); is($obj2->type, 'blob', 'type is correct'); is($obj2->mode, 0, 'mode is correct'); -is($obj2->modestr, '?---------', "modestr is correct" ); +is($obj2->modestr, '----------', "modestr is correct" ); is($obj2->content, "bar\n", 'obj2 contents is correct'); is($obj2->size, 4, "size is correct"); dies_ok { @@ -53,7 +53,7 @@ dies_ok { } 'comment is an empty string'; my $commit_obj = Gitalist::Git::Object::Commit->new( - project => $project, + repository => $repository, sha1 => '3f7567c7bdf7e7ebf410926493b92d398333116e', ); isa_ok($commit_obj, 'Gitalist::Git::Object::Commit', "commit object"); @@ -78,7 +78,8 @@ is($patch->{diff}, '--- a/file1 ', 'patch->{diff} is correct'); is($patch->{dst}, '5716ca5987cbf97d6bb54920bea6adde242d87e6', 'patch->{dst} is correct'); -ok(index($commit_obj->get_patch, 'From 3f7567c7bdf7e7ebf410926493b92d398333116e Mon Sep 17 00:00:00 2001 +ok(index(do { local $/; my $fh = $commit_obj->get_patch; <$fh> }, +'From 3f7567c7bdf7e7ebf410926493b92d398333116e Mon Sep 17 00:00:00 2001 From: Florian Ragwitz Date: Tue, 6 Mar 2007 20:39:45 +0100 Subject: [PATCH] bar @@ -96,4 +97,8 @@ index 257cc56..5716ca5 100644 +bar --') == 0, 'commit_obj->get_patch can return a patch'); -like($commit_obj->get_patch(undef, 3), qr!PATCH 2/2!, 'commit_obj->get_patch can return a patchset'); +like(do { local $/; my $fh = $commit_obj->get_patch(undef, 3); <$fh> }, + qr!PATCH 2/2!, 'commit_obj->get_patch can return a patchset'); + +done_testing; +