Sha256: 7381778c7858b5ed6d449efe62d19b1e60ff7ea7ed307d0203fd985cce456779
Contents?: true
Size: 964 Bytes
Versions: 4
Compression:
Stored size: 964 Bytes
Contents
# $Id: tc_xml_parser8.rb 67 2006-04-17 13:30:22Z roscopeco $ require "libxml_test" 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
libxml-ruby-0.5.0 | tests/tc_xml_parser8.rb |
libxml-ruby-0.5.0.1 | tests/tc_xml_parser8.rb |
libxml-ruby-0.5.1.0 | tests/tc_xml_parser8.rb |
libxml-ruby-0.5.2.0 | tests/tc_xml_parser8.rb |