Gave ::Project methods to return Objects, and several methods which
[catagits/Gitalist.git] / t / 02git_project.t
index f7d6487..19409e7 100644 (file)
@@ -25,5 +25,16 @@ is($proj->info->{name}, qw/repo1/, 'repo name in info hash');
 is($proj->head_hash, qw/36c6c6708b8360d7023e8a1649c45bcf9b3bd818/, 'head_hash for HEAD is correct');
 
 is(scalar $proj->list_tree, 2, 'expected number of entries in tree');
-isa_ok(($proj->list_tree)[0], 'Gitalist::Git::Object');
-
+isa_ok(($proj->list_tree)[1], 'Gitalist::Git::Object');
+
+# Return an ::Object from a sha1
+my $obj1 = $proj->get_object('5716ca5987cbf97d6bb54920bea6adde242d87e6');
+isa_ok($obj1, 'Gitalist::Git::Object');
+
+# Test methods that really should be called on ::Object
+# This is transitional from Git.pm
+my $obj = ($proj->list_tree)[1];
+isa_ok($obj, 'Gitalist::Git::Object');
+is($proj->get_object_mode_string($obj), '-rw-r--r--', "get_object_mode_string");
+is($proj->get_object_type('5716ca5987cbf97d6bb54920bea6adde242d87e6'), 'blob', "get_object_type");
+is($proj->cat_file('5716ca5987cbf97d6bb54920bea6adde242d87e6'), "bar\n", 'cat_file');