diff --git a/test/jruby_index b/test/jruby_index index b231f2c4f4c..3660bcf12d6 100644 --- a/test/jruby_index +++ b/test/jruby_index @@ -30,6 +30,7 @@ test_io test_nkf test_java_accessible_object test_java_extension +test_local_jump_error test_method_missing test_methods #test_openssl diff --git a/test/test_local_jump_error.rb b/test/test_local_jump_error.rb new file mode 100644 index 00000000000..cfcc416f7dc --- /dev/null +++ b/test/test_local_jump_error.rb @@ -0,0 +1,29 @@ +require 'test/unit' + +class TestLocalJumpError < Test::Unit::TestCase + def test_lje_structure + begin + break 1 + rescue LocalJumpError => lje + assert_equal(:break, lje.reason) + assert_equal(1, lje.exit_value) + assert_equal(["@reason", "@exit_value"], lje.instance_variables) + end + + begin + yield 1 + rescue LocalJumpError => lje + assert_equal(:noreason, lje.reason) + assert_equal(nil, lje.exit_value) + end + +=begin This seems like it should work, but it doesn't, even in Ruby... + begin + next + rescue LocalJumpError => lje + assert_equal(:next, lje.reason) + assert_equal(nil, lje.exit_value) + end +=end + end +end \ No newline at end of file