Go to the documentation of this file.
49 namespace atu = annotation_test_util;
63 CommandLineInterface cli;
64 CppGenerator cpp_generator;
65 cli.RegisterGenerator(
"--cpp_out", &cpp_generator,
"");
67 "--cpp_out=annotate_headers=true,"
68 "annotation_pragma_name=pragma_name,"
69 "annotation_guard_name=guard_name:" +
85 if (pb_h !=
NULL && pb_h_info !=
NULL) {
93 if (proto_h !=
NULL && proto_h_info !=
NULL) {
105 const char kSmallTestFile[] =
106 "syntax = \"proto2\";\n"
108 "enum Enum { VALUE = 0; }\n"
109 "message Message { }\n";
111 TEST_F(CppMetadataTest, CapturesEnumNames) {
117 CaptureMetadata(
"test.proto", &file, &pb_h, &info,
NULL,
NULL,
NULL));
119 std::vector<int> enum_path;
121 enum_path.push_back(0);
128 TEST_F(CppMetadataTest, AddsPragma) {
134 CaptureMetadata(
"test.proto", &file, &pb_h, &info,
NULL,
NULL,
NULL));
135 EXPECT_TRUE(pb_h.find(
"#ifdef guard_name") != string::npos);
136 EXPECT_TRUE(pb_h.find(
"#pragma pragma_name \"test.pb.h.meta\"") !=
140 TEST_F(CppMetadataTest, CapturesMessageNames) {
146 CaptureMetadata(
"test.proto", &file, &pb_h, &info,
NULL,
NULL,
NULL));
148 std::vector<int> message_path;
150 message_path.push_back(0);
std::string StripProto(const std::string &filename)
#define EXPECT_EQ(val1, val2)
void AddFile(const std::string &filename, const std::string &data)
GLsizei const GLchar *const * string
const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto & enum_type(int index) const
static bool GetContents(const string &name, string *output, bool)
#define EXPECT_TRUE(cond)
bool RunProtoCompiler(const std::string &filename, const std::string &plugin_specific_args, CommandLineInterface *cli, FileDescriptorProto *file)
const PROTOBUF_NAMESPACE_ID::DescriptorProto & message_type(int index) const
@ kMessageTypeFieldNumber
const GeneratedCodeInfo::Annotation * FindAnnotationOnPath(const GeneratedCodeInfo &info, const std::string &source_file, const std::vector< int > &path)
TEST_F(DynamicMessageTest, Descriptor)
#define GOOGLE_CHECK_OK(A)
bool DecodeMetadata(const std::string &path, GeneratedCodeInfo *info)
bool AnnotationMatchesSubstring(const std::string &file_content, const GeneratedCodeInfo::Annotation *annotation, const std::string &expected_text)
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:57