Sha256: 343ba5c763081ee6f4a4f60ff9abffbb8ad4e4998d859d7f0e4204a38e087356
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
require "libxml" require 'test/unit' class TC_XML_Document < Test::Unit::TestCase def setup() xp = XML::Parser.new() assert_instance_of(XML::Parser, xp) str = '<ruby_array uga="booga" foo="bar"><fixnum>one</fixnum><fixnum>two</fixnum></ruby_array>' assert_equal(str, xp.string = str) @doc = xp.parse assert_instance_of(XML::Document, @doc) end def teardown() @doc = nil end def test_libxml_document_find() set = @doc.find('/ruby_array/fixnum') assert_instance_of(XML::XPath::Object, set) assert_raise(NoMethodError) { xpt = set.xpath } end def test_ruby_xml_document_compression() if XML::Parser::enabled_zlib? 0.upto(9) do |i| assert_equal(i, @doc.compression = i) assert_equal(i, @doc.compression) end 9.downto(0) do |i| assert_equal(i, @doc.compression = i) assert_equal(i, @doc.compression) end 10.upto(20) do |i| # assert_equal(9, @doc.compression = i) assert_equal(i, @doc.compression = i) # This works around a bug in Ruby 1.8 assert_equal(9, @doc.compression) end -1.downto(-10) do |i| # assert_equal(0, @doc.compression = i) assert_equal(i, @doc.compression = i) # FIXME This bug should get fixed ASAP assert_equal(0, @doc.compression) end end # if ...enabled_zlib? end # test_ruby_xml_document_compression() end # TC_XML_Document
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
libxml-ruby-0.5.3 | test/tc_xml_document.rb |
libxml-ruby-0.5.4 | test/tc_xml_document.rb |