diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_exception.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index cc4dcb7b7f..32b87f2d92 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -476,4 +476,19 @@ end.join def test_stackoverflow assert_raise(SystemStackError){m} end + + def test_cause + msg = "[Feature #8257]" + e = assert_raise(StandardError) { + begin + raise msg + rescue => e + assert_nil(e.cause, msg) + raise StandardError + end + } + cause = e.cause + assert_instance_of(RuntimeError, cause, msg) + assert_equal(msg, cause.message, msg) + end end |