aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-13 01:34:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-13 01:34:52 +0000
commit8a2a882e53ade974494dbf7c968a85bad0393dcd (patch)
tree6f223bb27bd1fd97c9e0f5439d34a760ebfdb22f /test/ruby
parent6a16d03365a565cbf22f148e997dca55d63cb00b (diff)
downloadruby-8a2a882e53ade974494dbf7c968a85bad0393dcd.tar.gz
error.c: infinite recursion at Warning#warn
* error.c (rb_warn_m): write the message to rb_stderr directly, to get rid of infinite recursion when called on Warning module itself, by super in redefined Warning#warn. [ruby-dev:50293] [Bug #14006] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_exception.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb
index bcad728789..3622cae0d9 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -1034,6 +1034,20 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
assert_match(/^\tfrom #{Regexp.escape(path)}:1:/, warning.first)
end
+ def test_warning_warn_super
+ assert_in_out_err(%[-W0], "#{<<~"{#"}\n#{<<~'};'}", [], /instance variable @a not initialized/)
+ {#
+ module Warning
+ def warn(message)
+ super
+ end
+ end
+
+ $VERBOSE = true
+ @a
+ };
+ end
+
def test_undefined_backtrace
assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}")
begin;