summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-06 05:42:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-06 05:42:53 +0000
commitd2101310db6d7247bc07132d9f90929b6757c1ae (patch)
tree5eb9b35311016e92301cfc3ce800eb953788ecb9 /test
parent2456f869c83daa23be6a555d6c661bc15a5bd516 (diff)
include and prepend check no args
* eval.c (rb_mod_include, rb_mod_prepend): check if arguments are given, as well as Kernel#extend. [ruby-dev:49854] [Bug #12887] [Fix GH-1470] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_module.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index e9529273eb..0a11be46e3 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -440,6 +440,10 @@ class TestModule < Test::Unit::TestCase
EOS
end
+ def test_include_with_no_args
+ assert_raise(ArgumentError) { Module.new { include } }
+ end
+
def test_included_modules
assert_equal([], Mixin.included_modules)
assert_equal([Mixin], User.included_modules)
@@ -1868,6 +1872,10 @@ class TestModule < Test::Unit::TestCase
end;
end
+ def test_prepend_module_with_no_args
+ assert_raise(ArgumentError) { Module.new { prepend } }
+ end
+
def test_class_variables
m = Module.new
m.class_variable_set(:@@foo, 1)
@@ -1934,6 +1942,10 @@ class TestModule < Test::Unit::TestCase
assert_equal(['public', 'protected'], list)
end
+ def test_extend_module_with_no_args
+ assert_raise(ArgumentError) { Module.new { extend } }
+ end
+
def test_invalid_attr
%W[
foo?