1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2023 Google Inc. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file or at
6 // https://developers.google.com/open-source/licenses/bsd
8 #include <gtest/gtest.h>
9 #include "editions/golden/test_messages_proto2_editions.pb.h"
15 using ::protobuf_test_messages::editions::proto2::TestAllTypesProto2
;
17 // It's important that no calls that would initialize the generated pool occur
18 // in any tests in this file. This test guarantees that there's no mutex
19 // deadlock from lazily loading cpp_features.proto during reflection.
20 TEST(Generated
, Reflection
) {
21 TestAllTypesProto2 message
;
23 message
.GetReflection()->SetInt32(
24 &message
, message
.GetDescriptor()->FindFieldByName("optional_int32"), 1);
25 EXPECT_EQ(message
.optional_int32(), 1);
29 } // namespace protobuf