diff --git a/scripts/test-gem-installation b/scripts/test-gem-installation index b89ff9bd3a..4270ded24d 100755 --- a/scripts/test-gem-installation +++ b/scripts/test-gem-installation @@ -115,7 +115,7 @@ describe gemspec.full_name do it "has ldflags pointing to the shared object file" do ldflags = Nokogiri::VERSION_INFO["nokogiri"]["ldflags"] if ::RUBY_PLATFORM.match?(/mingw|mswin/) - if gemspec.platform.cpu + if gemspec.platform.is_a?(Gem::Platform) && gemspec.platform.cpu assert_includes(ldflags, "-L#{File.join(nokogiri_lib_dir, ruby_maj_min)}") else assert_includes(ldflags, "-L#{nokogiri_lib_dir}") diff --git a/scripts/test-nokogumbo-compatibility b/scripts/test-nokogumbo-compatibility index f8dddf55ee..338a0e6e09 100755 --- a/scripts/test-nokogumbo-compatibility +++ b/scripts/test-nokogumbo-compatibility @@ -10,7 +10,7 @@ # installed gem (and not against the source code or behavior of the gem itself). # -if RUBY_PLATFORM.include?("java") +if Gem.java_platform? puts "Skip: Nokogumbo does not support JRuby" exit 0 end @@ -20,6 +20,16 @@ if Gem::Requirement.new(">= 3.2.0").satisfied_by?(Gem::Version.new(RUBY_VERSION) exit 0 end +nokogumbo_version = if /\d+\.\d+\.\d+/.match?(ARGV[0]) + ARGV[0] +end + +NOKOGUMBO_WINDOWS_CONSTRAINT = ">= 2.0.5" +if Gem.win_platform? && !Gem::Requirement.new(NOKOGUMBO_WINDOWS_CONSTRAINT).satisfied_by?(Gem::Version.new(nokogumbo_version)) + puts "Skip: Nokogumbo must be #{NOKOGUMBO_WINDOWS_CONSTRAINT} on Windows" + exit 0 +end + # this line needs to come before the bundler bit, to assert that we're running against an # already-installed version (and not some other version that bundler/inline might install if it came # first) @@ -28,10 +38,6 @@ raise "could not find installed gem" unless gemspec require "bundler/inline" -nokogumbo_version = if /\d+\.\d+\.\d+/.match?(ARGV[0]) - ARGV[0] -end - gemfile(true) do source "https://rubygems.org" gem "minitest"