aboutsummaryrefslogtreecommitdiff
path: root/ruby/tests/basic.rb
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2017-03-16 09:28:09 -0700
committerGitHub <noreply@github.com>2017-03-16 09:28:09 -0700
commit2957703a01f52fcf7a9d471b741e97e896767ffb (patch)
tree9bf18616a16d7050393679227d3b2891ecb7ca13 /ruby/tests/basic.rb
parent0fad0e138faafae9496ce60414f4d3c2139b0638 (diff)
parent324a299a55409febb4c0e71a03ff3e50d191ca84 (diff)
downloadprotobuf-2957703a01f52fcf7a9d471b741e97e896767ffb.tar.gz
protobuf-2957703a01f52fcf7a9d471b741e97e896767ffb.tar.bz2
protobuf-2957703a01f52fcf7a9d471b741e97e896767ffb.zip
Merge pull request #2847 from haberman/ruby-toh
Ruby: fixed Message#to_h for map fields.
Diffstat (limited to 'ruby/tests/basic.rb')
-rw-r--r--ruby/tests/basic.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/ruby/tests/basic.rb b/ruby/tests/basic.rb
index ca81e3a5..34251234 100644
--- a/ruby/tests/basic.rb
+++ b/ruby/tests/basic.rb
@@ -927,6 +927,16 @@ module BasicTest
:repeated_uint64=>[]
}
assert_equal expected_result, m.to_h
+
+ m = MapMessage.new(
+ :map_string_int32 => {"a" => 1, "b" => 2},
+ :map_string_msg => {"a" => TestMessage2.new(:foo => 1),
+ "b" => TestMessage2.new(:foo => 2)})
+ expected_result = {
+ :map_string_int32 => {"a" => 1, "b" => 2},
+ :map_string_msg => {"a" => {:foo => 1}, "b" => {:foo => 2}}
+ }
+ assert_equal expected_result, m.to_h
end