summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_array.rb3
-rw-r--r--test/ruby/test_thread.rb13
2 files changed, 15 insertions, 1 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index 2723b37c6a..fd3b98432d 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -1572,7 +1572,8 @@ class TestArray < Test::Unit::TestCase
def test_hash2
a = []
a << a
- assert_raise(ArgumentError) { a.hash }
+ assert_equal([[a]].hash, a.hash)
+ assert_not_equal([a, a].hash, a.hash) # Implementation dependent
end
def test_flatten2
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