diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-30 12:26:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-30 12:26:23 +0000 |
commit | 327b22ad77bf285206d787d0f0c648234d95b707 (patch) | |
tree | d454d2032569ade92d384080f597cf8cb4f5aaa8 /test/ruby | |
parent | c879b60152ccfb4317ae86c22f8947c3b1d442bb (diff) | |
download | ruby-327b22ad77bf285206d787d0f0c648234d95b707.tar.gz |
eval.c: check type
* eval.c (ignored_block): check argument type, which must be
Module. [ruby-dev:50270] [Bug #13956]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_refinement.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index 31925f3933..629fcb894b 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -1961,6 +1961,27 @@ class TestRefinement < Test::Unit::TestCase end end + def test_using_wrong_argument + bug = '[ruby-dev:50270] [Bug #13956]' + pattern = /expected Module/ + assert_separately([], "#{<<-"begin;"}\n#{<<-'end;'}") + bug = ""#{bug.dump} + pattern = /#{pattern}/ + begin; + assert_raise_with_message(TypeError, pattern, bug) { + using(1) do end + } + end; + assert_separately([], "#{<<-"begin;"}\n#{<<-'end;'}") + bug = ""#{bug.dump} + pattern = /#{pattern}/ + begin; + assert_raise_with_message(TypeError, pattern, bug) { + Module.new {using(1) {}} + } + end; + end + class ToString c = self using Module.new {refine(c) {def to_s; "ok"; end}} |