Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add failing test case for Nokogiri::XML::Node#content inconsistency between Java and C #794

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions test/xml/test_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,10 @@ def test_content_equals
node.content = "1234 <-> 1234"
assert_equal "1234 <-> 1234", node.content
assert_equal "<form>1234 &lt;-&gt; 1234</form>", node.to_xml

node.content = '1234'
node.add_child '<foo>5678</foo>'
assert_equal '12345678', node.content
end

def test_set_content_should_unlink_existing_content
Expand All @@ -807,6 +811,12 @@ def test_set_content_should_unlink_existing_content
children.each { |child| assert_nil child.parent }
end

def test_append_content_escaping
node = Nokogiri::XML::Node.new('form', @xml)
node << "I <3 nachos"
assert_equal "I <3 nachos", node.content
end

def test_whitespace_nodes
doc = Nokogiri::XML.parse("<root><b>Foo</b>\n<i>Bar</i> <p>Bazz</p></root>")
children = doc.at('//root').children.collect{|j| j.to_s}
Expand Down