diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-09 16:16:42 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-09 16:16:42 +0000 |
commit | e11c22602af69e8139ec0649bb39f5a66d1e66a1 (patch) | |
tree | 7f9b5fd9e72b5f675209712d45407f41cef791f9 /test/ruby/test_exception.rb | |
parent | a4a4e8b5a05f69cec077e72a43769e38ef205e23 (diff) | |
parent | d0c717e410cff2fb0d39ca4e113532e84c04f06b (diff) |
add tag v2_4_0_preview2v2_4_0_preview2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v2_4_0_preview2@56129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_exception.rb')
-rw-r--r-- | test/ruby/test_exception.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 5023262e5d..03c0c819f5 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -698,6 +698,52 @@ end.join assert_nil(e.cause.cause) end + def test_cause_thread_no_cause + bug12741 = '[ruby-core:77222] [Bug #12741]' + + x = Thread.current + a = false + y = Thread.start do + Thread.pass until a + x.raise "stop" + end + + begin + raise bug12741 + rescue + e = assert_raise_with_message(RuntimeError, "stop") do + a = true + sleep 1 + end + end + assert_nil(e.cause) + end + + def test_cause_thread_with_cause + bug12741 = '[ruby-core:77222] [Bug #12741]' + + x = Thread.current + a = false + y = Thread.start do + Thread.pass until a + begin + raise "caller's cause" + rescue + x.raise "stop" + end + end + + begin + raise bug12741 + rescue + e = assert_raise_with_message(RuntimeError, "stop") do + a = true + sleep 1 + end + end + assert_equal("caller's cause", e.cause.message) + end + def test_unknown_option bug = '[ruby-core:63203] [Feature #8257] should pass unknown options' |