diff options
Diffstat (limited to 'test/ruby')
-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 7c2a5d3aa8..cf428d1bbe 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -706,4 +706,33 @@ class TestRequire < Test::Unit::TestCase END } 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 |