diff options
author | Willem van Bergen <willem@vanbergen.org> | 2010-01-01 10:12:30 +0100 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-01-01 13:16:40 -0800 |
commit | 34b03cebf9c9f2ce2a53511a4b2160485e270f12 (patch) | |
tree | 8fc05f2377674fec150f1dca60925cd0edaf3552 /activesupport/test/xml_mini | |
parent | 4f590b67b7a184978dfaf3b1bd0a472f43c32cad (diff) | |
download | rails-34b03cebf9c9f2ce2a53511a4b2160485e270f12.tar.gz rails-34b03cebf9c9f2ce2a53511a4b2160485e270f12.tar.bz2 rails-34b03cebf9c9f2ce2a53511a4b2160485e270f12.zip |
Code cleanup, bugfixes and speed improvements for the Nokogiri and LibXML XmlMini backends
[#3641 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activesupport/test/xml_mini')
-rw-r--r-- | activesupport/test/xml_mini/libxml_engine_test.rb | 9 | ||||
-rw-r--r-- | activesupport/test/xml_mini/nokogiri_engine_test.rb | 40 |
2 files changed, 47 insertions, 2 deletions
diff --git a/activesupport/test/xml_mini/libxml_engine_test.rb b/activesupport/test/xml_mini/libxml_engine_test.rb index 900c8052d6..83d03bccc6 100644 --- a/activesupport/test/xml_mini/libxml_engine_test.rb +++ b/activesupport/test/xml_mini/libxml_engine_test.rb @@ -184,6 +184,15 @@ class LibxmlEngineTest < Test::Unit::TestCase eoxml end + def test_children_with_blank_text_and_attribute + assert_equal_rexml(<<-eoxml) + <root> + <products type="file"> </products> + </root> + eoxml + end + + private def assert_equal_rexml(xml) hash = XmlMini.with_backend('REXML') { XmlMini.parse(xml) } diff --git a/activesupport/test/xml_mini/nokogiri_engine_test.rb b/activesupport/test/xml_mini/nokogiri_engine_test.rb index e16f36acee..db0d7c5b02 100644 --- a/activesupport/test/xml_mini/nokogiri_engine_test.rb +++ b/activesupport/test/xml_mini/nokogiri_engine_test.rb @@ -159,17 +159,53 @@ class NokogiriEngineTest < Test::Unit::TestCase XmlMini.parse(io) end - def test_children_with_cdata + def test_children_with_simple_cdata assert_equal_rexml(<<-eoxml) <root> <products> - hello <![CDATA[everyone]]> + <![CDATA[cdatablock]]> + </products> + </root> + eoxml + end + + def test_children_with_multiple_cdata + assert_equal_rexml(<<-eoxml) + <root> + <products> + <![CDATA[cdatablock1]]><![CDATA[cdatablock2]]> + </products> + </root> + eoxml + end + + def test_children_with_text_and_cdata + assert_equal_rexml(<<-eoxml) + <root> + <products> + hello <![CDATA[cdatablock]]> morning </products> </root> eoxml end + def test_children_with_blank_text + assert_equal_rexml(<<-eoxml) + <root> + <products> </products> + </root> + eoxml + end + + def test_children_with_blank_text_and_attribute + assert_equal_rexml(<<-eoxml) + <root> + <products type="file"> </products> + </root> + eoxml + end + private def assert_equal_rexml(xml) hash = XmlMini.with_backend('REXML') { XmlMini.parse(xml) } |