Test::Unit with RubyUnit compatibility layer bug? 
Author Message
 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



Fri, 07 Jan 2005 15:39:04 GMT  
 Test::Unit with RubyUnit compatibility layer bug?
Here's a 3 character fix for it

--- testcase.rb~        Sat Jun 29 02:39:01 2002

                        def add_failure(message, all_locations=caller()) # :nodoc:

-                               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?)

Quote:
> -----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



Fri, 07 Jan 2005 22:40:20 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Test::Unit = Lapidary + RubyUnit

2. RubyUnit - running all unit tests

3. Test::Unit::Mock: Mock objects for testing with Test::Unit

4. using test::unit for C++ unit tests

5. Test::Unit bug (maybe?)

6. RubyUnit: Avoid running setup for every test?

7. RubyUnit: A bit more general test runner

8. Test order in Test::Unit

9. Test order in Test::Unit

10. Automating UI tests (was Re: Art of Unit Testing)

11. Unit testing data; What to test

12. Test Tool for Unit Tests?

 

 
Powered by phpBB® Forum Software