summaryrefslogtreecommitdiff
path: root/test/ruby/test_super.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_super.rb')
-rw-r--r--test/ruby/test_super.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb
index ec0f8b608e..16b623df61 100644
--- a/test/ruby/test_super.rb
+++ b/test/ruby/test_super.rb
@@ -65,4 +65,24 @@ class TestSuper < Test::Unit::TestCase
assert_equal([1,2,3], Array4.new.array(1, 2, 3))
assert_equal([1,2,3,4], Array4.new.array(1, 2, 3, 4))
end
+
+ class A
+ def tt(aa)
+ "A#tt"
+ end
+
+ def uu(a)
+ class << self
+ define_method(:tt) do |sym|
+ super
+ end
+ end
+ end
+ end
+
+ def test_define_method # [ruby-core:03856]
+ a = A.new
+ a.uu(12)
+ assert_raise(RuntimeError) {a.tt(12)}
+ end
end