summaryrefslogtreecommitdiff
path: root/test/ruby/test_string.rb
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-20 07:39:32 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-20 07:39:32 +0000
commit51b72c10816af2791a7f89ec541f140a6b3fc447 (patch)
treea957464b0296925ad853bef9e9ed67a612ae9774 /test/ruby/test_string.rb
parente62d2cb80c491a4337c1dfc6f580d06ea66b557e (diff)
parente1a45b10b6165c8fec505180a52c4ce58fb21e91 (diff)
add tag v1_9_0_2v1_9_0_2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_9_0_2@17482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r--test/ruby/test_string.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 55cef9001e..869e31b641 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -683,6 +683,17 @@ class TestString < Test::Unit::TestCase
assert(S("hello").hash != S("helLO").hash)
end
+ def test_hash_random
+ str = 'abc'
+ a = [str.hash.to_s]
+ 3.times {
+ EnvUtil.rubyexec("-e", "print #{str.dump}.hash") {|i,o,e|
+ a << o.read
+ }
+ }
+ assert_not_equal([str.hash.to_s], a.uniq)
+ end
+
def test_hex
assert_equal(255, S("0xff").hex)
assert_equal(-255, S("-0xff").hex)