method(:require).parameters is [] during Minitest run #835

Closed
judofyr opened this Issue Jun 30, 2013 · 4 comments

Projects

None yet

2 participants

@judofyr
judofyr commented Jun 30, 2013

main.rb:

gem 'minitest', '5.0.2'
require 'minitest/autorun'

$require = Kernel.method(:require)
$location = $require.source_location
$params = $require.parameters

class T < Minitest::Test
  def test_wat
    assert_equal $require, Kernel.method(:require)
    assert_equal $location, Kernel.method(:require).source_location
    assert_equal $params, Kernel.method(:require).parameters
  end
end

Result:

$ ruby -v main.rb
jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on Java HotSpot(TM) 64-Bit Server VM 1.7.0_17-b02 [darwin-x86_64]
Run options: --seed 1790

# Running:

F

Finished in 0.057000s, 17.5439 runs/s, 52.6316 assertions/s.

  1) Failure:
T#test_wat [main.rb:12]:
Expected: [[:req]]
  Actual: []

1 runs, 3 assertions, 1 failures, 0 errors, 0 skips
@headius
Member
headius commented Jun 30, 2013

Huh, that's a weird one. Confirmed on master, and I have no idea what's up.

@headius
Member
headius commented Jun 30, 2013

Simpler reproduction. It just seems that it's losing parameters for calls past the first:

r = Kernel.method(:require)
p r.parameters
p r.parameters
@headius
Member
headius commented Jun 30, 2013

Fixed by 99a0613.

@headius headius closed this Jun 30, 2013
@judofyr
judofyr commented Jun 30, 2013

Odd indeed. That makes more sense than "during Minitest run" at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment