diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-18 16:13:53 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-18 16:13:53 +0000 |
commit | f79eaf199cc5c5ff1cc5c7774cab13af2a05a18e (patch) | |
tree | 089025c87c1ba5668700fce1429d5303e237d106 /test | |
parent | 478cdf49d7fcca58de301637dba598d2da69ef3e (diff) |
merge revision(s) 51292,51439,51440: [Backport #11404] [Backport #11481]
* load.c (rb_load_internal0): do not raise any exceptions but
return the result tag state.
* load.c (rb_load_protect): reduce nested EXEC_TAGs.
* load.c (rb_load_internal0): extra check before returning
TAG_RAISE when a non-local transfer of control happens while
loading and parsing a Ruby source file.
[ruby-core:70169] [Bug #11404]
* load.c (rb_load_internal0): stop separating exits at loading
from exits from execution. TAG_FATAL is the only case that
`errinfo` is a Fixnum, and should continue to exit by JUMP_TAG
but not raising as an ordinary exception.
[ruby-core:70169] [Bug #11404]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@52655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_require.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb index 33aea6082a..1b87246e4e 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -701,4 +701,33 @@ class TestRequire < Test::Unit::TestCase } rescue Errno::ENOENT end unless /mswin|mingw/ =~ RUBY_PLATFORM + + def test_throw_while_loading + Tempfile.create(%w'bug-11404 .rb') do |f| + f.puts 'sleep' + f.close + + assert_separately(["-", f.path], <<-'end;') + path = ARGV[0] + class Error < RuntimeError + def exception(*) + begin + throw :blah + rescue UncaughtThrowError + end + self + end + end + + assert_throw(:blah) do + x = Thread.current + y = Thread.start { + sleep 0.00001 + x.raise Error.new + } + load path + end + end; + end + end end |