aboutsummaryrefslogtreecommitdiff
path: root/ruby/tests
diff options
context:
space:
mode:
authorPaul Yang <TeBoring@users.noreply.github.com>2018-07-23 11:05:28 -0700
committerGitHub <noreply@github.com>2018-07-23 11:05:28 -0700
commite508fc0c661fefe5228a9cab77d0c07ef220f34a (patch)
tree560794070be87d9b2bc55464c9cb32c4622fb00c /ruby/tests
parentfc90fd6df1db9c89e08eaf93a9a525928c459cdf (diff)
downloadprotobuf-e508fc0c661fefe5228a9cab77d0c07ef220f34a.tar.gz
protobuf-e508fc0c661fefe5228a9cab77d0c07ef220f34a.tar.bz2
protobuf-e508fc0c661fefe5228a9cab77d0c07ef220f34a.zip
Check the message to be encoded is the wrong type. (#4885) (#4949)
* Check the message to be encoded is the wrong type. (#4885) * Change TypeError to ArgumentError
Diffstat (limited to 'ruby/tests')
-rw-r--r--ruby/tests/encode_decode_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/ruby/tests/encode_decode_test.rb b/ruby/tests/encode_decode_test.rb
index 2bd9b98b..f8b991cd 100644
--- a/ruby/tests/encode_decode_test.rb
+++ b/ruby/tests/encode_decode_test.rb
@@ -84,4 +84,14 @@ class EncodeDecodeTest < Test::Unit::TestCase
assert_match 'optional_int32', json
end
+
+ def test_encode_wrong_msg
+ e = assert_raise ::ArgumentError do
+ m = A::B::C::TestMessage.new(
+ :optional_int32 => 1,
+ )
+ Google::Protobuf::Any.encode(m)
+ end
+ end
+
end