diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | object.c | 1 | ||||
-rw-r--r-- | test/ruby/test_class.rb | 26 |
3 files changed, 35 insertions, 0 deletions
@@ -1,3 +1,11 @@ +Tue Aug 13 21:52:15 2013 Kenichi Kamiya <kachick1@gmail.com> + + * object.c (Init_Object): undef Module#prepend_features on Class, as + well as Module#append_features. [Fixes GH-376] + + * test_class.rb: Added test for above. And ensure type checking + on similar methods as module_function. + Tue Aug 13 08:52:18 2013 Zachary Scott <e@zzak.io> * doc/syntax/literals.rdoc: [DOC] String literal concat by @cknadler @@ -3242,6 +3242,7 @@ Init_Object(void) rb_define_alloc_func(rb_cClass, rb_class_s_alloc); rb_undef_method(rb_cClass, "extend_object"); rb_undef_method(rb_cClass, "append_features"); + rb_undef_method(rb_cClass, "prepend_features"); /* * Document-class: Data diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb index 47848f3184..b40cab8050 100644 --- a/test/ruby/test_class.rb +++ b/test/ruby/test_class.rb @@ -105,6 +105,32 @@ class TestClass < Test::Unit::TestCase end end + def test_extend_object + c = Class.new + assert_raise(TypeError) do + Module.instance_method(:extend_object).bind(c).call(Object.new) + end + end + + def test_append_features + c = Class.new + assert_raise(TypeError) do + Module.instance_method(:append_features).bind(c).call(Module.new) + end + end + + def test_prepend_features + c = Class.new + assert_raise(TypeError) do + Module.instance_method(:prepend_features).bind(c).call(Module.new) + end + end + + def test_module_specific_methods + assert_empty(Class.private_instance_methods(true) & + [:module_function, :extend_object, :append_features, :prepend_features]) + end + def test_method_redefinition feature2155 = '[ruby-dev:39400]' |