diff --git a/test/helper.rb b/test/helper.rb index 4be9f82ac9..a8595b1d8c 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -138,6 +138,21 @@ def stress_memory_while(&block) end end + def skip_unless_libxml2(msg="this test should only run with libxml2") + skip(msg) unless Nokogiri.uses_libxml? + end + + def skip_unless_jruby(msg="this test should only run with jruby") + skip(msg) unless Nokogiri.jruby? + end + + def refute_valgrind_errors + skip_unless_libxml2("valgrind tests should only run with libxml2") + yield.tap do + GC.start(full_mark: true) if GC_LEVEL == "minor" + end + end + def assert_indent(amount, doc, message = nil) nodes = [] doc.traverse do |node|