|
@@ -1671,6 +1671,23 @@ class GeneratedClassTest extends TestBase
|
|
# TODO: what about unknown fields?
|
|
# TODO: what about unknown fields?
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ #########################################################
|
|
|
|
+ # Test hasOneof<Field> methods exists and working
|
|
|
|
+ #########################################################
|
|
|
|
+
|
|
|
|
+ public function testHasOneof() {
|
|
|
|
+ $m = new TestMessage();
|
|
|
|
+ $this->assertFalse($m->hasOneofInt32());
|
|
|
|
+ $m->setOneofInt32(42);
|
|
|
|
+ $this->assertTrue($m->hasOneofInt32());
|
|
|
|
+ $m->setOneofString("bar");
|
|
|
|
+ $this->assertFalse($m->hasOneofInt32());
|
|
|
|
+ $this->assertTrue($m->hasOneofString());
|
|
|
|
+ $m->clear();
|
|
|
|
+ $this->assertFalse($m->hasOneofInt32());
|
|
|
|
+ $this->assertFalse($m->hasOneofString());
|
|
|
|
+ }
|
|
|
|
+
|
|
#########################################################
|
|
#########################################################
|
|
# Test no segfault when error happens
|
|
# Test no segfault when error happens
|
|
#########################################################
|
|
#########################################################
|