THRIFT-2876: C++ - tests: coping __isset structure in copy constructor
Client: C++
Patch: Nobuaki Sukegawa
Test verifies THRIFT-2526
This closes #303
diff --git a/lib/cpp/test/OptionalRequiredTest.cpp b/lib/cpp/test/OptionalRequiredTest.cpp
index 79fa697..3f60754 100644
--- a/lib/cpp/test/OptionalRequiredTest.cpp
+++ b/lib/cpp/test/OptionalRequiredTest.cpp
@@ -91,6 +91,25 @@
}
cout << endl;
+ // assign/copy-construct with non-required fields
+ {
+ Simple s1, s2;
+ s1.__isset.im_default = true;
+ s1.__set_im_optional(10);
+ assert(s1.__isset.im_default);
+ assert(s1.__isset.im_optional);
+
+ s2 = s1;
+
+ assert(s2.__isset.im_default);
+ assert(s2.__isset.im_optional);
+
+ Simple s3(s1);
+
+ assert(s3.__isset.im_default);
+ assert(s3.__isset.im_optional);
+ }
+
// Write-to-read with optional fields.
{
Simple s1, s2, s3;