diff options
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_string.rb | 11 |
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) |