aboutsummaryrefslogtreecommitdiff
path: root/ruby/tests/basic.rb
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2016-09-18 21:38:51 -0700
committerGitHub <noreply@github.com>2016-09-18 21:38:51 -0700
commitb5bbdb0967109fbae7bfc423ef3cd6dc776359b6 (patch)
tree79920944d315149f92c3e37f0e27b7c0156c6ec5 /ruby/tests/basic.rb
parentc44ca26fe89ed8a81d3ee475a2ccc1797141dbce (diff)
parentde028631fce33b77811f2a29c83c36ab875c751c (diff)
downloadprotobuf-b5bbdb0967109fbae7bfc423ef3cd6dc776359b6.tar.gz
protobuf-b5bbdb0967109fbae7bfc423ef3cd6dc776359b6.tar.bz2
protobuf-b5bbdb0967109fbae7bfc423ef3cd6dc776359b6.zip
Merge pull request #2037 from abscondment/fix-2036-ruby-hash
Fix #2036 (Ruby `hash` broken for Messages with repeated fields.)
Diffstat (limited to 'ruby/tests/basic.rb')
-rw-r--r--ruby/tests/basic.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/ruby/tests/basic.rb b/ruby/tests/basic.rb
index 8b6d329e..989a047e 100644
--- a/ruby/tests/basic.rb
+++ b/ruby/tests/basic.rb
@@ -183,12 +183,15 @@ module BasicTest
def test_hash
m1 = TestMessage.new(:optional_int32 => 42)
- m2 = TestMessage.new(:optional_int32 => 102)
+ m2 = TestMessage.new(:optional_int32 => 102, repeated_string: ['please', 'work', 'ok?'])
+ m3 = TestMessage.new(:optional_int32 => 102, repeated_string: ['please', 'work', 'ok?'])
assert m1.hash != 0
assert m2.hash != 0
+ assert m3.hash != 0
# relying on the randomness here -- if hash function changes and we are
# unlucky enough to get a collision, then change the values above.
assert m1.hash != m2.hash
+ assert_equal m2.hash, m3.hash
end
def test_unknown_field_errors