Add Ruby tests for oneof cases. (#7385)

In Ruby, the oneof case returns a symbol with the name of the field that is set. These were not previously tested.
pull/7417/head
David L. Jones 5 years ago committed by GitHub
parent c953182fa9
commit 94afb8ab36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      ruby/tests/basic.rb
  2. 3
      ruby/tests/basic_proto2.rb

@ -128,6 +128,7 @@ module BasicTest
m.a = "foo"
assert_equal "foo", m.a
assert m.has_my_oneof?
assert_equal :a, m.my_oneof
m.clear_a
assert !m.has_my_oneof?

@ -73,10 +73,11 @@ module BasicTestProto2
m = OneofMessage.new
assert !m.has_my_oneof?
m.a = "foo"
assert m.has_my_oneof?
assert_equal :a, m.my_oneof
assert m.has_a?
assert OneofMessage.descriptor.lookup('a').has?(m)
assert_equal "foo", m.a
assert m.has_my_oneof?
assert !m.has_b?
assert !OneofMessage.descriptor.lookup('b').has?(m)
assert !m.has_c?

Loading…
Cancel
Save