This leads to a loss of a valuable chance of test. It is good for
test/unit to detect and warn such a redefinition.
I think you can already see them with warning enabled:
(in Ruby 1.9.2)
test.rb:163: warning: method redefined; discarding old test_one
test.rb:160: warning: previous definition of test_one was here
(in 1.8.7)
test.rb:163: warning: method redefined; discarding old test_one
This leads to a loss of a valuable chance of test. It is good for
test/unit to detect and warn such a redefinition.
I think you can already see them with warning enabled:
(in Ruby 1.9.2)
test.rb:163: warning: method redefined; discarding old test_one
test.rb:160: warning: previous definition of test_one was here
(in 1.8.7)
test.rb:163: warning: method redefined; discarding old test_one
The warning is very forgetful. It is waste of time and intelligence
for all test/unit users to enable the warning. In addition, method
redefinition is not always wrong.
But, it is reasonable to enable all warning during test. If so, it is
also good for test/unit to enable warning by default, I think.
I agree with Benoit. -w is there for a reason. If you're willing to ignore warnings coming from ruby, why would adding another line that says essentially the same thing be any better?
Regardless, I don't maintain test/unit, but I vote that this ticket be rejected.
This issue was solved with changeset r36484.
Yusuke, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
lib/test/unit.rb: warn when test_* method is redefined.
Patch by mame (Yusuke Endoh). [Feature #2643] [ruby-core:27790]
test/testunit/test_redefinition.rb: Test for above.