I found this relatively obscure bug when using equivalent-xml with jruby, which I think is a bug in nokogiri:
when comparing to xml documents where one of them starts with a string before the xml preamble, nokogiri ignores the following elements in the document.
Although I assume that this is a bug in nokogiri, I published two test cases, to my fork of the repository, showing off the odd behaviour because I think this should be a know issue.
# this passes on jruby
it "should ignore leading whitespace #1" do
doc1 = Nokogiri::XML("<bar><foo /></bar>")
doc2 = Nokogiri::XML(" <bar><foo /></bar>")
doc1.should be_equivalent_to(doc2)
end
# this fails on jruby
it "should ignore leading whitespace #2" do
doc1 = Nokogiri::XML("<?xml version='1.0' encoding='utf-8' ?><foo />")
doc2 = Nokogiri::XML(" <?xml version='1.0' encoding='utf-8' ?><foo />")
doc1.should be_equivalent_to(doc2)
end
I found this relatively obscure bug when using
equivalent-xml
withjruby
, which I think is a bug innokogiri
:when comparing to xml documents where one of them starts with a string before the xml preamble, nokogiri ignores the following elements in the document.
this works perfectly fine in ruby 1.8, 1.9, rbx1.8 and rbx1.9:
weird however is, that this works as originally expected with all ruby implementations when the first element is not the xml preamble:
Although I assume that this is a bug in
nokogiri
, I published two test cases, to my fork of the repository, showing off the odd behaviour because I think this should be a know issue.the complete output is visible on travis ci