Test::Unit with RubyUnit compatibility layer bug?

Here’s a 3 character fix for it

— testcase.rb~ Sat Jun 29 02:39:01 2002
+++ testcase.rb Mon Jul 22 16:28:06 2002
@@ -102,7 +102,7 @@

		def add_failure(message, all_locations=caller()) # :nodoc:
			@test_passed = false
  •   		assertions_pattern = /[^A-Za-z_]assertions\.rb:/
    
  •   		assertions_pattern = /[^A-Za-z_]assert(ions)?\.rb:/
      		if (all_locations.detect { |entry| entry =~ assertions_pattern })
      			all_locations.shift
      			until (all_locations[0] =~ assertions_pattern || all_locations.empty?)
    
···

-----Original Message-----
From: Thomas Søndergaard
Sent: Monday, July 22, 2002 9:38 AM
To: ruby-talk ML
Subject: Test::Unit with RubyUnit compatibility layer bug?

Hello,

Is it well-known that Test::Unit asserts display the wrong
file and linenumber if you use the RubyUnit compatibility
layer? Here’s how a failure looks with Andy’s latest windows
installer with Test::Unit 0.1.4.

e.g.:

#!/usr/bin/env ruby

require ‘rubyunit’

class MyTestCase < RUNIT::TestCase
def test_assert
assert(false)
end
end

produces:

Failure occurred in TestCase#test_assert
[c:/ruby167/lib/ruby/site_ruby/1.6/runit/assert.r
b:17]:

while

#!/usr/bin/env ruby

require ‘test/unit’

class MyTestCase < Test::Unit::TestCase
def test_assert
assert(false)
end
end

produces

Failure occurred in test_assert(MyTestCase) [./play.rb:7]:

Thomas
Speakanet A/S | Hornemansgade 36A | DK - 2100 København Ø |
Direkte: +45 7023 0880 / 922 | Fax: +45 7023 0888 | www.speakanet.com