Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Truffle] Method not added during instance_eval for MRI Test Excludes #2838

Closed
bjfish opened this issue Apr 16, 2015 · 4 comments
Closed

[Truffle] Method not added during instance_eval for MRI Test Excludes #2838

bjfish opened this issue Apr 16, 2015 · 4 comments

Comments

@bjfish
Copy link
Contributor

bjfish commented Apr 16, 2015

Example

class TestBase64
end
klass = TestBase64
klass.instance_eval do
              def exclude(name, reason)
                puts "excluding #{name}"
              end
end
klass.class_eval 'exclude :test_decode64, "needs investigation"'

Expected

ruby exclude.rb 
excluding test_decode64

Actual

~/Documents/jruby-mine/bin/jruby -X+T exclude.rb 
(eval):1:in `method_missing': undefined method `exclude' for TestBase64:Class (NoMethodError)
    from (eval):1:in `<main>'
    from exclude.rb:9:in `<main>'

@eregon
Copy link
Member

eregon commented Apr 16, 2015

Known issue, it is very difficult to find the proper class to define in this kind of context.
Workaround: use def klass.exclude(name, reason) here.

@bjfish
Copy link
Contributor Author

bjfish commented Apr 16, 2015

I'm using the workaround locally but won't be able to make the change to the minitest/unit.rb

@eregon
Copy link
Member

eregon commented Apr 16, 2015

I could potentially ask to make the change in ruby/ruby.

@eregon
Copy link
Member

eregon commented Apr 20, 2015

I committed a workaround in ff7a1d0.
I'll close this as we have specs to remind ourselves we don't do well on instance_eval on modules yet.

@eregon eregon closed this as completed Apr 20, 2015
@enebo enebo added this to the Invalid or Duplicate milestone Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants