File 001-test-equality.patch of Package rubygem-nokogiri.26618
From b3423b03f59ba8ef02888598d0a9f90dedcc6ef9 Mon Sep 17 00:00:00 2001
From: Mike Dalessio <mike.dalessio@gmail.com>
Date: Mon, 23 Nov 2020 00:02:08 -0500
Subject: [PATCH] feat: ParseOptions#== implemented correctly
so that we can write some tests around it
---
lib/nokogiri/xml/parse_options.rb | 4 ++++
test/xml/test_parse_options.rb | 6 ++++++
2 files changed, 10 insertions(+)
diff --git a/lib/nokogiri/xml/parse_options.rb b/lib/nokogiri/xml/parse_options.rb
index 362940d4b..039afa2dc 100644
--- a/lib/nokogiri/xml/parse_options.rb
+++ b/lib/nokogiri/xml/parse_options.rb
@@ -107,6 +107,10 @@ def strict?
@options & RECOVER == STRICT
end
+ def ==(other)
+ other.to_i == to_i
+ end
+
alias :to_i :options
def inspect
diff --git a/test/xml/test_parse_options.rb b/test/xml/test_parse_options.rb
index 729949cea..988e89529 100644
--- a/test/xml/test_parse_options.rb
+++ b/test/xml/test_parse_options.rb
@@ -59,6 +59,12 @@ def test_inspect
assert_match(/recover/, ins)
assert_match(/noent/, ins)
end
+
+ def test_equality
+ options = Nokogiri::XML::ParseOptions.new.recover.noent
+ other = Nokogiri::XML::ParseOptions.new.recover.noent
+ assert(options == other)
+ end
end
end
end