Sha256: 0e47a1f14660c8260fc5fe3a250e0800c64a85c899ef7343f172ba0030a3d7a7
Contents?: true
Size: 1.63 KB
Versions: 33
Compression:
Stored size: 1.63 KB
Contents
require File.dirname(__FILE__) + '/test_helper' class RegressionTest < FasterXSTest def test_content_nil_regressions expected = {"asdf"=>{"jklsemicolon"=>{}}} assert_equal expected, FasterXmlSimple.xml_in("<asdf><jklsemicolon /></asdf>") assert_equal expected, FasterXmlSimple.xml_in("<asdf><jklsemicolon /></asdf>", 'forcearray'=>['asdf']) end def test_s3_regression str = File.read("test/fixtures/test-7.xml") assert_nil FasterXmlSimple.xml_in(str)["AccessControlPolicy"]["AccessControlList"]["__content__"] end def test_xml_simple_transparency assert_equal XmlSimple.xml_in("<asdf />"), FasterXmlSimple.xml_in("<asdf />") end def test_suppress_empty_variations str = "<asdf><fdsa /></asdf>" assert_equal Hash.new, FasterXmlSimple.xml_in(str)["asdf"]["fdsa"] assert_nil FasterXmlSimple.xml_in(str, 'suppressempty'=>nil)["asdf"]["fdsa"] assert_equal '', FasterXmlSimple.xml_in(str, 'suppressempty'=>'')["asdf"]["fdsa"] assert !FasterXmlSimple.xml_in(str, 'suppressempty'=>true)["asdf"].has_key?("fdsa") end def test_empty_string_doesnt_crash assert_raise(XML::Parser::ParseError) do silence_stderr do FasterXmlSimple.xml_in('') end end end def test_keeproot_false str = "<asdf><fdsa>1</fdsa></asdf>" expected = {"fdsa"=>"1"} assert_equal expected, FasterXmlSimple.xml_in(str, 'keeproot'=>false) end def test_keeproot_false_with_force_content str = "<asdf><fdsa>1</fdsa></asdf>" expected = {"fdsa"=>{"__content__"=>"1"}} assert_equal expected, FasterXmlSimple.xml_in(str, 'keeproot'=>false, 'forcecontent'=>true) end end
Version data entries
33 entries across 33 versions & 18 rubygems