Details
-
Type:
Bug
-
Status:
Reopened
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: JRuby 1.5.6, JRuby 1.6.7
-
Fix Version/s: None
-
Component/s: Parser, Ruby 1.9.2
-
Labels:None
-
Number of attachments :
Description
The new method signature causes MiniTest doesn't handle default arguments properly. I've reduced the issue to this code:
require 'minitest/unit' module Foo include MiniTest::Assertions def assert(test, msg = (nomsg = true; nil)) super end end include Foo assert 'foo' == '', 'expected blank'
The expected output is:
`assert': expected blank (MiniTest::Assertion)
but I get the MiniTest default message:
`assert': Failed assertion, no message given. (MiniTest::Assertion)
The signature of the assert above is the same that TestUnit has for Ruby 1.9 and that causes ActiveSupport tests fail:
https://github.com/jruby/jruby/blob/master/lib/ruby/1.9/test/unit/assertions.rb#L13
If I remove the "nomsg = true" parameter it works fine.
Slightly more reduced test case:
class Base def meth(a, b = 4) puts a.inspect, b.inspect # 1.8.7: 1, nil 1.9.2: 1, 2 # -X-C : 1, nil : 1, nil # -X+C : 1, 4 : 1, 4 (no -X since -X+C dies on rubygems) end end class Derived < Base def meth(a, b = (c = 3)) super end end Derived.new.meth(1, 2)We are a hot mess on this one...For what it is worth only Yarv 1.9.2 seems like a reasonable result.