diff options
author | scott Chacon <schacon@agadorsparticus.(none)> | 2007-11-10 15:34:12 -0800 |
---|---|---|
committer | scott Chacon <schacon@agadorsparticus.(none)> | 2007-11-10 15:34:12 -0800 |
commit | efcce7fc123b9e64fb9d93224e4e78d09144af3d (patch) | |
tree | 5c9966a11b18218d6e2f655e7f34a7604530b2a1 /tests/units | |
parent | fde3263abc5c7866aa7dce7aef28eacaa33d7664 (diff) | |
download | third_party-ruby-git-efcce7fc123b9e64fb9d93224e4e78d09144af3d.tar.gz third_party-ruby-git-efcce7fc123b9e64fb9d93224e4e78d09144af3d.tar.xz third_party-ruby-git-efcce7fc123b9e64fb9d93224e4e78d09144af3d.zip |
got clone and init to work - my first writing functions
Diffstat (limited to 'tests/units')
-rw-r--r-- | tests/units/test_init.rb | 16 | ||||
-rw-r--r-- | tests/units/test_lib.rb | 8 | ||||
-rw-r--r-- | tests/units/test_log.rb | 2 | ||||
-rw-r--r-- | tests/units/test_object.rb | 6 |
4 files changed, 20 insertions, 12 deletions
diff --git a/tests/units/test_init.rb b/tests/units/test_init.rb index f1a8ba4..4681ba0 100644 --- a/tests/units/test_init.rb +++ b/tests/units/test_init.rb @@ -21,7 +21,7 @@ class TestInit < Test::Unit::TestCase end def test_git_bare - g = Git.repo @wbare + g = Git.bare @wbare assert_equal(g.repo.path, @wbare) end @@ -51,11 +51,19 @@ class TestInit < Test::Unit::TestCase def test_git_clone in_temp_dir do |path| - Git.clone(uri, :repository => dir) - assert(File.exists?(File.join(dir, 'config'))) + g = Git.clone(@wbare, 'bare-co') + assert(File.exists?(File.join(g.repo.path, 'config'))) end end - + + def test_git_clone_bare + in_temp_dir do |path| + g = Git.clone(@wbare, 'bare.git', :bare => true) + assert(File.exists?(File.join(g.repo.path, 'config'))) + assert_nil(g.dir) + end + end + # trying to open a git project using a bare repo - rather than using Git.repo def test_git_open_error assert_raise ArgumentError do diff --git a/tests/units/test_lib.rb b/tests/units/test_lib.rb index 03a4411..5fbd896 100644 --- a/tests/units/test_lib.rb +++ b/tests/units/test_lib.rb @@ -82,10 +82,10 @@ class TestLib < Test::Unit::TestCase def test_branches_all branches = @lib.branches_all assert(branches.size > 0) - assert(branches.select { |b| b.current }.size > 0) # has a current branch - assert(branches.select { |b| b.remote }.size > 0) # has a remote branch - assert(branches.select { |b| !b.remote }.size > 0) # has a local branch - assert(branches.select { |b| b.name == 'master' }.size > 0) # has a master branch + assert(branches.select { |b| b[1] }.size > 0) # has a current branch + assert(branches.select { |b| /\//.match(b[0]) }.size > 0) # has a remote branch + assert(branches.select { |b| !/\//.match(b[0]) }.size > 0) # has a local branch + assert(branches.select { |b| /master/.match(b[0]) }.size > 0) # has a master branch end def test_config_remote diff --git a/tests/units/test_log.rb b/tests/units/test_log.rb index b62c544..7198b8a 100644 --- a/tests/units/test_log.rb +++ b/tests/units/test_log.rb @@ -36,7 +36,7 @@ class TestLog < Test::Unit::TestCase assert_equal(30, l.size) l = @git.log.between('v2.5').object('example.txt') - assert_equal(2, l.size) + assert_equal(3, l.size) l = @git.log.between('v2.5', 'test').object('example.txt') assert_equal(1, l.size) diff --git a/tests/units/test_object.rb b/tests/units/test_object.rb index df565d5..c115b75 100644 --- a/tests/units/test_object.rb +++ b/tests/units/test_object.rb @@ -32,9 +32,9 @@ class TestObject < Test::Unit::TestCase end def test_object_to_s - assert_equal('commit 1cc8667014381e2788a94777532a788307f38d26', @commit.to_s) - assert_equal('tree 94c827875e2cadb8bc8d4cdd900f19aa9e8634c7', @tree.to_s) - assert_equal('blob ba492c62b6227d7f3507b4dcc6e6d5f13790eabf', @blob.to_s) + assert_equal('1cc8667014381e2788a94777532a788307f38d26', @commit.to_s) + assert_equal('94c827875e2cadb8bc8d4cdd900f19aa9e8634c7', @tree.to_s) + assert_equal('ba492c62b6227d7f3507b4dcc6e6d5f13790eabf', @blob.to_s) end def test_object_size |