Skip to content

Commit

Permalink
test: introduce helpers for skips and for a valgrind block
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Apr 6, 2021
1 parent cb36a56 commit 2dc7dd7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/helper.rb
Expand Up @@ -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|
Expand Down

0 comments on commit 2dc7dd7

Please sign in to comment.