diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-14 03:39:41 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-14 03:39:41 +0000 |
commit | fd13ad8cdc5991e9fda6d5f9610b32cf160f554c (patch) | |
tree | 01234d666cfe5fd7c7ddd8dd16be6bc7987e448a /test | |
parent | b9d74fd1c1ada57b998e567b72e334bfe31efbc1 (diff) |
merge revision(s) 25975:
* eval.c (proc_invoke): unbound block created by define_method
cannot call super. [ruby-core:26984]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@26091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_super.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb index 900fe997e6..a9d931c0ef 100644 --- a/test/ruby/test_super.rb +++ b/test/ruby/test_super.rb @@ -126,9 +126,27 @@ class TestSuper < Test::Unit::TestCase end end - def test_define_method # [ruby-core:03856] + class B + def m + [self, "#{self.class.to_s}::m"] + end + end + + class C < B + def self.t + define_method(:m) {super} + end + end + + def test_define_method a = A.new a.uu(12) - assert_equal("A#tt", a.tt(12)) + assert_equal("A#tt", a.tt(12), '[ruby-core:03856]') + + bug2419 = '[ruby-core:26984]' + q = C.t + assert_raise(NoMethodError, bug2419) {q.call} + c = C.new + assert_equal([c, "#{C.to_s}::m"], c.m, bug2419) end end |