diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-08 07:19:09 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-08 07:19:09 +0000 |
commit | ed5d5c5829ccd91261b27438e2aa146f7aec755e (patch) | |
tree | dc11e68e4128f5d250d88f1ef70c8bd68ef1e166 /test/rubygems | |
parent | 6c0f2b097edabefd7ab8dfa1c36128de8febbe99 (diff) | |
download | ruby-ed5d5c5829ccd91261b27438e2aa146f7aec755e.tar.gz |
* lib/rubygems: update to 1.3.5.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems')
-rw-r--r-- | test/rubygems/gem_package_tar_test_case.rb | 4 | ||||
-rw-r--r-- | test/rubygems/insure_session.rb | 2 | ||||
-rw-r--r-- | test/rubygems/simple_gem.rb | 30 | ||||
-rw-r--r-- | test/rubygems/test_gem.rb | 10 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_dependency_command.rb | 4 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_uninstall_command.rb | 20 | ||||
-rw-r--r--[-rwxr-xr-x] | test/rubygems/test_gem_digest.rb | 0 | ||||
-rw-r--r-- | test/rubygems/test_gem_doc_manager.rb | 2 | ||||
-rw-r--r-- | test/rubygems/test_gem_indexer.rb | 89 | ||||
-rw-r--r-- | test/rubygems/test_gem_package_tar_input.rb | 2 | ||||
-rw-r--r-- | test/rubygems/test_gem_package_tar_writer.rb | 6 | ||||
-rw-r--r-- | test/rubygems/test_gem_source_index.rb | 6 | ||||
-rw-r--r-- | test/rubygems/test_gem_spec_fetcher.rb | 18 | ||||
-rw-r--r-- | test/rubygems/test_gem_specification.rb | 2 | ||||
-rw-r--r-- | test/rubygems/test_gem_version.rb | 4 |
15 files changed, 133 insertions, 66 deletions
diff --git a/test/rubygems/gem_package_tar_test_case.rb b/test/rubygems/gem_package_tar_test_case.rb index 462fa08848..f671693cc0 100644 --- a/test/rubygems/gem_package_tar_test_case.rb +++ b/test/rubygems/gem_package_tar_test_case.rb @@ -35,7 +35,7 @@ class TarTestCase < RubyGemTestCase linkname 100 magic 6 version 2 - uname 32 + uname 32 gname 32 devmajor 8 devminor 8 @@ -54,7 +54,7 @@ class TarTestCase < RubyGemTestCase next end - assert_equal expected[offset, length], actual[offset, length], + assert_equal expected[offset, length], actual[offset, length], "Field #{name} of the tar header differs." offset += length diff --git a/test/rubygems/insure_session.rb b/test/rubygems/insure_session.rb index e56f9abcb8..4ae706494a 100644 --- a/test/rubygems/insure_session.rb +++ b/test/rubygems/insure_session.rb @@ -23,7 +23,7 @@ def install_session puts puts "with the appropriate admin privileges." puts "*****************************************************************" - puts + puts exit end gem 'session' diff --git a/test/rubygems/simple_gem.rb b/test/rubygems/simple_gem.rb index a6f14bc3c7..4667a08749 100644 --- a/test/rubygems/simple_gem.rb +++ b/test/rubygems/simple_gem.rb @@ -5,10 +5,10 @@ #++ SIMPLE_GEM = <<-GEMDATA - MD5SUM = "e3701f9db765a2358aef94c40ded71c8" + MD5SUM = "b12a4d48febeb2289c539c2574c4b6f8" if $0 == __FILE__ require 'optparse' - + options = {} ARGV.options do |opts| opts.on_tail("--help", "show this message") {puts opts; exit} @@ -19,45 +19,45 @@ end require 'rubygems' - @directory = options[:directory] || Gem.dir + @directory = options[:directory] || Gem.dir @force = options[:force] - - gem = Gem::Installer.new(__FILE__).install(@force, @directory) + + gem = Gem::Installer.new(__FILE__).install(@force, @directory) if options[:gen_rdoc] Gem::DocManager.new(gem).generate_rdoc end end __END__ ---- !ruby/object:Gem::Specification +--- !ruby/object:Gem::Specification rubygems_version: "1.0" name: testing -version: !ruby/object:Gem::Version +version: !ruby/object:Gem::Version version: 1.2.3 date: 2004-03-18 22:01:52.859121 -05:00 -platform: +platform: summary: This exercise the gem testing stuff. -require_paths: +require_paths: - lib -files: +files: - lib/foo.rb - lib/test - lib/test.rb - lib/test/wow.rb autorequire: test test_suite_file: foo -requirements: +requirements: - a computer processor ---- -- +--- +- size: 109 mode: 420 path: lib/foo.rb -- +- size: 0 mode: 420 path: lib/test.rb -- +- size: 15 mode: 420 path: lib/test/wow.rb diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index e18004c4ea..e6d3f896b4 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -78,14 +78,6 @@ class TestGem < RubyGemTestCase end end - def test_self_bin_path_with_spaces - quick_gem 'sp ace', '3' do |s| - s.executables = ['exec'] - end - path = Gem.bin_path('sp ace', 'exec') - assert_equal %w(" "), [path[0,1], path[-1,1]], "Path should be escaped" - end - def test_self_bin_path_not_found assert_raises(Gem::GemNotFoundException) do Gem.bin_path('non-existent') @@ -449,7 +441,7 @@ class TestGem < RubyGemTestCase def test_self_refresh util_make_gems - a1_spec = File.join @gemhome, "specifications", "#{@a1.full_name}.gemspec" + a1_spec = File.join @gemhome, "specifications", "#{@a1.full_name}.gemspec" FileUtils.mv a1_spec, @tempdir diff --git a/test/rubygems/test_gem_commands_dependency_command.rb b/test/rubygems/test_gem_commands_dependency_command.rb index 2452189d72..66e9d86d52 100644 --- a/test/rubygems/test_gem_commands_dependency_command.rb +++ b/test/rubygems/test_gem_commands_dependency_command.rb @@ -43,6 +43,8 @@ Gem a-1 Gem a-2 +Gem a-3.a + Gem a_evil-9 Gem b-2 @@ -100,6 +102,8 @@ Gem a-1 Gem a-2 +Gem a-3.a + Gem a_evil-9 Gem b-2 diff --git a/test/rubygems/test_gem_commands_uninstall_command.rb b/test/rubygems/test_gem_commands_uninstall_command.rb index a6ac23812b..092a9072c0 100644 --- a/test/rubygems/test_gem_commands_uninstall_command.rb +++ b/test/rubygems/test_gem_commands_uninstall_command.rb @@ -57,5 +57,25 @@ class TestGemCommandsUninstallCommand < GemInstallerTestCase assert_empty output, "UI output should be empty after an uninstall error" end + def test_execute_prerelease + @spec = quick_gem "pre", "2.b" + @gem = File.join @tempdir, "#{@spec.full_name}.gem" + FileUtils.touch @gem + + util_setup_gem + + use_ui @ui do + @installer.install + end + + @cmd.options[:args] = ["pre"] + + use_ui @ui do + @cmd.execute + end + + output = @ui.output + assert_match(/Successfully uninstalled/, output) + end end diff --git a/test/rubygems/test_gem_digest.rb b/test/rubygems/test_gem_digest.rb index 6bce4e4537..6bce4e4537 100755..100644 --- a/test/rubygems/test_gem_digest.rb +++ b/test/rubygems/test_gem_digest.rb diff --git a/test/rubygems/test_gem_doc_manager.rb b/test/rubygems/test_gem_doc_manager.rb index 051c926307..e3928ed2bc 100644 --- a/test/rubygems/test_gem_doc_manager.rb +++ b/test/rubygems/test_gem_doc_manager.rb @@ -18,7 +18,7 @@ class TestGemDocManager < RubyGemTestCase def test_uninstall_doc_unwritable orig_mode = File.stat(@spec.installation_path).mode - + # File.chmod has no effect on MS Windows directories (it needs ACL). if win_platform? skip("test_uninstall_doc_unwritable skipped on MS Windows") diff --git a/test/rubygems/test_gem_indexer.rb b/test/rubygems/test_gem_indexer.rb index 7d721d028d..e612a71d55 100644 --- a/test/rubygems/test_gem_indexer.rb +++ b/test/rubygems/test_gem_indexer.rb @@ -9,7 +9,7 @@ require_relative 'gemutilities' require 'rubygems/indexer' unless ''.respond_to? :to_xs then - warn "Gem::Indexer tests are being skipped. Install builder gem." + warn "Gem::Indexer tests are being skipped. Install builder gem." if $VERBOSE end class TestGemIndexer < RubyGemTestCase @@ -118,10 +118,13 @@ class TestGemIndexer < RubyGemTestCase expected = <<-EOF a-1 a-2 +a-3.a a_evil-9 b-2 c-1.2 d-2.0 +d-2.0.a +d-2.0.b pl-1-i386-linux EOF @@ -163,13 +166,13 @@ pl-1-i386-linux assert_indexed @tempdir, "latest_specs.#{@marshal_version}.gz" expected = <<-EOF -<?xml version="1.0"?> -<rss version="2.0"> +<?xml version=\"1.0\"?> +<rss version=\"2.0\"> <channel> <title>ExampleForge gems</title> <link>http://example.com</link> <description>Recently released gems from http://example.com</description> - <generator>RubyGems v#{Gem::RubyGemsVersion}</generator> + <generator>RubyGems v1.3.4</generator> <docs>http://cyber.law.harvard.edu/rss/rss.html</docs> <item> <title>a-2</title> @@ -178,9 +181,21 @@ pl-1-i386-linux </description> <author>example@example.com (A User)</author> <guid>a-2</guid> - <enclosure url="http://gems.example.com/gems/a-2.gem" - length="3072" type="application/octet-stream" /> - <pubDate>#{Gem::Specification::TODAY.rfc2822}</pubDate> + <enclosure url=\"http://gems.example.com/gems/a-2.gem\" + length=\"3072\" type=\"application/octet-stream\" /> + <pubDate>#{@a2.date.rfc2822}</pubDate> + <link>http://example.com</link> + </item> + <item> + <title>a-3.a</title> + <description> +<pre>This is a test description</pre> + </description> + <author>example@example.com (A User)</author> + <guid>a-3.a</guid> + <enclosure url=\"http://gems.example.com/gems/a-3.a.gem\" + length=\"3072\" type=\"application/octet-stream\" /> + <pubDate>#{@a3a.date.rfc2822}</pubDate> <link>http://example.com</link> </item> <item> @@ -190,9 +205,9 @@ pl-1-i386-linux </description> <author>example@example.com (A User)</author> <guid>a_evil-9</guid> - <enclosure url="http://gems.example.com/gems/a_evil-9.gem" - length="3072" type="application/octet-stream" /> - <pubDate>#{Gem::Specification::TODAY.rfc2822}</pubDate> + <enclosure url=\"http://gems.example.com/gems/a_evil-9.gem\" + length=\"3072\" type=\"application/octet-stream\" /> + <pubDate>#{@a_evil9.date.rfc2822}</pubDate> <link>http://example.com</link> </item> <item> @@ -202,9 +217,9 @@ pl-1-i386-linux </description> <author>example@example.com (A User)</author> <guid>b-2</guid> - <enclosure url="http://gems.example.com/gems/b-2.gem" - length="3072" type="application/octet-stream" /> - <pubDate>#{Gem::Specification::TODAY.rfc2822}</pubDate> + <enclosure url=\"http://gems.example.com/gems/b-2.gem\" + length=\"3072\" type=\"application/octet-stream\" /> + <pubDate>#{@b2.date.rfc2822}</pubDate> <link>http://example.com</link> </item> <item> @@ -214,9 +229,33 @@ pl-1-i386-linux </description> <author>example@example.com (A User)</author> <guid>c-1.2</guid> - <enclosure url="http://gems.example.com/gems/c-1.2.gem" - length="3072" type="application/octet-stream" /> - <pubDate>#{Gem::Specification::TODAY.rfc2822}</pubDate> + <enclosure url=\"http://gems.example.com/gems/c-1.2.gem\" + length=\"3072\" type=\"application/octet-stream\" /> + <pubDate>#{@c1_2.date.rfc2822}</pubDate> + <link>http://example.com</link> + </item> + <item> + <title>d-2.0.a</title> + <description> +<pre>This is a test description</pre> + </description> + <author>example@example.com (A User)</author> + <guid>d-2.0.a</guid> + <enclosure url=\"http://gems.example.com/gems/d-2.0.a.gem\" + length=\"3072\" type=\"application/octet-stream\" /> + <pubDate>#{@d2_0_a.date.rfc2822}</pubDate> + <link>http://example.com</link> + </item> + <item> + <title>d-2.0.b</title> + <description> +<pre>This is a test description</pre> + </description> + <author>example@example.com (A User)</author> + <guid>d-2.0.b</guid> + <enclosure url=\"http://gems.example.com/gems/d-2.0.b.gem\" + length=\"3072\" type=\"application/octet-stream\" /> + <pubDate>#{@d2_0_b.date.rfc2822}</pubDate> <link>http://example.com</link> </item> <item> @@ -226,9 +265,9 @@ pl-1-i386-linux </description> <author>example@example.com (A User)</author> <guid>pl-1-x86-linux</guid> - <enclosure url="http://gems.example.com/gems/pl-1-x86-linux.gem" - length="3072" type="application/octet-stream" /> - <pubDate>#{Gem::Specification::TODAY.rfc2822}</pubDate> + <enclosure url=\"http://gems.example.com/gems/pl-1-x86-linux.gem\" + length=\"3072\" type=\"application/octet-stream\" /> + <pubDate>#{@pl1.date.rfc2822}</pubDate> <link>http://example.com</link> </item> <item> @@ -247,9 +286,9 @@ eighty characters.</pre> </description> <author>example@example.com (Example), example2@example.com (Example2)</author> <guid>a-1</guid> - <enclosure url="http://gems.example.com/gems/a-1.gem" - length="3584" type="application/octet-stream" /> - <pubDate>#{(Gem::Specification::TODAY - 86400).rfc2822}</pubDate> + <enclosure url=\"http://gems.example.com/gems/a-1.gem\" + length=\"3584\" type=\"application/octet-stream\" /> + <pubDate>#{@a1.date.rfc2822}</pubDate> <link>http://a.example.com</link> </item> </channel> @@ -462,9 +501,9 @@ eighty characters.</pre> @ui.output assert_match %r%^\.\.\.\.\.\.\.\.\.\.$%, @ui.output assert_match %r%^Loaded all gems$%, @ui.output - assert_match %r%^Generating Marshal quick index gemspecs for 7 gems$%, + assert_match %r%^Generating Marshal quick index gemspecs for 10 gems$%, @ui.output - assert_match %r%^Generating YAML quick index gemspecs for 7 gems$%, + assert_match %r%^Generating YAML quick index gemspecs for 10 gems$%, @ui.output assert_match %r%^Complete$%, @ui.output assert_match %r%^Generating specs index$%, @ui.output @@ -473,7 +512,7 @@ eighty characters.</pre> assert_match %r%^Generating latest index$%, @ui.output assert_match %r%^Generating prerelease specs index$%, @ui.output assert_match %r%^Generating Marshal master index$%, @ui.output - assert_match %r%^Generating YAML master index for 7 gems \(this may take a while\)$%, @ui.output + assert_match %r%^Generating YAML master index for 10 gems \(this may take a while\)$%, @ui.output assert_match %r%^Complete$%, @ui.output assert_match %r%^Compressing indicies$%, @ui.output diff --git a/test/rubygems/test_gem_package_tar_input.rb b/test/rubygems/test_gem_package_tar_input.rb index 2459802b12..7eea1826e0 100644 --- a/test/rubygems/test_gem_package_tar_input.rb +++ b/test/rubygems/test_gem_package_tar_input.rb @@ -47,7 +47,7 @@ class TestGemPackageTarInput < TarTestCase meta = @spec.to_yaml f.write tar_file_header("metadata", "", 0644, meta.size) - f.write meta + "\0" * (1024 - meta.size) + f.write meta + "\0" * (1024 - meta.size) f.write "\0" * 1024 end diff --git a/test/rubygems/test_gem_package_tar_writer.rb b/test/rubygems/test_gem_package_tar_writer.rb index 0adc595ad0..0d691e45cd 100644 --- a/test/rubygems/test_gem_package_tar_writer.rb +++ b/test/rubygems/test_gem_package_tar_writer.rb @@ -45,7 +45,7 @@ class TestTarWriter < TarTestCase def test_add_file_simple_padding @tar_writer.add_file_simple 'x', 0, 100 - assert_headers_equal tar_file_header('x', '', 0, 100), + assert_headers_equal tar_file_header('x', '', 0, 100), @io.string[0, 512] assert_equal "\0" * 512, @io.string[512, 512] @@ -60,7 +60,7 @@ class TestTarWriter < TarTestCase end def test_add_file_simple_size - assert_raises Gem::Package::TarWriter::FileOverflow do + assert_raises Gem::Package::TarWriter::FileOverflow do @tar_writer.add_file_simple("lib/foo/bar", 0, 10) do |io| io.write "1" * 11 end @@ -68,7 +68,7 @@ class TestTarWriter < TarTestCase end def test_add_file_unseekable - assert_raises Gem::Package::NonSeekableIO do + assert_raises Gem::Package::NonSeekableIO do Gem::Package::TarWriter.new(Object.new).add_file 'x', 0 end end diff --git a/test/rubygems/test_gem_source_index.rb b/test/rubygems/test_gem_source_index.rb index 9cfde0b0a9..40a9a85b27 100644 --- a/test/rubygems/test_gem_source_index.rb +++ b/test/rubygems/test_gem_source_index.rb @@ -335,14 +335,12 @@ WARNING: Invalid .gemspec format in '#{spec_file}' @source_index.add_spec gem_a1_alpha refute @source_index.latest_specs.include?(gem_a1_alpha) - assert_nil @source_index.specification(gem_a1_alpha.full_name) + assert @source_index.find_name(gem_a1_alpha.full_name).empty? assert @source_index.prerelease_specs.include?(gem_a1_alpha) - - # TODO: don't think this tests writing prerelease index to disk end def test_refresh_bang - a1_spec = File.join @gemhome, "specifications", "#{@a1.full_name}.gemspec" + a1_spec = File.join @gemhome, "specifications", "#{@a1.full_name}.gemspec" FileUtils.mv a1_spec, @tempdir diff --git a/test/rubygems/test_gem_spec_fetcher.rb b/test/rubygems/test_gem_spec_fetcher.rb index 42bf6926c2..4a6f22bafd 100644 --- a/test/rubygems/test_gem_spec_fetcher.rb +++ b/test/rubygems/test_gem_spec_fetcher.rb @@ -45,6 +45,8 @@ class TestGemSpecFetcher < RubyGemTestCase util_zip(Marshal.dump(@a2)) @fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a_pre.full_name}.gemspec.rz"] = util_zip(Marshal.dump(@a_pre)) + @fetcher.data["#{@gem_repo}#{Gem::MARSHAL_SPEC_DIR}#{@a3a.full_name}.gemspec.rz"] = + util_zip(Marshal.dump(@a3a)) dep = Gem::Dependency.new 'a', 1 specs_and_sources = @sf.fetch dep, true @@ -273,7 +275,12 @@ RubyGems will revert to legacy indexes degrading performance. assert_equal [@uri], specs.keys - assert_equal @specs, specs[@uri].sort + assert_equal([["a", Gem::Version.new("1"), "ruby"], + ["a", Gem::Version.new("2"), "ruby"], + ["a_evil", Gem::Version.new("9"), "ruby"], + ["c", Gem::Version.new("1.2"), "ruby"], + ["pl", Gem::Version.new("1"), "i386-linux"]], + specs[@uri].sort) end def test_list_cache @@ -307,7 +314,12 @@ RubyGems will revert to legacy indexes degrading performance. specs = @sf.list true - assert_equal [@specs], specs.values, 'specs file not loaded' + assert_equal([[["a", Gem::Version.new("1"), "ruby"], + ["a", Gem::Version.new("2"), "ruby"], + ["a_evil", Gem::Version.new("9"), "ruby"], + ["c", Gem::Version.new("1.2"), "ruby"], + ["pl", Gem::Version.new("1"), "i386-linux"]]], + specs.values, 'specs file not loaded') end def test_list_prerelease @@ -320,8 +332,10 @@ RubyGems will revert to legacy indexes degrading performance. specs = @sf.load_specs @uri, 'specs' expected = [ + ['a', Gem::Version.new('1.a'), Gem::Platform::RUBY], ['a', Gem::Version.new(1), Gem::Platform::RUBY], ['a', Gem::Version.new(2), Gem::Platform::RUBY], + ['a', Gem::Version.new('3.a'), Gem::Platform::RUBY], ['a_evil', Gem::Version.new(9), Gem::Platform::RUBY], ['c', Gem::Version.new('1.2'), Gem::Platform::RUBY], ['pl', Gem::Version.new(1), 'i386-linux'], diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index 332e812791..fb5cf67461 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -566,7 +566,7 @@ end 'i386-mswin32_80' => 'a-1-x86-mswin32-80', 'i386-mingw32' => 'a-1-x86-mingw32' } - + test_cases.each do |arch, expected| util_set_arch arch @a1.platform = 'current' diff --git a/test/rubygems/test_gem_version.rb b/test/rubygems/test_gem_version.rb index dfd3845e42..f2b0280f3d 100644 --- a/test/rubygems/test_gem_version.rb +++ b/test/rubygems/test_gem_version.rb @@ -199,7 +199,7 @@ class TestGemVersion < RubyGemTestCase refute Gem::Version.new('2.9').prerelease? refute Gem::Version.new('22.1.50.0').prerelease? end - + def test_release assert_equal Gem::Version.new('1.2.0'), Gem::Version.new('1.2.0.a').release assert_equal Gem::Version.new('1.1'), Gem::Version.new('1.1.rc10').release @@ -219,7 +219,7 @@ class TestGemVersion < RubyGemTestCase assert_adequate( "1.4.5", "~> 1.4.4") assert_inadequate("1.5", "~> 1.4.4") assert_inadequate("2.0", "~> 1.4.4") - + assert_inadequate("1.1.pre", "~> 1.0.0") assert_adequate( "1.1.pre", "~> 1.1") assert_inadequate("2.0.a", "~> 1.0") |