Module: BasicTest

Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/google-protobuf-3.21.12-x86_64-linux/tests/basic.rb

Overview

————- generated code ————–

Defined Under Namespace

Classes: MessageContainerTest

Constant Summary collapse

BadFieldNames =
pool.lookup("BadFieldNames").msgclass

Instance Method Summary collapse

Instance Method Details

#test_oneof_fields_respond_to?Boolean

regression test for issue 9202

Returns:

  • (Boolean)


717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/google-protobuf-3.21.12-x86_64-linux/tests/basic.rb', line 717

def test_oneof_fields_respond_to? # regression test for issue 9202
  msg = proto_module::OneofMessage.new
  # `has_` prefix + "?" suffix actions should only work for oneofs fields.
  assert msg.has_my_oneof?
  assert msg.respond_to? :has_my_oneof?
  assert !msg.respond_to?( :has_a? )
  assert_raise NoMethodError do
    msg.has_a?
  end
  assert !msg.respond_to?( :has_b? )
  assert_raise NoMethodError do
    msg.has_b?
  end
  assert !msg.respond_to?( :has_c? )
  assert_raise NoMethodError do
    msg.has_c?
  end
  assert !msg.respond_to?( :has_d? )
  assert_raise NoMethodError do
    msg.has_d?
  end
end