aboutsummaryrefslogtreecommitdiffhomepage
path: root/ruby/tests
diff options
context:
space:
mode:
authorGravatar Anders Carling <lowe@lowe.nu>2015-11-20 21:57:28 +0100
committerGravatar Anders Carling <lowe@lowe.nu>2015-11-20 21:57:28 +0100
commit0559f3ee9e1cae9e2dfc9893567cb0ac229727bf (patch)
tree11224cd44ebda70cec3af963aff3214f9f482fd9 /ruby/tests
parent8bcd0d7fc766c6c2cba3aa2bbc20750ec72728c6 (diff)
Add field name to initialization map exceptions
Diffstat (limited to 'ruby/tests')
-rw-r--r--ruby/tests/basic.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/ruby/tests/basic.rb b/ruby/tests/basic.rb
index 815abc46..da85520f 100644
--- a/ruby/tests/basic.rb
+++ b/ruby/tests/basic.rb
@@ -203,6 +203,23 @@ module BasicTest
assert_match(/hello/, e.message)
end
+ def test_initialization_map_errors
+ e = assert_raise ArgumentError do
+ TestMessage.new(:hello => "world")
+ end
+ assert_match(/hello/, e.message)
+
+ e = assert_raise ArgumentError do
+ MapMessage.new(:map_string_int32 => "hello")
+ end
+ assert_equal e.message, "Expected Hash object as initializer value for map field 'map_string_int32'."
+
+ e = assert_raise ArgumentError do
+ TestMessage.new(:repeated_uint32 => "hello")
+ end
+ assert_equal e.message, "Expected array as initializer value for repeated field 'repeated_uint32'."
+ end
+
def test_type_errors
m = TestMessage.new
assert_raise TypeError do