summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorscott Chacon <schacon@agadorsparticus.(none)>2007-11-11 16:01:23 -0800
committerscott Chacon <schacon@agadorsparticus.(none)>2007-11-11 16:01:23 -0800
commit907b03949bab53e2f7d55094100a71abd22f23e7 (patch)
tree51b7fca355ac7007957d966cbebbcbf331c57d7d /tests
parentb81ee9305f418209ba0d77fbb7b47b23d4b121ca (diff)
downloadthird_party-ruby-git-907b03949bab53e2f7d55094100a71abd22f23e7.tar.gz
third_party-ruby-git-907b03949bab53e2f7d55094100a71abd22f23e7.tar.xz
third_party-ruby-git-907b03949bab53e2f7d55094100a71abd22f23e7.zip
added tagging
Diffstat (limited to 'tests')
-rw-r--r--tests/units/test_remotes.rb45
-rw-r--r--tests/units/test_tags.rb35
2 files changed, 80 insertions, 0 deletions
diff --git a/tests/units/test_remotes.rb b/tests/units/test_remotes.rb
new file mode 100644
index 0000000..ddb066e
--- /dev/null
+++ b/tests/units/test_remotes.rb
@@ -0,0 +1,45 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class TestRemotes < Test::Unit::TestCase
+ def setup
+ set_file_paths
+ end
+
+ def test_remote_fun
+ in_temp_dir do |path|
+ loc = Git.clone(@wbare, 'local')
+ rem = Git.clone(@wbare, 'remote')
+
+ r = loc.add_remote('testrem', rem)
+
+ Dir.chdir('remote') do
+ new_file('test-file1', 'blahblahblah1')
+ rem.add
+ rem.commit('master commit')
+
+ rem.branch('testbranch').in_branch('tb commit') do
+ new_file('test-file3', 'blahblahblah3')
+ rem.add
+ true
+ end
+ end
+ assert(!loc.status['test-file1'])
+ assert(!loc.status['test-file3'])
+
+ r.fetch
+ r.merge
+ assert(loc.status['test-file1'])
+
+ loc.merge(loc.remote('testrem').branch('testbranch'))
+ assert(loc.status['test-file3'])
+
+ #puts loc.remotes.map { |r| r.to_s }.inspect
+
+ #r.remove
+ #puts loc.remotes.inspect
+ end
+ end
+
+end \ No newline at end of file
diff --git a/tests/units/test_tags.rb b/tests/units/test_tags.rb
new file mode 100644
index 0000000..7d6f279
--- /dev/null
+++ b/tests/units/test_tags.rb
@@ -0,0 +1,35 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../test_helper'
+
+class TestTags < Test::Unit::TestCase
+ def setup
+ set_file_paths
+ end
+
+ def test_tags
+ in_temp_dir do |path|
+ r1 = Git.clone(@wbare, 'repo1')
+ r2 = Git.clone(@wbare, 'repo2')
+
+ assert_raise Git::GitTagNameDoesNotExist do
+ r1.tag('first')
+ end
+
+ r1.add_tag('first')
+ r1.chdir do
+ new_file('new_file', 'new content')
+ end
+ r1.add
+ r1.commit('my commit')
+ r1.add_tag('second')
+
+ assert(r1.tags.map{|t| t.name}.include?('first'))
+
+ r2.add_tag('third')
+
+ assert(r2.tags.map{|t| t.name}.include?('third'))
+ assert(!r2.tags.map{|t| t.name}.include?('second'))
+ end
+ end
+end \ No newline at end of file