Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Jruby activesupport fix 3 1 stable for JRuby #2849

Merged
merged 1 commit into from

3 participants

@arunagw
Collaborator

In JRuby backtrace is different.
In JRuby first is "org/jruby/RubyKernel.java"

fixed tests for activesupport with JRuby.

@jonleighton
Collaborator

Can we not just use e.backtrace.first on all platforms?

@arunagw
Collaborator

In JRuby the first line of backtrace is "org/jruby/RubyKernel.java"

So i am using [1] here.

@arunagw
Collaborator

Running with JRuby giving me

  1) Failure:
test_delegation_exception_backtrace(ModuleTest)
    [/Users/arunagw/checkouts/rails/activesupport/test/core_ext/module_test.rb:176:in `test_delegation_exception_backtrace'
     org/jruby/RubyKernel.java:2092:in `send'
     /Users/arunagw/checkouts/rails/bundle/jruby/1.8/gems/mocha-0.9.12/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:22:in `run'
     /Users/arunagw/checkouts/rails/bundle/jruby/1.8/gems/mocha-0.9.12/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:20:in `run'
     /Users/arunagw/checkouts/rails/bundle/jruby/1.8/gems/mocha-0.9.12/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:19:in `run'
     org/jruby/RubyArray.java:1603:in `each'
     org/jruby/RubyArray.java:1603:in `each']:
[org/jruby/RubyKernel.java:2092:in `send'] did not include [/Users/arunagw/checkouts/rails/activesupport/test/core_ext/module_test.rb:36].
<false> is not true.
@jonleighton
Collaborator

My bad, sorry. I only just got up :)

Perhaps you could change the test to check that some line in the backtrace has that file and line number, rather than the first. That way it will be less brittle if the implementation changes etc.

@arunagw
Collaborator

I will update in a while. :-) thanks :-)

@arunagw
Collaborator

@jonleighton I have updated to check with whole backtrace. if it's ok then i will change for master also.

We can also do

e.backtrace.to_s.include?(file_and_line)

Please suggest me which is fine :-)

Please check :-)

@jonleighton
Collaborator

The code is good, but please can you add a comment to the code and the commit message along the lines of 'We can't simply check the first line of the backtrace, because JRuby reports the call to __send__ in the backtrace.`

@arunagw arunagw We can't simply check the first line of the
backtrace, because JRuby reports the call 
to __send__ in the backtrace.

In JRuby first is "org/jruby/RubyKernel.java"
5df885e
@arunagw
Collaborator

@jonleighton Updated both the PR.

@jonleighton jonleighton merged commit df3360f into from
@guilleiguaran

+1 for this, Rubinius reports the error also in the second line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 4, 2011
  1. @arunagw

    We can't simply check the first line of the

    arunagw authored
    backtrace, because JRuby reports the call 
    to __send__ in the backtrace.
    
    In JRuby first is "org/jruby/RubyKernel.java"
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 2 deletions.
  1. +3 −2 activesupport/test/core_ext/module_test.rb
View
5 activesupport/test/core_ext/module_test.rb
@@ -172,8 +172,9 @@ def test_delegation_exception_backtrace
someone.foo
rescue NoMethodError => e
file_and_line = "#{__FILE__}:#{Someone::FAILED_DELEGATE_LINE}"
- assert e.backtrace.first.include?(file_and_line),
- "[#{e.backtrace.first}] did not include [#{file_and_line}]"
+ # We can't simply check the first line of the backtrace, because JRuby reports the call to __send__ in the backtrace.
+ assert e.backtrace.any?{|a| a.include?(file_and_line)},
+ "[#{e.backtrace.inspect}] did not include [#{file_and_line}]"
end
def test_parent
Something went wrong with that request. Please try again.