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
This commit is contained in:
parent
c879b60152
commit
327b22ad77
1
eval.c
1
eval.c
@ -1482,6 +1482,7 @@ static void
|
|||||||
ignored_block(VALUE module, const char *klass)
|
ignored_block(VALUE module, const char *klass)
|
||||||
{
|
{
|
||||||
const char *anon = "";
|
const char *anon = "";
|
||||||
|
Check_Type(module, T_MODULE);
|
||||||
if (!RTEST(rb_search_class_path(module))) {
|
if (!RTEST(rb_search_class_path(module))) {
|
||||||
anon = ", maybe for Module.new";
|
anon = ", maybe for Module.new";
|
||||||
}
|
}
|
||||||
|
@ -1961,6 +1961,27 @@ class TestRefinement < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
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
|
class ToString
|
||||||
c = self
|
c = self
|
||||||
using Module.new {refine(c) {def to_s; "ok"; end}}
|
using Module.new {refine(c) {def to_s; "ok"; end}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user