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

Version Path
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/aws-s3-0.6.3/support/faster-xml-simple/test/regression_test.rb
croaker-aws-s3-0.5.2.20090127001 support/faster-xml-simple/test/regression_test.rb
croaker-aws-s3-0.5.2.20090127002 support/faster-xml-simple/test/regression_test.rb
patientslikeme-campaign_monitor-1.1 support/faster-xml-simple/test/regression_test.rb
patientslikeme-campaign_monitor-1.2.1 support/faster-xml-simple/test/regression_test.rb
patientslikeme-campaign_monitor-1.2.2 support/faster-xml-simple/test/regression_test.rb
patientslikeme-campaign_monitor-1.2 support/faster-xml-simple/test/regression_test.rb
patientslikeme-campaign_monitor-1.3.0 support/faster-xml-simple/test/regression_test.rb
sml-aws-s3-0.5.1.1226533772 support/faster-xml-simple/test/regression_test.rb
turingstudio-campaign_monitor-1.3.1 support/faster-xml-simple/test/regression_test.rb
aws-s3-instructure-0.6.2.1352914936 support/faster-xml-simple/test/regression_test.rb
aws-s3-0.6.3 support/faster-xml-simple/test/regression_test.rb
mb-aws-s3-0.6.2 support/faster-xml-simple/test/regression_test.rb
codders-aws-s3-0.6.2.1331721623 support/faster-xml-simple/test/regression_test.rb
surat-aws-s3-0.0.1 support/faster-xml-simple/test/regression_test.rb
aws-s3-instructure-0.6.2.1319643167 support/faster-xml-simple/test/regression_test.rb
aws-s3-instructure-0.6.2.1319222580 support/faster-xml-simple/test/regression_test.rb
codders-aws-s3-0.6.2 support/faster-xml-simple/test/regression_test.rb
le88-aws-s3-0.6.4.1310482383 support/faster-xml-simple/test/regression_test.rb
le88-aws-s3-0.6.3.1310482014 support/faster-xml-simple/test/regression_test.rb