diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-08-23 04:00:25 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-08-23 04:00:25 +0000 |
commit | 55cf24d3789486328e9a2ea734f42fb9122056e9 (patch) | |
tree | b0432f19ef5949373e2885b7d5adfd606154cd73 /test/ruby/test_super.rb | |
parent | 742a0d164e127394b438d6b83a8d65b4c16f1981 (diff) | |
download | ruby-55cf24d3789486328e9a2ea734f42fb9122056e9.tar.gz |
* insns.def (invokesuper): reverted r36640 partially to make super
in a thread work correctly. [ruby-core:47284] [Bug #6907]
* test/ruby/test_super.rb: related test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_super.rb')
-rw-r--r-- | test/ruby/test_super.rb | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb index 7208b362fc..dcd700858c 100644 --- a/test/ruby/test_super.rb +++ b/test/ruby/test_super.rb @@ -264,7 +264,9 @@ class TestSuper < Test::Unit::TestCase end } obj = sub_class.new - assert_equal [:super, obj], obj.foo + assert_raise(NotImplementedError) do + obj.foo + end end def test_super_in_instance_eval_with_define_method @@ -282,7 +284,9 @@ class TestSuper < Test::Unit::TestCase end } obj = sub_class.new - assert_equal [:super, obj], obj.foo + assert_raise(NotImplementedError) do + obj.foo + end end def test_super_in_orphan_block @@ -298,9 +302,7 @@ class TestSuper < Test::Unit::TestCase end } obj = sub_class.new - assert_raise(NoMethodError) do - obj.foo.call - end + assert_equal([:super, obj], obj.foo.call) end def test_super_in_orphan_block_with_instance_eval @@ -318,7 +320,7 @@ class TestSuper < Test::Unit::TestCase end } obj = sub_class.new - assert_raise(NoMethodError) do + assert_raise(NotImplementedError) do obj.foo.call end end @@ -334,4 +336,15 @@ class TestSuper < Test::Unit::TestCase } assert_equal 'hi', y.hello end + + def test_super_in_thread + hoge = Class.new { + def bar; 'hoge'; end + } + foo = Class.new(hoge) { + def bar; Thread.new { super }.join.value; end + } + + assert_equal 'hoge', foo.new.bar + end end |