summaryrefslogtreecommitdiffstats
path: root/tests/units
diff options
context:
space:
mode:
authorscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-12 17:29:39 -0800
committerscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-12 17:29:39 -0800
commit852a0e63d294de874c3311f5e7edf40e2f2ecd60 (patch)
treeb77a38e91156d5e330246a6111f0ee835c38a80b /tests/units
parentec59c5c7ee9fa3b5831ed0b5f713cee218480ea3 (diff)
downloadthird_party-ruby-git-852a0e63d294de874c3311f5e7edf40e2f2ecd60.zip
third_party-ruby-git-852a0e63d294de874c3311f5e7edf40e2f2ecd60.tar.gz
third_party-ruby-git-852a0e63d294de874c3311f5e7edf40e2f2ecd60.tar.xz
added a bunch of good stuff to the commit object
Diffstat (limited to 'tests/units')
-rw-r--r--tests/units/test_lib.rb8
-rw-r--r--tests/units/test_object.rb12
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/units/test_lib.rb b/tests/units/test_lib.rb
index 5fbd896..5afb4ec 100644
--- a/tests/units/test_lib.rb
+++ b/tests/units/test_lib.rb
@@ -13,6 +13,14 @@ class TestLib < Test::Unit::TestCase
set_file_paths
@lib = Git.open(@wdir).lib
end
+
+ def test_commit_data
+ data = @lib.commit_data('1cc8667014381')
+ assert_equal('scott Chacon <schacon@agadorsparticus.corp.reactrix.com> 1194561188 -0800', data['author'])
+ assert_equal('94c827875e2cadb8bc8d4cdd900f19aa9e8634c7', data['tree'])
+ assert_equal("test\n", data['message'])
+ assert_equal(["546bec6f8872efa41d5d97a369f669165ecda0de"], data['parent'])
+ end
# takes parameters, returns array of appropriate commit objects
# :count
diff --git a/tests/units/test_object.rb b/tests/units/test_object.rb
index a8c6bce..c4a2de7 100644
--- a/tests/units/test_object.rb
+++ b/tests/units/test_object.rb
@@ -16,6 +16,18 @@ class TestObject < Test::Unit::TestCase
o = @git.object('1cc8667014381')
assert(o.is_a?(Git::Object::Commit))
+ assert_equal('94c827875e2cadb8bc8d4cdd900f19aa9e8634c7', o.gtree.to_s)
+ assert_equal('546bec6f8872efa41d5d97a369f669165ecda0de', o.parent.sha)
+ assert_equal(1, o.parents.size)
+ assert_equal('scott Chacon', o.author.name)
+ assert_equal('schacon@agadorsparticus.corp.reactrix.com', o.author.email)
+ assert_equal('11-08-07', o.author.date.strftime("%m-%d-%y"))
+ assert_equal('11-08-07', o.author_date.strftime("%m-%d-%y"))
+ assert_equal('scott Chacon', o.committer.name)
+ assert_equal('11-08-07', o.committer_date.strftime("%m-%d-%y"))
+ assert_equal('11-08-07', o.date.strftime("%m-%d-%y"))
+ assert_equal('test', o.message)
+
o = @git.object('HEAD')
assert(o.is_a?(Git::Object::Commit))
assert_equal('commit', o.type)