diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-29 06:52:18 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-29 06:52:18 +0000 |
commit | 9694bb8cac12969300692dac5a1cf7aa4e3a46cd (patch) | |
tree | c3cb423d701f7049ba9382de052e2a937cd1302d /test/rubygems/test_gem_source_list.rb | |
parent | 3f606b7063fc7a8b191556365ad343a314719a8d (diff) | |
download | ruby-9694bb8cac12969300692dac5a1cf7aa4e3a46cd.tar.gz |
* lib/rubygems*: Updated to RubyGems 2.0
* test/rubygems*: ditto.
* common.mk (prelude): Updated for RubyGems 2.0 source rearrangement.
* tool/change_maker.rb: Allow invalid UTF-8 characters in source
files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_source_list.rb')
-rw-r--r-- | test/rubygems/test_gem_source_list.rb | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_source_list.rb b/test/rubygems/test_gem_source_list.rb new file mode 100644 index 0000000000..d6e253833e --- /dev/null +++ b/test/rubygems/test_gem_source_list.rb @@ -0,0 +1,87 @@ +require 'rubygems/source_list' +require 'rubygems/test_case' + +class TestGemSourceList < Gem::TestCase + def setup + super + + @uri = "http://blah.com" + @source = Gem::Source.new(@uri) + + @sl = Gem::SourceList.new + @sl << @source + end + + def test_self_from + sl = Gem::SourceList.from [@uri] + + assert_equal [Gem::Source.new(@uri)], sl.sources + end + + def test_append + sl = Gem::SourceList.new + source = (sl << @uri) + + assert_kind_of Gem::Source, source + + assert_kind_of URI, source.uri + assert_equal source.uri.to_s, @uri + + assert_equal [source], sl.sources + end + + def test_replace + sl = Gem::SourceList.new + sl.replace [@uri] + + assert_equal [@source], sl.sources + end + + def test_each + @sl.each do |x| + assert_equal @uri, x + end + end + + def test_each_source + @sl.each_source do |x| + assert_equal @source, x + end + end + + def test_equal_to_another_list + sl2 = Gem::SourceList.new + sl2 << Gem::Source.new(@uri) + + assert @sl == sl2, "lists not equal" + end + + def test_equal_to_array + assert @sl == [@uri], "lists not equal" + end + + def test_to_a + assert_equal @sl.to_a, [@uri] + end + + def test_include_eh + assert @sl.include?(@uri), "string comparison not working" + assert @sl.include?(URI.parse(@uri)), "uri comparison not working" + end + + def test_include_matches_a_source + assert @sl.include?(@source), "source comparison not working" + assert @sl.include?(Gem::Source.new(@uri)), "source comparison not working" + end + + def test_delete + @sl.delete @uri + assert_equal @sl.sources, [] + end + + def test_delete_a_source + @sl.delete Gem::Source.new(@uri) + assert_equal @sl.sources, [] + end + +end |