Skip to content

Commit 45d4dae

Browse files
nareddytvitalybuka
authored andcommitted
Add test
1 parent 196bf76 commit 45d4dae

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/mutator_test.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,11 @@ const char kOptionalInDeepAnyFields[] = R"(
293293
}
294294
)";
295295

296+
const char kUnknownField[] = R"(
297+
optional_bool: true
298+
unknown_field: "test unknown field"
299+
)";
300+
296301
class TestMutator : public Mutator {
297302
public:
298303
explicit TestMutator(bool keep_initialized,
@@ -668,6 +673,12 @@ TYPED_TEST(MutatorTypedTest, Serialization) {
668673
}
669674
}
670675

676+
TYPED_TEST(MutatorTypedTest, UnknownSerialization) {
677+
typename TestFixture::Message parsed;
678+
EXPECT_TRUE(ParseTextMessage(kUnknownField, &parsed));
679+
EXPECT_NE(SaveMessageAsText(parsed), kUnknownField);
680+
}
681+
671682
TYPED_TEST(MutatorTypedTest, DeepRecursion) {
672683
typename TestFixture::Message message;
673684
typename TestFixture::Message* last = &message;

0 commit comments

Comments
 (0)