Problems with Tests that fail and prettyprint


#1

It may be an artifact of my installation (Ruby 1.8.2 on Windows) but
when my
tests fail, Ruby throws an excpetion in prettyprint. It doesn’t seem to
what
what the types of the values are when the assertion fails (strings,
integer,
or my own types), I always get the same exception and then prettyprinter
is
broken to the end of the entire testsuite.

Any suggestions?

Here’s the test results:

Loaded suite db2-test
Started
date result was 2005-1-2
E…
Finished in 1.187 seconds.

  1. Error:
    test_DB2_date(TestDB2):
    TypeError: wrong argument type #Class:0x2b2fc38 (expected Data)
    C:/ruby/lib/ruby/1.8/prettyprint.rb:308
    C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
    require__' C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire’
    C:/ruby/lib/ruby/1.8/pp.rb:149
    C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
    require__' C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire’
    db2-test.rb:72:in `test_DB2_date’

6 tests, 24 assertions, 0 failures, 1 errors

and the test code:

require ‘dbi’
require ‘test/unit’
require ‘DB2V8_Helper’

class TestDB2 <Test::Unit::TestCase
def test_DB2_date
dbh = nil
dbh = DBI.connect(‘dbi:DB2V8:sample’, ‘’, ‘’)
stmt = dbh.prepare( “select date(‘2005-1-2’) from
sysibm.sysdummy1”)
stmt.execute
row = stmt.fetch
puts “date result was #{row[0]}”
assert_equal(row[0], ‘2005-1-2’, “wrong numeric value”)
end

end