Sha256: 40e7e6ee1e410efa363f9d1cd6640bd787b9f1257a28c4848e39a4970e459292
Contents?: true
Size: 970 Bytes
Versions: 3
Compression:
Stored size: 970 Bytes
Contents
# $Id: tc_xml_parser8.rb,v 1.3 2006/04/17 13:30:22 roscopeco Exp $ 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
libxml-ruby-0.3.8 | tests/tc_xml_parser8.rb |
libxml-ruby-0.3.8.2 | tests/tc_xml_parser8.rb |
libxml-ruby-0.3.8.4 | tests/tc_xml_parser8.rb |