Sha256: 06886e92f0d92f74c994eb2c94f9ca26774038f3df57f59618f7438aad9ca20f
Contents?: true
Size: 914 Bytes
Versions: 2
Compression:
Stored size: 914 Bytes
Contents
# $Id: tc_xml_parser8.rb 260 2008-02-01 20:56:58Z transami $ require "libxml" require 'test/unit' class TC_XML_Parser8 < Test::Unit::TestCase def test_ruby_xml_parser_error_handler $stderr.puts "\nEXPECTING: TWO ERRORS:" # this will send message to stderr assert_raise(XML::Parser::ParseError) { d = XML::Parser.string('<foo><bar/></foz>').parse } ary = [] assert_nil XML::Parser.register_error_handler(lambda { |msg| ary << msg }) # this will use our error handler assert_raise(XML::Parser::ParseError) { d = XML::Parser.string('<foo><bar/></foz>').parse } assert (first_len = ary.length) > 0 assert_instance_of Proc, XML::Parser.register_error_handler(nil) # this will go to stderr again assert_raise(XML::Parser::ParseError) { d = XML::Parser.string('<foo><bar/></foz>').parse } assert_equal first_len, ary.length end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
libxml-ruby-0.5.3 | test/tc_xml_parser8.rb |
libxml-ruby-0.5.4 | test/tc_xml_parser8.rb |