From 53468cc11147b0d285fc376fc546b677dad600ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Mon, 1 Feb 2021 16:17:16 +0100 Subject: Sync latest development version of bundler & rubygems --- .../data/null-required-ruby-version.gemspec.rz | Bin 0 -> 403 bytes test/rubygems/test_gem.rb | 93 +++++++++++++++++++-- .../rubygems/test_gem_commands_outdated_command.rb | 18 ++++ test/rubygems/test_gem_config_file.rb | 10 +++ test/rubygems/test_gem_dependency_installer.rb | 45 ++++++---- test/rubygems/test_gem_ext_builder.rb | 24 ++++++ test/rubygems/test_gem_installer.rb | 2 + test/rubygems/test_gem_platform.rb | 37 ++++++++ test/rubygems/test_gem_remote_fetcher.rb | 6 ++ test/rubygems/test_gem_requirement.rb | 36 +++++++- test/rubygems/test_gem_specification.rb | 59 ++++--------- test/rubygems/test_gem_stream_ui.rb | 2 +- test/rubygems/test_gem_util.rb | 8 +- 13 files changed, 267 insertions(+), 73 deletions(-) create mode 100644 test/rubygems/data/null-required-ruby-version.gemspec.rz (limited to 'test') diff --git a/test/rubygems/data/null-required-ruby-version.gemspec.rz b/test/rubygems/data/null-required-ruby-version.gemspec.rz new file mode 100644 index 0000000000..f4ec1a9620 Binary files /dev/null and b/test/rubygems/data/null-required-ruby-version.gemspec.rz differ diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 344b03be9b..8b028d3495 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -297,6 +297,58 @@ class TestGem < Gem::TestCase assert_equal %w[a-1 b-2 c-1], loaded_spec_names end + def test_activate_bin_path_does_not_error_if_a_gem_thats_not_finally_activated_has_orphaned_dependencies + a1 = util_spec 'a', '1' do |s| + s.executables = ['exec'] + s.add_dependency 'b' + end + + b1 = util_spec 'b', '1' do |s| + s.add_dependency 'c', '1' + end + + b2 = util_spec 'b', '2' do |s| + s.add_dependency 'c', '2' + end + + c2 = util_spec 'c', '2' + + install_specs c2, b1, b2, a1 + + # c1 is missing, but not needed for activation, so we should not get any errors here + + Gem.activate_bin_path("a", "exec", ">= 0") + + assert_equal %w[a-1 b-2 c-2], loaded_spec_names + end + + def test_activate_bin_path_raises_a_meaningful_error_if_a_gem_thats_finally_activated_has_orphaned_dependencies + a1 = util_spec 'a', '1' do |s| + s.executables = ['exec'] + s.add_dependency 'b' + end + + b1 = util_spec 'b', '1' do |s| + s.add_dependency 'c', '1' + end + + b2 = util_spec 'b', '2' do |s| + s.add_dependency 'c', '2' + end + + c1 = util_spec 'c', '1' + + install_specs c1, b1, b2, a1 + + # c2 is missing, and b2 which has it as a dependency will be activated, so we should get an error about the orphaned dependency + + e = assert_raises Gem::UnsatisfiableDependencyError do + load Gem.activate_bin_path("a", "exec", ">= 0") + end + + assert_equal "Unable to resolve dependency: 'b (>= 0)' requires 'c (= 2)'", e.message + end + def test_activate_bin_path_in_debug_mode a1 = util_spec 'a', '1' do |s| s.executables = ['exec'] @@ -416,6 +468,32 @@ class TestGem < Gem::TestCase assert_equal %w[bundler-1.17.3], loaded_spec_names end + def test_activate_bin_path_gives_proper_error_for_bundler_when_underscore_selection_given + File.open("Gemfile.lock", "w") do |f| + f.write <<-L.gsub(/ {8}/, "") + GEM + remote: https://rubygems.org/ + specs: + + PLATFORMS + ruby + + DEPENDENCIES + + BUNDLED WITH + 2.1.4 + L + end + + File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') } + + e = assert_raises Gem::GemNotFoundException do + load Gem.activate_bin_path("bundler", "bundle", "= 2.2.8") + end + + assert_equal "can't find gem bundler (= 2.2.8) with executable bundle", e.message + end + def test_self_bin_path_no_exec_name e = assert_raises ArgumentError do Gem.bin_path 'a' @@ -692,6 +770,11 @@ class TestGem < Gem::TestCase ensure FileUtils.chmod 0600, parent end + + def test_self_ensure_gem_directories_non_existent_paths + Gem.ensure_gem_subdirectories '/proc/0123456789/bogus' # should not raise + Gem.ensure_gem_subdirectories 'classpath:/bogus/x' # JRuby embed scenario + end end def test_self_extension_dir_shared @@ -1875,15 +1958,9 @@ class TestGem < Gem::TestCase io.write 'gem "a"' end - platform = Bundler::GemHelpers.generic_local_platform - if platform == Gem::Platform::RUBY - platform = '' - else - platform = " #{platform}" - end - expected = <<-EXPECTED -Could not find gem 'a#{platform}' in any of the gem sources listed in your Gemfile. +Could not find gem 'a' in locally installed gems. +The source does not contain any versions of 'a' You may need to `gem install -g` to install missing gems EXPECTED diff --git a/test/rubygems/test_gem_commands_outdated_command.rb b/test/rubygems/test_gem_commands_outdated_command.rb index 57939b8088..c4af421f5d 100644 --- a/test/rubygems/test_gem_commands_outdated_command.rb +++ b/test/rubygems/test_gem_commands_outdated_command.rb @@ -28,4 +28,22 @@ class TestGemCommandsOutdatedCommand < Gem::TestCase assert_equal "foo (0.2 < 2.0)\n", @ui.output assert_equal "", @ui.error end + + def test_execute_with_up_to_date_platform_specific_gem + spec_fetcher do |fetcher| + fetcher.download 'foo', '2.0' + + fetcher.gem 'foo', '1.0' + fetcher.gem 'foo', '2.0' do |s| + s.platform = Gem::Platform.local + end + end + + use_ui @ui do + @cmd.execute + end + + assert_equal "", @ui.output + assert_equal "", @ui.error + end end diff --git a/test/rubygems/test_gem_config_file.rb b/test/rubygems/test_gem_config_file.rb index ddc35a9594..7db31013aa 100644 --- a/test/rubygems/test_gem_config_file.rb +++ b/test/rubygems/test_gem_config_file.rb @@ -41,6 +41,7 @@ class TestGemConfigFile < Gem::TestCase assert_equal true, @cfg.verbose assert_equal [@gem_repo], Gem.sources assert_equal 365, @cfg.cert_expiration_length_days + assert_equal false, @cfg.ipv4_fallback_enabled File.open @temp_conf, 'w' do |fp| fp.puts ":backtrace: true" @@ -56,6 +57,7 @@ class TestGemConfigFile < Gem::TestCase fp.puts ":ssl_verify_mode: 0" fp.puts ":ssl_ca_cert: /etc/ssl/certs" fp.puts ":cert_expiration_length_days: 28" + fp.puts ":ipv4_fallback_enabled: true" end util_config_file @@ -70,6 +72,14 @@ class TestGemConfigFile < Gem::TestCase assert_equal 0, @cfg.ssl_verify_mode assert_equal '/etc/ssl/certs', @cfg.ssl_ca_cert assert_equal 28, @cfg.cert_expiration_length_days + assert_equal true, @cfg.ipv4_fallback_enabled + end + + def test_initialize_ipv4_fallback_enabled_env + ENV['IPV4_FALLBACK_ENABLED'] = 'true' + util_config_file %W[--config-file #{@temp_conf}] + + assert_equal true, @cfg.ipv4_fallback_enabled end def test_initialize_handle_arguments_config_file diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb index 85dba54675..c62a3f355a 100644 --- a/test/rubygems/test_gem_dependency_installer.rb +++ b/test/rubygems/test_gem_dependency_installer.rb @@ -44,7 +44,7 @@ class TestGemDependencyInstaller < Gem::TestCase s.add_development_dependency 'c' end - util_reset_gems + util_setup_spec_fetcher(@a1, @a1_pre, @b1, @d1) end def test_install @@ -287,8 +287,6 @@ class TestGemDependencyInstaller < Gem::TestCase @aa1, @aa1_gem = util_gem 'aa', '1' - util_reset_gems - FileUtils.mv @a1_gem, @tempdir FileUtils.mv @aa1_gem, @tempdir FileUtils.mv @b1_gem, @tempdir @@ -307,8 +305,6 @@ class TestGemDependencyInstaller < Gem::TestCase @aa1, @aa1_gem = util_gem 'aa', '1' - util_reset_gems - FileUtils.mv @a1_gem, @tempdir FileUtils.mv @aa1_gem, @tempdir FileUtils.mv @b1_gem, @tempdir @@ -329,8 +325,6 @@ class TestGemDependencyInstaller < Gem::TestCase @aa1, @aa1_gem = util_gem 'aa', '1' - util_reset_gems - FileUtils.mv @a1_gem, @tempdir FileUtils.mv @aa1_gem, @tempdir FileUtils.mv @b1_gem, @tempdir @@ -946,6 +940,31 @@ class TestGemDependencyInstaller < Gem::TestCase assert_equal %w[d-2], inst.installed_gems.map {|s| s.full_name } end + def test_install_legacy_spec_with_nil_required_ruby_version + path = File.expand_path "../data/null-required-ruby-version.gemspec.rz", __FILE__ + spec = Marshal.load Gem.read_binary(path) + def spec.validate(*args); end + + util_build_gem spec + + cache_file = File.join @tempdir, 'gems', "#{spec.original_name}.gem" + FileUtils.mkdir_p File.dirname cache_file + FileUtils.mv spec.cache_file, cache_file + + util_setup_spec_fetcher spec + + data = Gem.read_binary(cache_file) + + @fetcher.data['http://gems.example.com/gems/activesupport-1.0.0.gem'] = data + + dep = Gem::Dependency.new 'activesupport' + + inst = Gem::DependencyInstaller.new + inst.install dep + + assert_equal %w[activesupport-1.0.0], Gem::Specification.map(&:full_name) + end + def test_install_legacy_spec_with_nil_required_rubygems_version path = File.expand_path "../data/null-required-rubygems-version.gemspec.rz", __FILE__ spec = Marshal.load Gem.read_binary(path) @@ -1131,16 +1150,6 @@ class TestGemDependencyInstaller < Gem::TestCase @d1, @d1_gem = util_gem 'd', '1' @d2, @d2_gem = util_gem 'd', '2' - util_reset_gems - end - - def util_reset_gems - @a1 ||= nil - @b1 ||= nil - @a1_pre ||= nil - @d1 ||= nil - @d2 ||= nil - - util_setup_spec_fetcher(*[@a1, @a1_pre, @b1, @d1, @d2].compact) + util_setup_spec_fetcher(@d1, @d2) end end diff --git a/test/rubygems/test_gem_ext_builder.rb b/test/rubygems/test_gem_ext_builder.rb index 0fe650b8a5..6bebfa7a03 100644 --- a/test/rubygems/test_gem_ext_builder.rb +++ b/test/rubygems/test_gem_ext_builder.rb @@ -14,6 +14,7 @@ class TestGemExtBuilder < Gem::TestCase FileUtils.mkdir_p @dest_path @orig_DESTDIR = ENV['DESTDIR'] + @orig_make = ENV['make'] @spec = util_spec 'a' @@ -22,6 +23,7 @@ class TestGemExtBuilder < Gem::TestCase def teardown ENV['DESTDIR'] = @orig_DESTDIR + ENV['make'] = @orig_make super end @@ -81,6 +83,28 @@ install: assert_match %r{DESTDIR\\=#{ENV['DESTDIR']} install$}, results end + def test_custom_make_with_options + ENV['make'] = 'make V=1' + results = [] + File.open File.join(@ext, 'Makefile'), 'w' do |io| + io.puts <<-MAKEFILE +all: +\t@#{Gem.ruby} -e "puts 'all: OK'" + +clean: +\t@#{Gem.ruby} -e "puts 'clean: OK'" + +install: +\t@#{Gem.ruby} -e "puts 'install: OK'" + MAKEFILE + end + Gem::Ext::Builder.make @dest_path, results, @ext + results = results.join("\n").b + assert_match %r{clean: OK}, results + assert_match %r{all: OK}, results + assert_match %r{install: OK}, results + end + def test_build_extensions @spec.extensions << 'ext/extconf.rb' diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb index 4ce7e92442..5652d86331 100644 --- a/test/rubygems/test_gem_installer.rb +++ b/test/rubygems/test_gem_installer.rb @@ -821,6 +821,8 @@ gem 'other', version assert !File.exist?(system_path), 'plugin written incorrect written to system plugins_dir' assert File.exist?(build_root_path), 'plugin not written to build_root' + + refute_includes File.read(build_root_path), build_root end def test_keeps_plugins_up_to_date diff --git a/test/rubygems/test_gem_platform.rb b/test/rubygems/test_gem_platform.rb index 83a6f24de4..ad7285c082 100644 --- a/test/rubygems/test_gem_platform.rb +++ b/test/rubygems/test_gem_platform.rb @@ -134,7 +134,9 @@ class TestGemPlatform < Gem::TestCase 'i386-solaris2.8' => ['x86', 'solaris', '2.8'], 'mswin32' => ['x86', 'mswin32', nil], 'x86_64-linux' => ['x86_64', 'linux', nil], + 'x86_64-linux-gnu' => ['x86_64', 'linux', nil], 'x86_64-linux-musl' => ['x86_64', 'linux', 'musl'], + 'x86_64-linux-uclibc' => ['x86_64', 'linux', 'uclibc'], 'x86_64-openbsd3.9' => ['x86_64', 'openbsd', '3.9'], 'x86_64-openbsd4.0' => ['x86_64', 'openbsd', '4.0'], 'x86_64-openbsd' => ['x86_64', 'openbsd', nil], @@ -143,6 +145,7 @@ class TestGemPlatform < Gem::TestCase test_cases.each do |arch, expected| platform = Gem::Platform.new arch assert_equal expected, platform.to_a, arch.inspect + assert_equal expected, Gem::Platform.new(platform.to_s).to_a, arch.inspect end end @@ -261,6 +264,32 @@ class TestGemPlatform < Gem::TestCase assert((with_x86_arch === with_nil_arch), 'x86 =~ nil') end + def test_nil_version_is_treated_as_any_version + x86_darwin_8 = Gem::Platform.new 'i686-darwin8.0' + x86_darwin_nil = Gem::Platform.new 'i686-darwin' + + assert((x86_darwin_8 === x86_darwin_nil), '8.0 =~ nil') + assert((x86_darwin_nil === x86_darwin_8), 'nil =~ 8.0') + end + + def test_nil_version_is_stricter_for_linux_os + x86_linux = Gem::Platform.new 'i686-linux' + x86_linux_gnu = Gem::Platform.new 'i686-linux-gnu' + x86_linux_musl = Gem::Platform.new 'i686-linux-musl' + x86_linux_uclibc = Gem::Platform.new 'i686-linux-uclibc' + + assert((x86_linux === x86_linux_gnu), 'linux =~ linux-gnu') + assert((x86_linux_gnu === x86_linux), 'linux-gnu =~ linux') + assert(!(x86_linux_gnu === x86_linux_musl), 'linux-gnu =~ linux-musl') + assert(!(x86_linux_musl === x86_linux_gnu), 'linux-musl =~ linux-gnu') + assert(!(x86_linux_uclibc === x86_linux_musl), 'linux-uclibc =~ linux-musl') + assert(!(x86_linux_musl === x86_linux_uclibc), 'linux-musl =~ linux-uclibc') + assert(!(x86_linux === x86_linux_musl), 'linux =~ linux-musl') + assert(!(x86_linux_musl === x86_linux), 'linux-musl =~ linux') + assert(!(x86_linux === x86_linux_uclibc), 'linux =~ linux-uclibc') + assert(!(x86_linux_uclibc === x86_linux), 'linux-uclibc =~ linux') + end + def test_equals3_cpu_arm arm = Gem::Platform.new 'arm-linux' armv5 = Gem::Platform.new 'armv5-linux' @@ -356,6 +385,14 @@ class TestGemPlatform < Gem::TestCase assert_local_match 'sparc-solaris2.8-mq5.3' end + def test_inspect + result = Gem::Platform.new("universal-java11").inspect + + assert_equal 1, result.scan(/@cpu=/).size + assert_equal 1, result.scan(/@os=/).size + assert_equal 1, result.scan(/@version=/).size + end + def assert_local_match(name) assert_match Gem::Platform.local, name end diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb index 1c88e8d3e8..32600deee2 100644 --- a/test/rubygems/test_gem_remote_fetcher.rb +++ b/test/rubygems/test_gem_remote_fetcher.rb @@ -962,6 +962,12 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== end end + def test_tcpsocketext_require + with_configured_fetcher(":ipv4_fallback_enabled: true") do |fetcher| + refute require('rubygems/core_ext/tcpsocket_init') + end + end + def with_configured_fetcher(config_str = nil, &block) if config_str temp_conf = File.join @tempdir, '.gemrc' diff --git a/test/rubygems/test_gem_requirement.rb b/test/rubygems/test_gem_requirement.rb index 670defe330..13897eaefb 100644 --- a/test/rubygems/test_gem_requirement.rb +++ b/test/rubygems/test_gem_requirement.rb @@ -83,7 +83,7 @@ class TestGemRequirement < Gem::TestCase Gem::Requirement.parse(Gem::Version.new('2')) end - if RUBY_VERSION >= '2.5' + if RUBY_VERSION >= '2.5' && !(Gem.java_platform? && ENV["JRUBY_OPTS"] =~ /--debug/) def test_parse_deduplication assert_same '~>', Gem::Requirement.parse('~> 1').first end @@ -401,6 +401,27 @@ class TestGemRequirement < Gem::TestCase assert_equal r1.hash, r2.hash end + def test_hash_returns_equal_hashes_for_equivalent_requirements + refute_requirement_hash_equal "= 1.2", "= 1.3" + refute_requirement_hash_equal "= 1.3", "= 1.2" + + refute_requirement_hash_equal "~> 1.3", "~> 1.3.0" + refute_requirement_hash_equal "~> 1.3.0", "~> 1.3" + + assert_requirement_hash_equal ["> 2", "~> 1.3", "~> 1.3.1"], ["~> 1.3.1", "~> 1.3", "> 2"] + + assert_requirement_hash_equal ["> 2", "~> 1.3"], ["> 2.0", "~> 1.3"] + assert_requirement_hash_equal ["> 2.0", "~> 1.3"], ["> 2", "~> 1.3"] + + assert_requirement_hash_equal "= 1.0", "= 1.0.0" + assert_requirement_hash_equal "= 1.1", "= 1.1.0" + assert_requirement_hash_equal "= 1", "= 1.0.0" + + assert_requirement_hash_equal "1.0", "1.0.0" + assert_requirement_hash_equal "1.1", "1.1.0" + assert_requirement_hash_equal "1", "1.0.0" + end + # Assert that two requirements are equal. Handles Gem::Requirements, # strings, arrays, numbers, and versions. @@ -415,6 +436,13 @@ class TestGemRequirement < Gem::TestCase "#{requirement} is satisfied by #{version}" end + # Assert that two requirement hashes are equal. Handles Gem::Requirements, + # strings, arrays, numbers, and versions. + + def assert_requirement_hash_equal(expected, actual) + assert_equal req(expected).hash, req(actual).hash + end + # Refute the assumption that two requirements are equal. def refute_requirement_equal(unexpected, actual) @@ -427,4 +455,10 @@ class TestGemRequirement < Gem::TestCase refute req(requirement).satisfied_by?(v(version)), "#{requirement} is not satisfied by #{version}" end + + # Refute the assumption that two requirements hashes are equal. + + def refute_requirement_hash_equal(unexpected, actual) + refute_equal req(unexpected).hash, req(actual).hash + end end diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index 374d58d38f..1389b495f2 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -1161,6 +1161,14 @@ dependencies: [] Gem::Specification.class_variable_set(:@@stubs, nil) end + def test_self_stubs_for_no_lazy_loading_after_all_specs_setup + Gem::Specification.all = [util_spec('a', '1')] + + save_gemspec('b-1', '1', File.join(Gem.dir, 'specifications')){|s| s.name = 'b' } + + assert_equal [], Gem::Specification.stubs_for('b').map {|s| s.full_name } + end + def test_self_stubs_for_mult_platforms # gems for two different platforms are installed with --user-install # the correct one should be returned in the array @@ -1200,6 +1208,16 @@ dependencies: [] Gem.platforms = orig_platform end + def test_self_stubs_returns_only_specified_named_specs + dir_standard_specs = File.join Gem.dir, 'specifications' + + save_gemspec('a-1', '1', dir_standard_specs){|s| s.name = 'a' } + save_gemspec('a-2', '2', dir_standard_specs){|s| s.name = 'a' } + save_gemspec('a-a', '3', dir_standard_specs){|s| s.name = 'a-a' } + + assert_equal ['a-1', 'a-2'], Gem::Specification.stubs_for('a').map(&:full_name).sort + end + def test_handles_private_null_type path = File.expand_path "../data/null-type.gemspec.rz", __FILE__ @@ -1612,20 +1630,6 @@ dependencies: [] refute_path_exists @a1.extension_dir end - def test_build_extensions_old - skip "extensions don't quite work on jruby" if Gem.java_platform? - ext_spec - - refute_empty @ext.extensions, 'sanity check' - - @ext.installed_by_version = v(0) - - @ext.build_extensions - - gem_make_out = File.join @ext.extension_dir, 'gem_make.out' - refute_path_exists gem_make_out - end - def test_build_extensions_preview skip "extensions don't quite work on jruby" if Gem.java_platform? ext_spec @@ -3522,19 +3526,6 @@ Did you mean 'Ruby'? specfile.delete end - ## - # KEEP p-1-x86-darwin-8 - # KEEP p-1 - # KEEP c-1.2 - # KEEP a_evil-9 - # a-1 - # a-1-x86-my_platform-1 - # KEEP a-2 - # a-2-x86-other_platform-1 - # KEEP a-2-x86-my_platform-1 - # a-3.a - # KEEP a-3-x86-other_platform-1 - def test_latest_specs spec_fetcher do |fetcher| fetcher.spec 'a', 1 do |s| @@ -3557,8 +3548,6 @@ Did you mean 'Ruby'? end expected = %W[ - a-2 - a-2-x86-my_platform-1 a-3-x86-other_platform-1 ] @@ -3734,18 +3723,6 @@ end refute spec.missing_extensions? end - def test_missing_extensions_eh_legacy - ext_spec - - @ext.installed_by_version = v '2.2.0.preview.2' - - assert @ext.missing_extensions? - - @ext.installed_by_version = v '2.2.0.preview.1' - - refute @ext.missing_extensions? - end - def test_missing_extensions_eh_none refute @a1.missing_extensions? end diff --git a/test/rubygems/test_gem_stream_ui.rb b/test/rubygems/test_gem_stream_ui.rb index e154a723c9..a62e9ea0cf 100644 --- a/test/rubygems/test_gem_stream_ui.rb +++ b/test/rubygems/test_gem_stream_ui.rb @@ -5,7 +5,7 @@ require 'timeout' class TestGemStreamUI < Gem::TestCase # increase timeout with MJIT for --jit-wait testing - mjit_enabled = defined?(RubyVM::JIT) && RubyVM::JIT.enabled? + mjit_enabled = defined?(RubyVM::JIT) ? RubyVM::JIT.enabled? : defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? SHORT_TIMEOUT = (RUBY_ENGINE == "ruby" && !mjit_enabled) ? 0.1 : 1.0 module IsTty diff --git a/test/rubygems/test_gem_util.rb b/test/rubygems/test_gem_util.rb index acf7ac8962..7197f664e2 100644 --- a/test/rubygems/test_gem_util.rb +++ b/test/rubygems/test_gem_util.rb @@ -46,8 +46,8 @@ class TestGemUtil < Gem::TestCase assert_equal File.join(@tempdir, 'd'), paths[0] assert_equal @tempdir, paths[1] - assert_equal File.realpath(Dir.tmpdir), paths[2] - assert_equal File.realpath("..", Dir.tmpdir), paths[3] + assert_equal File.realpath("..", @tempdir), paths[2] + assert_equal File.realpath("../..", @tempdir), paths[3] ensure # restore default permissions, allow the directory to be removed FileUtils.chmod(0775, 'd/e') unless win_platform? || java_platform? @@ -72,10 +72,10 @@ class TestGemUtil < Gem::TestCase ] files_with_absolute_base = Gem::Util.glob_files_in_dir('*.rb', File.join(@tempdir, 'g')) - assert_equal expected_paths.to_set, files_with_absolute_base.to_set + assert_equal expected_paths.sort, files_with_absolute_base.sort files_with_relative_base = Gem::Util.glob_files_in_dir('*.rb', 'g') - assert_equal expected_paths.to_set, files_with_relative_base.to_set + assert_equal expected_paths.sort, files_with_relative_base.sort end def test_correct_for_windows_path -- cgit v1.2.3