On Fri, Jul 11, 2008 at 10:54 AM, Sean Chittenden <[EMAIL PROTECTED]> wrote:
>>> Wild.  Alright.  It works for me out of the box.  Is this trunk or before
>>> the libxml.rb patch?  -sc
>>
>> setup.rb has never successfully run the tests for me, even before the
>> libxml.rb patch.  I'm on OS X.
>
>
> Strange.  I'm OS-X and here's my output with trunk.  -sc
>
>
> % rake test
> (in /Users/sean/src/ruby-libxml/trunk)
> Loaded suite
> /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader
> Started
> .................................................................................................................
> EXPECTING: TWO ERRORS:
> F................
> Finished in 0.873033 seconds.
>
>  1) Failure:
> test_error_handler(TextParser) [./test/tc_xml_parser.rb:198]:
> <nil> expected but was
> <#<Proc:[EMAIL PROTECTED]/test/tc_xml_dtd.rb:59>>.
>
> 130 tests, 716 assertions, 1 failures, 0 errors
> rake aborted!
> Command failed with status (1): [/opt/local/bin/ruby -Ilib:test:ext
> "/opt/l...]
>
> (See full trace by running task with --trace)
> Exit 1

Yes, I think that is because of the implementation of
register_error_handler.  I had fixed this in one of my previous
patches....  Anyway, this seems to do the trick:

[EMAIL PROTECTED] libxml]$ svn diff
Index: test/tc_xml_dtd.rb
===================================================================
--- test/tc_xml_dtd.rb  (revision 384)
+++ test/tc_xml_dtd.rb  (working copy)
@@ -3,6 +3,7 @@

 class TestDtd < Test::Unit::TestCase
   def setup
+    XML::Parser.register_error_handler(nil)
     xp = XML::Parser.string(<<-EOS)
       <root>
         <head a="ee" id="1">Colorado</head>
[EMAIL PROTECTED] libxml]$

register_error_handler holds a reference to the lambda *on the class*
(well, actually as a static VALUE).  So if the error_handler was set
somewhere else, it won't necessarily be nil (which is what that
failing test asserts).

-- 
Aaron Patterson
http://tenderlovemaking.com/
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to