Project

General

Profile

Actions

Feature #2643

closed

test/unit redefinition check of test_* method

Added by mame (Yusuke Endoh) almost 15 years ago. Updated over 12 years ago.

Status:
Closed
Target version:
[ruby-core:27790]

Description

=begin
Hi, Ryan Davis --

When writing test cases with test/unit, we often by mistake define a
test function whose name is already used:

class TestFoo < Test::Unit::TestCase
def test_some_test # not executed
...
end

 ...

 def test_some_test  # redefined
   ...
 end

end

This leads to a loss of a valuable chance of test. It is good for
test/unit to detect and warn such a redefinition.

A patch is attached. Could you merge the patch into test/unit?
I'm less than picky about the implementation detail and error
message.

By the attached patch, I actually found eight redefinitions in
tests of ruby core :-)

  • TestUTF16#test_casecmp

    • defined by akr, redefined by akr
  • TestHash#test_key?

    • defined by ko1, redefined by ko1
  • TestHash#test_value?

    • defined by ko1, redefined by ko1
  • TestProc#test_proc_args_opt_and_block

    • defined by yugui, redefined by yugui
  • TestEncodingConverter#test_invalid_replace

    • defined by akr, redefined by akr
  • TestZlibGzipReader#test_gets

    • defined first by mame, redefined by mame
  • TestBigDecimal#test_coerce

    • defined first by mame, redefined by nobu
  • TestStringScanner#test_inspect

    • defined first by aamine, redefined by mame

--
Yusuke ENDOH
=end


Files

test-unit-redefinition-check.patch (565 Bytes) test-unit-redefinition-check.patch mame (Yusuke Endoh), 01/25/2010 07:41 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0