diff options
-rw-r--r-- | object.c | 2 | ||||
-rw-r--r-- | spec/ruby/core/module/allocate_spec.rb | 14 | ||||
-rw-r--r-- | test/ruby/test_module.rb | 12 |
3 files changed, 2 insertions, 26 deletions
@@ -4612,6 +4612,7 @@ InitVM_Object(void) rb_define_method(rb_cModule, "attr_accessor", rb_mod_attr_accessor, -1); rb_define_alloc_func(rb_cModule, rb_module_s_alloc); + rb_undef_method(rb_singleton_class(rb_cModule), "allocate"); rb_define_method(rb_cModule, "initialize", rb_mod_initialize, 0); rb_define_method(rb_cModule, "initialize_clone", rb_mod_initialize_clone, -1); rb_define_method(rb_cModule, "instance_methods", rb_class_instance_methods, -1); /* in class.c */ @@ -4643,6 +4644,7 @@ InitVM_Object(void) rb_define_method(rb_cModule, "deprecate_constant", rb_mod_deprecate_constant, -1); /* in variable.c */ rb_define_method(rb_cModule, "singleton_class?", rb_mod_singleton_p, 0); + rb_define_method(rb_singleton_class(rb_cClass), "allocate", rb_class_alloc_m, 0); rb_define_method(rb_cClass, "allocate", rb_class_alloc_m, 0); rb_define_method(rb_cClass, "new", rb_class_new_instance_pass_kw, -1); rb_define_method(rb_cClass, "initialize", rb_class_initialize, -1); diff --git a/spec/ruby/core/module/allocate_spec.rb b/spec/ruby/core/module/allocate_spec.rb deleted file mode 100644 index 3b2c4119c3..0000000000 --- a/spec/ruby/core/module/allocate_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -require_relative '../../spec_helper' - -describe "Module.allocate" do - it "returns an instance of Module" do - mod = Module.allocate - mod.should be_an_instance_of(Module) - end - - it "returns a fully-formed instance of Module" do - mod = Module.allocate - mod.constants.should_not == nil - mod.methods.should_not == nil - end -end diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index bbe84cd9ff..b36b8b7810 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -3094,18 +3094,6 @@ class TestModule < Test::Unit::TestCase assert_match(/::Foo$/, mod.name, '[Bug #14895]') end - def test_include_allocated - assert_raise(ArgumentError) do - Module.new {include Module.allocate} - end - assert_raise(ArgumentError) do - Module.new {prepend Module.allocate} - end - assert_raise(ArgumentError) do - Object.new.extend Module.allocate - end - end - private def assert_top_method_is_private(method) |