Merge branch 'master' of git.shadowcat.co.uk:Gitalist
[catagits/Gitalist.git] / t / 02git_object.t
index f6fa33d..bb49cf7 100644 (file)
@@ -30,7 +30,7 @@ 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.
@@ -42,7 +42,7 @@ 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 {
@@ -59,7 +59,7 @@ my $commit_obj = Gitalist::Git::Object::Commit->new(
 isa_ok($commit_obj, 'Gitalist::Git::Object::Commit', "commit object");
 my ($tree, $patch) = $commit_obj->diff(
     parent => undef,
-    file => undef,
+    filename => undef,
     patch => 1,
 );
 $patch = $patch->[0];
@@ -97,8 +97,11 @@ index 257cc56..5716ca5 100644
 +bar
 --') == 0, 'commit_obj->get_patch can return a patch');
 
-like(do { local $/; my $fh = $commit_obj->get_patch(undef, 3); <$fh> },
-    qr!PATCH 2/2!, 'commit_obj->get_patch can return a patchset');
-
+# Note - 2 patches = 3 parts due to where we split.
+{
+    my @bits = split /Subject: \[PATC/, do { local $/; my $fh = $commit_obj->get_patch(undef, 3); <$fh> };
+    is(scalar(@bits), 3,
+        'commit_obj->get_patch can return a patchset');
+}
 done_testing;