1 // Protocol Buffers - Google's data interchange format 2 // Copyright 2023 Google Inc. All rights reserved. 3 // 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 7 8 #include <gtest/gtest.h> 9 #include "editions/golden/test_messages_proto2_editions.pb.h" 10 11 namespace google { 12 namespace protobuf { 13 namespace { 14 15 using ::protobuf_test_messages::editions::proto2::TestAllTypesProto2; 16 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. TEST(Generated,Reflection)20TEST(Generated, Reflection) { 21 TestAllTypesProto2 message; 22 23 message.GetReflection()->SetInt32( 24 &message, message.GetDescriptor()->FindFieldByName("optional_int32"), 1); 25 EXPECT_EQ(message.optional_int32(), 1); 26 } 27 28 } // namespace 29 } // namespace protobuf 30 } // namespace google 31