Protocol Buffers - Google's data interchange format (grpc依赖)
https://developers.google.com/protocol-buffers/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
999 B
31 lines
999 B
1 year ago
|
// Protocol Buffers - Google's data interchange format
|
||
|
// Copyright 2023 Google Inc. All rights reserved.
|
||
|
//
|
||
1 year ago
|
// Use of this source code is governed by a BSD-style
|
||
|
// license that can be found in the LICENSE file or at
|
||
|
// https://developers.google.com/open-source/licenses/bsd
|
||
1 year ago
|
|
||
|
#include <gtest/gtest.h>
|
||
8 months ago
|
#include "editions/golden/test_messages_proto2_editions.pb.h"
|
||
1 year ago
|
|
||
|
namespace google {
|
||
|
namespace protobuf {
|
||
|
namespace {
|
||
|
|
||
1 year ago
|
using ::protobuf_test_messages::editions::proto2::TestAllTypesProto2;
|
||
1 year ago
|
|
||
|
// It's important that no calls that would initialize the generated pool occur
|
||
|
// in any tests in this file. This test guarantees that there's no mutex
|
||
|
// deadlock from lazily loading cpp_features.proto during reflection.
|
||
|
TEST(Generated, Reflection) {
|
||
|
TestAllTypesProto2 message;
|
||
|
|
||
|
message.GetReflection()->SetInt32(
|
||
|
&message, message.GetDescriptor()->FindFieldByName("optional_int32"), 1);
|
||
|
EXPECT_EQ(message.optional_int32(), 1);
|
||
|
}
|
||
|
|
||
|
} // namespace
|
||
|
} // namespace protobuf
|
||
|
} // namespace google
|