Vinutha Nayak created JRUBY-6301: ------------------------------------ Summary: scripting_lang.jruby:undefined method in test_loop_1_9.rb Key: JRUBY-6301 URL: https://jira.codehaus.org/browse/JRUBY-6301 Project: JRuby Issue Type: Bug Components: Launcher Affects Versions: JRuby 1.7 Reporter: Vinutha Nayak Assignee: Thomas E Enebo Fix For: JRuby 1.7
Again this testcase seems to be part of the one that is shipped with ruby 1.7.0 source . require 'test/unit' class TestLoop19 < Test::Unit::TestCase def test_loop_catches_rescues_iteration_and_does_not_export_scope loop do n = 1 raise StopIteration end assert_raises NameError do n end <-------------------------------- end end While running this against Java 7 SR1 , I get the following error test_loop_catches_rescues_iteration_and_does_not_export_scope(TestLoop19): NoMethodError: undefined method `foo' for #<TestLoop19:0xcf5a8ceb> <-------------------------------------------------- /home/vinunaya/ruby/test/test_loop_1_9.rb:6:in `test_loop_catches_rescues_iteration_and_does_not_export_scope' org/jruby/RubyKernel.java:1342:in `loop' /home/vinunaya/ruby/test/test_loop_1_9.rb:5:in `test_loop_catches_rescues_iteration_and_does_not_export_scope' org/jruby/RubyKernel.java:1944:in `send' org/jruby/RubyArray.java:1603:in `each' org/jruby/RubyArray.java:1603:in `each' So if we observed the lines pointed out in the above failure message , it is basically getting a "NoMethodError" from the "do...end" block rather than the "NameError" expected. So further looking into the issue , the above can be recreated even with a simple change to testcase . class TestLoop19 < Test::Unit::TestCase def test_loop_catches_rescues_iteration_and_does_not_export_scope loop do puts foo <-------------------------- raise StopIteration end end So here I have removed the assertion and added a "puts " statement instead. If I run this with Java 7 SR1 , I get the error as mentioned above where as with Java 6 I get "NameError" as expected . As per http://www.ruby-doc.org/core-1.9.3/NameError.html documentation we should be getting the "NameError" error itself . Again here also ,when I tried running jruby with "--debug" option ( on Java7 SR1 line) I see the testcase passes . I have raised JRUBY-6300 which was for slightly different issue but there too with "--debug" option it was passing . So I am not sure if these are related . If yes can you please let me know the build number where this is fixed . If not , can you please help with this issue . ? -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email