From 1796522f10e4bee3db8df77fa66f749084592285 Mon Sep 17 00:00:00 2001 From: marcandre Date: Tue, 15 Sep 2009 21:30:50 +0000 Subject: * thread.c (rb_exec_recursive_outer, rb_exec_recursive): Added method to short-circuit to the outermost level in case of recursion * test/ruby/test_thread.rb (test_recursive_outer): Test for above * hash.c (rb_hash_hash): Return a sensible hash for in case of recursion [ruby-core:24648] * range.c (rb_range_hash): ditto * struct.c (rb_struct_hash): ditto * array.c (rb_array_hash): ditto * test/ruby/test_array.rb (test_hash2): test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_thread.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/ruby/test_thread.rb') diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index d0c35d8273..397da2c3f7 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -458,6 +458,19 @@ class TestThread < Test::Unit::TestCase end assert_raise(TypeError) { [o].inspect } end + + def test_recursive_outer + arr = [] + obj = Struct.new(:foo, :visited).new(arr, false) + arr << obj + def obj.hash + self[:visited] = true + super + raise "recursive_outer should short circuit intermediate calls" + end + assert_nothing_raised {arr.hash} + assert(obj[:visited]) + end end class TestThreadGroup < Test::Unit::TestCase -- cgit v1.2.3