diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-27 15:21:01 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-27 15:21:01 +0000 |
commit | c0cc34b6e1d861ee2182ceca9a9270cf2fe05f9a (patch) | |
tree | de7821e72ea94579e010881a80bb6b08362414bc /test/ruby/test_exception.rb | |
parent | 41a3eb0bd6e9cc90ad48ab99923c2a56459e0719 (diff) | |
download | ruby-c0cc34b6e1d861ee2182ceca9a9270cf2fe05f9a.tar.gz |
error.c: check argument of Warning.warn
* error.c (rb_warning_s_warn): the argument must be an
ASCII-compatible string. [ruby-core:77430] [Bug #12793]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_exception.rb')
-rw-r--r-- | test/ruby/test_exception.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 3735e492d8..91d3ac1e93 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -940,4 +940,16 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| remove_method :warn2 end end + + def test_warning_warn_invalid_argument + assert_raise(TypeError) do + ::Warning.warn nil + end + assert_raise(TypeError) do + ::Warning.warn 1 + end + assert_raise(Encoding::CompatibilityError) do + ::Warning.warn "\x00a\x00b\x00c".force_encoding("utf-16be") + end + end end |