From 049ad807b3e3d9323adb41acc156c17fd390fc49 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 16 Dec 2021 17:55:07 -0500 Subject: [PATCH] test: mark the jruby tests from #2379 as pending See context in #2380. The fix on JRuby is expensive and is probably not worth the investment of developer time right now. But let's preserve those failures as a known issue by introducing the `pending` and `pending_if` test helpers. --- test/helper.rb | 14 ++++++++++++++ test/xml/test_node.rb | 8 ++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/test/helper.rb b/test/helper.rb index 224525200b..0ec60b86c4 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -196,6 +196,20 @@ def assert_not_send(send_ary, m = nil) refute(recv.__send__(msg, *args), m) end unless method_defined?(:assert_not_send) + def pending(msg) + begin + yield + rescue MiniTest::Assertion + skip("pending #{msg}") + end + flunk("pending test unexpectedly passed: #{msg}") + end + + def pending_if(msg, pend_eh, &block) + return yield unless pend_eh + pending(msg, &block) + end + def i_am_ruby_matching(gem_version_requirement_string) Gem::Requirement.new(gem_version_requirement_string).satisfied_by?(Gem::Version.new(RUBY_VERSION)) end diff --git a/test/xml/test_node.rb b/test/xml/test_node.rb index 41e167eea2..7f89873f48 100644 --- a/test/xml/test_node.rb +++ b/test/xml/test_node.rb @@ -1253,7 +1253,9 @@ def test_wrap eoxml set = xml.search("//b") - assert_equal(3, set[0].line) + pending_if("https://github.com/sparklemotion/nokogiri/issues/2380", Nokogiri.jruby?) do + assert_equal(3, set[0].line) + end end it "properly numbers lines with documents containing XML comments" do @@ -1287,7 +1289,9 @@ def test_wrap eoxml set = xml.search("//c") - assert_equal(6, set[0].line) + pending_if("https://github.com/sparklemotion/nokogiri/issues/2380", Nokogiri.jruby?) do + assert_equal(6, set[0].line) + end end it "returns a sensible line number for each node" do