diff options
Diffstat (limited to 'test/rubygems/test_gem_platform.rb')
-rw-r--r-- | test/rubygems/test_gem_platform.rb | 84 |
1 files changed, 45 insertions, 39 deletions
diff --git a/test/rubygems/test_gem_platform.rb b/test/rubygems/test_gem_platform.rb index 2fbf5c8177..7c21c734ff 100644 --- a/test/rubygems/test_gem_platform.rb +++ b/test/rubygems/test_gem_platform.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require_relative "helper" require "rubygems/platform" require "rbconfig" @@ -27,7 +28,7 @@ class TestGemPlatform < Gem::TestCase end def test_self_match_spec? - make_spec = -> platform do + make_spec = ->(platform) do util_spec "mygem-for-platform-match_spec", "1" do |s| s.platform = platform end @@ -40,7 +41,7 @@ class TestGemPlatform < Gem::TestCase end def test_self_match_spec_with_match_gem_override - make_spec = -> name, platform do + make_spec = ->(name, platform) do util_spec name, "1" do |s| s.platform = platform end @@ -70,7 +71,7 @@ class TestGemPlatform < Gem::TestCase Gem.platforms = platforms class << Gem::Platform remove_method :match_gem? - alias_method :match_gem?, :original_match_gem? # rubocop:disable Lint/DuplicateMethods + alias_method :match_gem?, :original_match_gem? remove_method :original_match_gem? end end @@ -89,46 +90,46 @@ class TestGemPlatform < Gem::TestCase "java" => [nil, "java", nil], "jruby" => [nil, "java", nil], "universal-dotnet" => ["universal", "dotnet", nil], - "universal-dotnet2.0" => ["universal", "dotnet", "2.0"], - "universal-dotnet4.0" => ["universal", "dotnet", "4.0"], + "universal-dotnet2.0" => ["universal", "dotnet", "2.0"], + "universal-dotnet4.0" => ["universal", "dotnet", "4.0"], "powerpc-aix5.3.0.0" => ["powerpc", "aix", "5"], - "powerpc-darwin7" => ["powerpc", "darwin", "7"], - "powerpc-darwin8" => ["powerpc", "darwin", "8"], + "powerpc-darwin7" => ["powerpc", "darwin", "7"], + "powerpc-darwin8" => ["powerpc", "darwin", "8"], "powerpc-linux" => ["powerpc", "linux", nil], "powerpc64-linux" => ["powerpc64", "linux", nil], "sparc-solaris2.10" => ["sparc", "solaris", "2.10"], - "sparc-solaris2.8" => ["sparc", "solaris", "2.8"], - "sparc-solaris2.9" => ["sparc", "solaris", "2.9"], - "universal-darwin8" => ["universal", "darwin", "8"], - "universal-darwin9" => ["universal", "darwin", "9"], - "universal-macruby" => ["universal", "macruby", nil], - "i386-cygwin" => ["x86", "cygwin", nil], - "i686-darwin" => ["x86", "darwin", nil], - "i686-darwin8.4.1" => ["x86", "darwin", "8"], - "i386-freebsd4.11" => ["x86", "freebsd", "4"], - "i386-freebsd5" => ["x86", "freebsd", "5"], - "i386-freebsd6" => ["x86", "freebsd", "6"], - "i386-freebsd7" => ["x86", "freebsd", "7"], + "sparc-solaris2.8" => ["sparc", "solaris", "2.8"], + "sparc-solaris2.9" => ["sparc", "solaris", "2.9"], + "universal-darwin8" => ["universal", "darwin", "8"], + "universal-darwin9" => ["universal", "darwin", "9"], + "universal-macruby" => ["universal", "macruby", nil], + "i386-cygwin" => ["x86", "cygwin", nil], + "i686-darwin" => ["x86", "darwin", nil], + "i686-darwin8.4.1" => ["x86", "darwin", "8"], + "i386-freebsd4.11" => ["x86", "freebsd", "4"], + "i386-freebsd5" => ["x86", "freebsd", "5"], + "i386-freebsd6" => ["x86", "freebsd", "6"], + "i386-freebsd7" => ["x86", "freebsd", "7"], "i386-freebsd" => ["x86", "freebsd", nil], "universal-freebsd" => ["universal", "freebsd", nil], "i386-java1.5" => ["x86", "java", "1.5"], "x86-java1.6" => ["x86", "java", "1.6"], "i386-java1.6" => ["x86", "java", "1.6"], - "i686-linux" => ["x86", "linux", nil], - "i586-linux" => ["x86", "linux", nil], - "i486-linux" => ["x86", "linux", nil], - "i386-linux" => ["x86", "linux", nil], - "i586-linux-gnu" => ["x86", "linux", "gnu"], - "i386-linux-gnu" => ["x86", "linux", "gnu"], + "i686-linux" => ["x86", "linux", nil], + "i586-linux" => ["x86", "linux", nil], + "i486-linux" => ["x86", "linux", nil], + "i386-linux" => ["x86", "linux", nil], + "i586-linux-gnu" => ["x86", "linux", "gnu"], + "i386-linux-gnu" => ["x86", "linux", "gnu"], "i386-mingw32" => ["x86", "mingw32", nil], "x64-mingw-ucrt" => ["x64", "mingw", "ucrt"], "i386-mswin32" => ["x86", "mswin32", nil], - "i386-mswin32_80" => ["x86", "mswin32", "80"], - "i386-mswin32-80" => ["x86", "mswin32", "80"], + "i386-mswin32_80" => ["x86", "mswin32", "80"], + "i386-mswin32-80" => ["x86", "mswin32", "80"], "x86-mswin32" => ["x86", "mswin32", nil], - "x86-mswin32_60" => ["x86", "mswin32", "60"], - "x86-mswin32-60" => ["x86", "mswin32", "60"], - "i386-netbsdelf" => ["x86", "netbsdelf", nil], + "x86-mswin32_60" => ["x86", "mswin32", "60"], + "x86-mswin32-60" => ["x86", "mswin32", "60"], + "i386-netbsdelf" => ["x86", "netbsdelf", nil], "i386-openbsd4.0" => ["x86", "openbsd", "4.0"], "i386-solaris2.10" => ["x86", "solaris", "2.10"], "i386-solaris2.8" => ["x86", "solaris", "2.8"], @@ -141,9 +142,12 @@ class TestGemPlatform < Gem::TestCase "arm-linux-gnueabi" => ["arm", "linux", "gnueabi"], "arm-linux-musleabi" => ["arm", "linux", "musleabi"], "arm-linux-uclibceabi" => ["arm", "linux", "uclibceabi"], - "x86_64-openbsd3.9" => ["x86_64", "openbsd", "3.9"], - "x86_64-openbsd4.0" => ["x86_64", "openbsd", "4.0"], + "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], + "wasm32-wasi" => ["wasm32", "wasi", nil], + "wasm32-wasip1" => ["wasm32", "wasi", nil], + "wasm32-wasip2" => ["wasm32", "wasi", nil], } test_cases.each do |arch, expected| @@ -174,7 +178,7 @@ class TestGemPlatform < Gem::TestCase end def test_initialize_mswin32_vc6 - orig_RUBY_SO_NAME = RbConfig::CONFIG["RUBY_SO_NAME"] + orig_ruby_so_name = RbConfig::CONFIG["RUBY_SO_NAME"] RbConfig::CONFIG["RUBY_SO_NAME"] = "msvcrt-ruby18" expected = ["x86", "mswin32", nil] @@ -183,8 +187,8 @@ class TestGemPlatform < Gem::TestCase assert_equal expected, platform.to_a, "i386-mswin32 VC6" ensure - if orig_RUBY_SO_NAME - RbConfig::CONFIG["RUBY_SO_NAME"] = orig_RUBY_SO_NAME + if orig_ruby_so_name + RbConfig::CONFIG["RUBY_SO_NAME"] = orig_ruby_so_name else RbConfig::CONFIG.delete "RUBY_SO_NAME" end @@ -211,7 +215,7 @@ class TestGemPlatform < Gem::TestCase end def test_to_s - if win_platform? + if Gem.win_platform? assert_equal "x86-mswin32-60", Gem::Platform.local.to_s else assert_equal "x86-darwin-8", Gem::Platform.local.to_s @@ -231,7 +235,7 @@ class TestGemPlatform < Gem::TestCase my = Gem::Platform.new %w[cpu my_platform 1] other = Gem::Platform.new %w[cpu other_platform 1] - assert(my === my) + assert(my === my) # rubocop:disable Lint/BinaryOperatorWithIdenticalOperands refute(other === my) refute(my === other) end @@ -482,8 +486,10 @@ class TestGemPlatform < Gem::TestCase def test_gem_platform_match_with_string_argument util_set_arch "x86_64-linux-musl" - assert(Gem::Platform.match(Gem::Platform.new("x86_64-linux")), "should match Gem::Platform") - assert(Gem::Platform.match("x86_64-linux"), "should match String platform") + Gem::Deprecate.skip_during do + assert(Gem::Platform.match(Gem::Platform.new("x86_64-linux")), "should match Gem::Platform") + assert(Gem::Platform.match("x86_64-linux"), "should match String platform") + end end def assert_local_match(name) |