diff options
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r-- | test/ruby/test_string.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 5f2c54f44a..4d97182da7 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -1,4 +1,5 @@ require 'test/unit' +require File.expand_path('envutil', File.dirname(__FILE__)) class TestString < Test::Unit::TestCase def check_sum(str, bits=16) @@ -29,4 +30,16 @@ class TestString < Test::Unit::TestCase ensure $KCODE = original_kcode end + + def test_hash_random + str = 'abc' + a = [str.hash.to_s] + cmd = sprintf("%s -e 'print %s.hash'", EnvUtil.rubybin, str.dump) + 3.times { + IO.popen(cmd, "rb") {|o| + a << o.read + } + } + assert_not_equal([str.hash.to_s], a.uniq) + end end |