Lines Matching refs:proto
304 // // in "foo.proto"
310 // // in "bar.proto"
317 // Also, we have an empty file "baz.proto". This file's purpose is to
318 // make sure that even though it has the same package as foo.proto,
319 // searching it for members of foo.proto won't work.
322 foo_file.set_name("foo.proto");
331 bar_file.set_name("bar.proto");
333 bar_file.add_dependency("foo.proto");
342 baz_file.set_name("baz.proto");
397 EXPECT_EQ("foo.proto", foo_file_->name());
398 EXPECT_EQ("bar.proto", bar_file_->name());
399 EXPECT_EQ("baz.proto", baz_file_->name());
525 FileDescriptorProto proto;
526 proto.set_name("foo");
530 proto.set_syntax("proto2");
532 const FileDescriptor* file = pool.BuildFile(proto);
541 proto.set_syntax("proto3");
543 const FileDescriptor* file = pool.BuildFile(proto);
599 FileDescriptorProto proto;
600 ASSERT_TRUE(parser.Parse(&tokenizer, &proto))
604 proto.set_name(name);
605 const FileDescriptor* descriptor = pool.BuildFile(proto);
606 ASSERT_TRUE(descriptor != nullptr) << proto.DebugString();
619 // // in "foo.proto"
630 // // in "bar.proto"
638 // // in "map.proto"
643 // // in "json.proto"
664 foo_file.set_name("foo.proto");
682 bar_file.set_name("bar.proto");
694 map_file.set_name("map.proto");
710 json_file.set_name("json.proto");
771 void CopyWithJsonName(const Descriptor* message, DescriptorProto* proto) {
772 message->CopyTo(proto);
773 message->CopyJsonNameTo(proto);
914 DescriptorProto proto;
915 message4_->CopyTo(&proto);
916 ASSERT_EQ(6, proto.field_size());
917 EXPECT_FALSE(proto.field(0).has_json_name());
918 EXPECT_FALSE(proto.field(1).has_json_name());
919 EXPECT_FALSE(proto.field(2).has_json_name());
920 EXPECT_FALSE(proto.field(3).has_json_name());
921 EXPECT_FALSE(proto.field(4).has_json_name());
922 EXPECT_EQ("@type", proto.field(5).json_name());
924 proto.Clear();
925 CopyWithJsonName(message4_, &proto);
926 ASSERT_EQ(6, proto.field_size());
927 EXPECT_EQ("fieldName1", proto.field(0).json_name());
928 EXPECT_EQ("fieldName2", proto.field(1).json_name());
929 EXPECT_EQ("FieldName3", proto.field(2).json_name());
930 EXPECT_EQ("FieldName4", proto.field(3).json_name());
931 EXPECT_EQ("FIELDNAME5", proto.field(4).json_name());
932 EXPECT_EQ("@type", proto.field(5).json_name());
1074 baz_file.set_name("baz.proto");
1151 file.set_name("foo.proto");
1321 // // in "foo.proto"
1327 // // in "bar.proto"
1340 foo_file.set_name("foo.proto");
1348 bar_file.set_name("bar.proto");
1471 // // in "foo.proto"
1484 // // in "bar.proto"
1492 foo_file.set_name("foo.proto");
1506 bar_file.set_name("bar.proto");
1508 bar_file.add_dependency("foo.proto");
1633 // // in "foo.proto"
1641 // // in "bar.proto"
1658 foo_file.set_name("foo.proto");
1669 bar_file.set_name("bar.proto");
1863 foo_file.set_name("foo.proto");
2036 // Add "google/protobuf/descriptor.proto".
2039 // Add "foo.proto":
2040 // import "google/protobuf/descriptor.proto";
2045 file_proto.set_name("foo.proto");
2046 file_proto.add_dependency("google/protobuf/descriptor.proto");
2051 // Add "bar.proto":
2052 // import "google/protobuf/descriptor.proto";
2057 file_proto.set_name("bar.proto");
2058 file_proto.add_dependency("google/protobuf/descriptor.proto");
2081 foo_file.set_name("foo.proto");
2160 foo_file.set_name("foo.proto");
2283 file_proto.set_name("foo.proto");
2511 file_proto.set_name("foo.proto");
2633 file_proto.set_name("foo.proto");
2691 "name: 'foo.proto'"
2692 "dependency: 'bar.proto'"
2693 "dependency: 'baz.proto'"
2716 TextFormat::ParseFromString("name: 'bar.proto'"
2740 const FileDescriptor* BuildFile(const FileDescriptorProto& proto) {
2743 return pool_->BuildFile(proto);
2746 EXPECT_TRUE(db_.Add(proto));
2747 return pool_->FindFileByName(proto.name());
2772 EXPECT_EQ("baz.proto", baz_file->name());
2814 FieldDescriptorProto proto;
2817 bar_field_->CopyTo(&proto);
2818 EXPECT_EQ(".Bar", proto.type_name());
2819 EXPECT_EQ(FieldDescriptorProto::TYPE_MESSAGE, proto.type());
2822 proto.Clear();
2823 baz_field_->CopyTo(&proto);
2824 EXPECT_EQ("Baz", proto.type_name());
2825 EXPECT_FALSE(proto.has_type());
2828 proto.Clear();
2829 qux_field_->CopyTo(&proto);
2830 EXPECT_EQ(".corge.Qux", proto.type_name());
2831 EXPECT_EQ(FieldDescriptorProto::TYPE_ENUM, proto.type());
2850 "name: 'extension.proto'"
2869 // descriptor.proto.
2874 "name: \"unknown_custom_options.proto\" "
2875 "dependency: \"google/protobuf/descriptor.proto\" "
2922 // Crazy case: suppose foo.proto refers to a symbol without declaring the
2927 // then its descriptors must be rolled back. However, we still want foo.proto
2933 "name: \"invalid_file_as_undeclared_dep.proto\" "
2948 // test.proto below.
2961 "name: \"test.proto\" "
3144 // defining the option; we do not also have to import descriptor.proto.
3156 "name: \"custom_options_import.proto\" "
3158 "dependency: \"google/protobuf/unittest_custom_options.proto\" "
3215 // import "google/protobuf/unittest_custom_options.proto"
3223 "name: \"custom_options_import.proto\" "
3225 "dependency: \"google/protobuf/unittest_custom_options.proto\" "
3292 // import "google/protobuf/unittest_custom_options.proto"
3300 "name: \"custom_options_import.proto\" "
3302 "dependency: \"google/protobuf/unittest_custom_options.proto\" "
3372 // import "google/protobuf/unittest_custom_options.proto"
3380 "name: \"custom_options_import.proto\" "
3382 "dependency: \"google/protobuf/unittest_custom_options.proto\" "
3492 pool.AddUnusedImportTrackFile("custom_options_import.proto", true);
3494 "name: \"custom_options_import.proto\" "
3496 "dependency: \"google/protobuf/unittest_custom_options.proto\" ",
3502 "custom_options_import.proto: "
3503 "google/protobuf/unittest_custom_options.proto: IMPORT: Import "
3504 "google/protobuf/unittest_custom_options.proto is unused.\n",
3508 // Verifies that proto files can correctly be parsed, even if the
3518 // Create a new file descriptor proto containing a subset of the
3519 // messages defined in google/protobuf/unittest_custom_options.proto.
3521 file_proto.set_name("unittest_custom_options.proto");
3523 file_proto.add_dependency("google/protobuf/descriptor.proto");
3567 // Add "foo.proto":
3568 // import "google/protobuf/descriptor.proto";
3577 "name: \"foo.proto\" "
3579 "dependency: \"google/protobuf/descriptor.proto\" "
3600 // (.fileopt1) defined in unittest_custom_options.proto (linked
3624 "import \"google/protobuf/descriptor.proto\";\n"
3684 // Build descriptor.proto in our test pool. This allows us to extend it in
3695 "name: \"foo.proto\" "
3699 "foo.proto: Foo: NAME: \"Foo\" is already defined.\n");
3704 "name: \"foo.proto\" "
3709 "foo.proto: foo.bar.Foo: NAME: \"Foo\" is already defined in "
3715 "name: \"foo.proto\" "
3719 "name: \"bar.proto\" "
3722 "bar.proto: Foo: NAME: \"Foo\" is already defined in file "
3723 "\"foo.proto\".\n");
3728 "name: \"foo.proto\" "
3731 "name: \"bar.proto\" "
3734 "bar.proto: foo: NAME: \"foo\" is already defined (as something other "
3735 "than a package) in file \"foo.proto\".\n");
3740 "name: \"foo.proto\" "
3744 "foo.proto: FOO: NAME: \"FOO\" is already defined.\n"
3745 "foo.proto: FOO: NAME: Note that enum values use C++ scoping rules, "
3753 "name: \"foo.proto\" "
3758 "foo.proto: pkg.FOO: NAME: \"FOO\" is already defined in \"pkg\".\n"
3759 "foo.proto: pkg.FOO: NAME: Note that enum values use C++ scoping rules, "
3767 "name: \"foo.proto\" "
3770 "foo.proto: : NAME: Missing name.\n");
3775 "name: \"foo.proto\" "
3778 "foo.proto: $: NAME: \"$\" is not a valid identifier.\n");
3783 "name: \"foo.proto\" "
3786 "foo.proto: foo.$: NAME: \"$\" is not a valid identifier.\n");
3794 "name: \"bar.proto\" "
3801 STATIC_STR("bar.proto: foo.\0\x1\v.Bar: NAME: \"\0\x1\v.Bar\" is not a "
3802 "valid identifier.\nbar.proto: foo.\0\x1\v.Bar: NAME: "
3803 "\"\0\x1\v.Bar\" is not a valid identifier.\nbar.proto: "
3805 "identifier.\nbar.proto: foo.\0\x1\v.Bar: NAME: "
3806 "\"\0\x1\v.Bar\" is not a valid identifier.\nbar.proto: "
3808 "null character.\nbar.proto: foo.\0\x1\v.Bar: NAME: "
3814 "name: \"bar\\000\\001\\013.proto\" "
3816 STATIC_STR("bar\0\x1\v.proto: bar\0\x1\v.proto: NAME: "
3817 "\"bar\0\x1\v.proto\" contains null character.\n"));
3822 "name: \"bar.proto\" "
3824 STATIC_STR("bar.proto: \0\x1\v.: NAME: \"\0\x1\v.\" contains null "
3835 BuildFile("name: \"foo.proto\"");
3837 "name: \"bar.proto\" "
3838 "dependency: \"foo.proto\" "
3839 "dependency: \"foo.proto\" ",
3841 "bar.proto: foo.proto: IMPORT: Import \"foo.proto\" was listed twice.\n");
3846 "name: \"bar.proto\" "
3847 "dependency: \"foo.proto\" ",
3849 "bar.proto: foo.proto: IMPORT: Import \"foo.proto\" has not been "
3854 BuildFile("name: \"foo.proto\"");
3856 "name: \"bar.proto\" "
3857 "dependency: \"foo.proto\" "
3859 "bar.proto: bar.proto: OTHER: Invalid public dependency index.\n");
3869 "name: 'foo.proto' "
3872 "name: 'bar.proto' "
3873 "dependency: 'baz.proto' "
3880 "bar.proto: baz.proto: IMPORT: Import \"baz.proto\" has not been "
3882 "bar.proto: outer.bar.Bar.bar: TYPE: \"outer.foo\" seems to be defined "
3884 "\"foo.proto\", which is not imported by \"bar.proto\". To use it here, "
3890 "name: \"foo.proto\" "
3895 "name: \"foo.proto\" "
3901 "foo.proto: foo.proto: OTHER: A file with this name is already in the "
3907 "name: \"foo.proto\" "
3921 "foo.proto: Foo.bar: NUMBER: Extension range 10 to 19 includes field "
3923 "foo.proto: Foo.baz: NUMBER: Extension range 10 to 19 includes field "
3929 "name: \"foo.proto\" "
3937 "foo.proto: Foo: NUMBER: Extension range 19 to 20 overlaps with "
3939 "foo.proto: Foo: NUMBER: Extension range 19 to 20 overlaps with "
3945 "name: \"foo.proto\" "
3953 "foo.proto: Foo.foo: NUMBER: Field \"foo\" uses reserved number 15.\n");
3958 "name: \"foo.proto\" "
3965 "foo.proto: Foo: NUMBER: Extension range 10 to 19"
3971 "name: \"foo.proto\" "
3981 "name: \"foo.proto\" "
3988 "foo.proto: Foo: NUMBER: Reserved range 5 to 14"
3994 "name: \"foo.proto\" "
4007 "foo.proto: Foo.foo: NAME: Field name \"foo\" is reserved.\n"
4008 "foo.proto: Foo.bar: NAME: Field name \"bar\" is reserved.\n");
4013 "name: \"foo.proto\" "
4020 "foo.proto: foo: NAME: Field name \"foo\" is reserved multiple times.\n");
4025 "name: \"foo.proto\" "
4045 "name: \"foo.proto\" "
4071 "name: \"foo.proto\" "
4078 "foo.proto: BAR: NUMBER: Enum value \"BAR\" uses reserved number 15.\n");
4083 "name: \"foo.proto\" "
4090 "foo.proto: BAR: NUMBER: Enum value \"BAR\" uses reserved number -15.\n");
4095 "name: \"foo.proto\" "
4103 "foo.proto: Foo: NUMBER: Reserved range 5 to 15"
4109 "name: \"foo.proto\" "
4117 "foo.proto: Foo: NUMBER: Reserved range 5 to 10"
4123 "name: \"foo.proto\" "
4131 "foo.proto: Foo: NUMBER: Reserved range -15 to -5"
4137 "name: \"foo.proto\" "
4145 "foo.proto: Foo: NUMBER: Reserved range -15 to 5"
4151 "name: \"foo.proto\" "
4159 "foo.proto: Foo: NUMBER: Reserved range 10 to 10"
4165 "name: \"foo.proto\" "
4172 "foo.proto: Foo: NUMBER: Reserved range end number must be greater"
4178 "name: \"foo.proto\" "
4187 "foo.proto: FOO: NAME: Enum value \"FOO\" is reserved.\n"
4188 "foo.proto: BAR: NAME: Enum value \"BAR\" is reserved.\n");
4193 "name: \"foo.proto\" "
4201 "foo.proto: foo: NAME: Enum value \"foo\" is reserved multiple times.\n");
4206 "name: \"foo.proto\" "
4231 "name: \"foo.proto\" "
4263 "foo.proto: Foo.foo: DEFAULT_VALUE: Couldn't parse default value "
4265 "foo.proto: Foo.bar: DEFAULT_VALUE: Couldn't parse default value \"\".\n"
4266 "foo.proto: Foo.baz: DEFAULT_VALUE: Boolean default must be true or "
4268 "foo.proto: Foo.qux: DEFAULT_VALUE: Messages can't have default values.\n"
4269 "foo.proto: Foo.corge: DEFAULT_VALUE: Repeated fields can't have default "
4273 "foo.proto: Foo.quux: DEFAULT_VALUE: Messages can't have default "
4279 "name: \"foo.proto\" "
4286 "foo.proto: Foo.foo: NUMBER: Field numbers must be positive integers.\n");
4291 "name: \"foo.proto\" "
4298 "foo.proto: Foo.foo: NUMBER: Field numbers cannot be greater than "
4304 "name: \"foo.proto\" "
4317 "foo.proto: Foo.bar: NUMBER: Field numbers 19000 through 19999 are "
4319 "foo.proto: Foo.baz: NUMBER: Field numbers 19000 through 19999 are "
4325 "name: \"foo.proto\" "
4332 "foo.proto: Foo.foo: EXTENDEE: FieldDescriptorProto.extendee not set for "
4338 "name: \"foo.proto\" "
4349 "foo.proto: Foo.foo: EXTENDEE: FieldDescriptorProto.extendee set for "
4355 "name: \"foo.proto\" "
4365 "foo.proto: Foo.foo: TYPE: FieldDescriptorProto.oneof_index 1 is out of "
4371 "name: \"foo.proto\" "
4381 "foo.proto: Foo.foo: TYPE: FieldDescriptorProto.oneof_index -1 is out "
4389 "name: \"foo.proto\" "
4400 "foo.proto: Foo.bar: TYPE: Fields in the same oneof must be defined "
4406 "name: \"foo2.proto\" "
4420 "foo2.proto: Foo2.bar1: TYPE: Fields in the same oneof must be defined "
4423 "foo2.proto: Foo2.foo2: TYPE: Fields in the same oneof must be defined "
4429 "name: \"foo3.proto\" "
4442 "foo3.proto: Foo3.baz: TYPE: Fields in the same oneof must be defined "
4449 "name: \"foo.proto\" "
4456 "foo.proto: Foo.bar: NUMBER: Field number 1 has already been used in "
4462 "name: \"foo.proto\" "
4474 "foo.proto: Foo.foo: TYPE: Extensions of MessageSets must be optional "
4480 "name: \"foo.proto\" "
4493 "foo.proto: Foo.foo: TYPE: Extensions of MessageSets must be optional "
4499 "name: \"foo.proto\" "
4506 "foo.proto: Foo.foo: NAME: MessageSets cannot have fields, only "
4512 "name: \"foo.proto\" "
4518 "foo.proto: Foo: NUMBER: Extension numbers must be positive integers.\n");
4523 "name: \"foo.proto\" "
4529 "foo.proto: Foo: NUMBER: Extension numbers cannot be greater than "
4535 "name: \"foo.proto\" "
4542 "foo.proto: Foo: NUMBER: Extension range end number must be greater than "
4544 "foo.proto: Foo: NUMBER: Extension range end number must be greater than "
4550 "name: \"foo.proto\" "
4564 "foo.proto: Foo: NAME: Enums must contain at least one value.\n"
4565 "foo.proto: Bar.bar: DEFAULT_VALUE: Enum type \"Foo\" has no value named "
4571 "name: \"foo.proto\" "
4578 "foo.proto: Foo.foo: EXTENDEE: \"Bar\" is not defined.\n");
4583 "name: \"foo.proto\" "
4591 "foo.proto: Foo.foo: EXTENDEE: \"Bar\" is not a message type.\n");
4596 "name: \"foo.proto\" "
4606 "foo.proto: Foo.foo: NUMBER: \"Bar\" does not declare 1 as an extension "
4612 "name: \"foo.proto\" "
4628 "foo.proto: Foo.foo: TYPE: The extension Foo.foo cannot be required.\n");
4633 "name: \"foo.proto\" "
4639 "foo.proto: Foo.foo: TYPE: \"Bar\" is not defined.\n");
4648 "name: \"foo.proto\" "
4655 "foo.proto: Foo.foo: TYPE: \"int\" is not defined.\n");
4660 "name: \"foo.proto\" "
4669 "foo.proto: Foo.foo: TYPE: \"Foo.Baz.Bar\" is not defined.\n");
4674 "name: \"bar.proto\" "
4678 "name: \"foo.proto\" "
4683 "foo.proto: Foo.foo: TYPE: \"Bar\" seems to be defined in \"bar.proto\", "
4684 "which is not imported by \"foo.proto\". To use it here, please add the "
4691 // // bar.proto
4694 // // forward.proto
4695 // import "bar.proto"
4697 // // foo.proto
4698 // import "forward.proto"
4700 // optional Bar foo = 1; // Error, needs to import bar.proto explicitly.
4704 "name: \"bar.proto\" "
4708 "name: \"forward.proto\""
4709 "dependency: \"bar.proto\"");
4712 "name: \"foo.proto\" "
4713 "dependency: \"forward.proto\" "
4718 "foo.proto: Foo.foo: TYPE: \"Bar\" seems to be defined in \"bar.proto\", "
4719 "which is not imported by \"foo.proto\". To use it here, please add the "
4726 // // bar.proto
4729 // // forward.proto
4730 // import public "bar.proto"
4732 // // foo.proto
4733 // import "forward.proto"
4735 // optional Bar foo = 1; // Correct. "bar.proto" is public imported into
4736 // // forward.proto, so when "foo.proto" imports
4737 // // "forward.proto", it imports "bar.proto" too.
4741 "name: \"bar.proto\" "
4745 "name: \"forward.proto\""
4746 "dependency: \"bar.proto\" "
4750 "name: \"foo.proto\" "
4751 "dependency: \"forward.proto\" "
4761 // // bar.proto
4764 // // forward.proto
4765 // import public "bar.proto"
4767 // // forward2.proto
4768 // import public "forward.proto"
4770 // // foo.proto
4771 // import "forward2.proto"
4777 "name: \"bar.proto\" "
4781 "name: \"forward.proto\""
4782 "dependency: \"bar.proto\" "
4786 "name: \"forward2.proto\""
4787 "dependency: \"forward.proto\" "
4791 "name: \"foo.proto\" "
4792 "dependency: \"forward2.proto\" "
4803 // // bar.proto
4806 // // forward.proto
4807 // import "bar.proto"
4809 // // forward2.proto
4810 // import public "forward.proto"
4812 // // foo.proto
4813 // import "forward2.proto"
4815 // optional Bar foo = 1; // Error, the "bar.proto" is not public imported
4816 // // into "forward.proto", so will not be imported
4817 // // into either "forward2.proto" or "foo.proto".
4821 "name: \"bar.proto\" "
4825 "name: \"forward.proto\""
4826 "dependency: \"bar.proto\"");
4829 "name: \"forward2.proto\""
4830 "dependency: \"forward.proto\" "
4834 "name: \"foo.proto\" "
4835 "dependency: \"forward2.proto\" "
4840 "foo.proto: Foo.foo: TYPE: \"Bar\" seems to be defined in \"bar.proto\", "
4841 "which is not imported by \"foo.proto\". To use it here, please add the "
4862 "name: \"foo.proto\" "
4874 "foo.proto: Foo.baz: TYPE: \"Bar.Baz\" is resolved to \"Foo.Bar.Baz\","
4885 "name: \"foo.proto\" "
4901 // foo.proto:
4903 // bar.proto:
4905 // import "foo.proto";
4907 // baz.proto:
4909 // import "bar.proto"
4912 // When validating baz.proto, we will look up "bar.Bar". As part of this
4915 // defined in foo.proto, which is not a direct dependency of baz.proto. The
4921 "name: \"foo.proto\" "
4924 "name: \"bar.proto\" "
4926 "dependency: \"foo.proto\" "
4929 "name: \"baz.proto\" "
4931 "dependency: \"bar.proto\" "
4941 "name: \"foo.proto\" "
4949 "foo.proto: Foo.foo: TYPE: \".Foo.bar\" is not a type.\n");
4954 "name: \"foo.proto\" "
4964 "foo.proto: Foo.foo: TYPE: \"Bar.Baz\" is not a type.\n");
4969 "name: \"foo.proto\" "
4981 "name: \"foo.proto\" "
4989 "foo.proto: Foo.foo: TYPE: \"Bar\" is not an enum type.\n");
4994 "name: \"foo.proto\" "
5002 "foo.proto: Foo.foo: TYPE: \"Bar\" is not a message type.\n");
5007 "name: \"foo.proto\" "
5015 "foo.proto: Foo.foo: DEFAULT_VALUE: Enum type \"Bar\" has no value named "
5021 "name: \"foo.proto\" "
5029 "foo.proto: Foo.foo: DEFAULT_VALUE: Default value for an enum field must "
5035 "name: \"foo.proto\" "
5042 "foo.proto: Foo.foo: TYPE: Field with primitive type has type_name.\n");
5047 "name: \"foo.proto\" "
5053 "foo.proto: Foo.foo: TYPE: Field with message or enum type missing "
5059 "name: \"foo.proto\" "
5065 "foo.proto: Foo.bar: NAME: Oneof must have at least one field.\n");
5070 "name: \"foo.proto\" "
5078 "foo.proto: Foo.foo: NAME: Fields of oneofs must themselves have label "
5084 "name: \"foo.proto\" "
5091 "foo.proto: TestService.A: INPUT_TYPE: \"Bar\" is not defined.\n"
5097 "name: \"foo.proto\" "
5105 "foo.proto: TestService.A: INPUT_TYPE: \"Bar\" is not a message type.\n"
5111 "name: \"foo.proto\" "
5118 "foo.proto: TestService.A: OUTPUT_TYPE: \"Bar\" is not defined.\n"
5124 "name: \"foo.proto\" "
5132 "foo.proto: TestService.A: OUTPUT_TYPE: \"Bar\" is not a message type.\n"
5139 "name: \"foo.proto\" "
5159 "foo.proto: Foo.packed_string: TYPE: [packed = true] can only be "
5161 "foo.proto: Foo.packed_message: TYPE: [packed = true] can only be "
5163 "foo.proto: Foo.optional_int32: TYPE: [packed = true] can only be "
5169 "name: \"foo.proto\" "
5180 "foo.proto: TestMessage.foo: OPTION_VALUE: Value must be identifier for "
5186 "name: \"foo.proto\" "
5199 "foo.proto: TestMessage.foo: OPTION_NAME: Option \"ctype\" is an "
5205 "name: \"foo.proto\" "
5219 "foo.proto: TestMessage.foo: OPTION_NAME: Option \"ctype\" was "
5225 "name: \"foo.proto\" "
5238 "foo.proto: TestMessage.foo: OPTION_NAME: Option must not use "
5246 "name: \"foo.proto\" "
5247 "dependency: \"google/protobuf/descriptor.proto\" "
5260 "foo.proto: foo.proto: OPTION_NAME: Option field \"(bar)\" is a "
5268 // foo.proto:
5270 // import google/protobuf/descriptor.proto
5274 // qux.proto:
5284 "name: \"foo.proto\" "
5286 "dependency: \"google/protobuf/descriptor.proto\" "
5295 "name: \"qux.proto\" "
5303 "qux.proto: qux.proto: OPTION_NAME: Option \"(baz.bar)\" is resolved to "
5312 "name: \"qux.proto\" "
5320 "qux.proto: qux.proto: OPTION_NAME: Option \"(baaz.bar)\" unknown. "
5322 "that your proto definition file imports the proto which defines the "
5330 "name: \"foo.proto\" "
5331 "dependency: \"google/protobuf/descriptor.proto\" "
5337 "foo.proto: foo2: NUMBER: Extension number 7672757 has already been used "
5345 "name: \"foo.proto\" "
5346 "dependency: \"google/protobuf/descriptor.proto\" "
5354 "foo.proto: foo.proto: OPTION_VALUE: Value out of range "
5362 "name: \"foo.proto\" "
5363 "dependency: \"google/protobuf/descriptor.proto\" "
5371 "foo.proto: foo.proto: OPTION_VALUE: Value out of range "
5379 "name: \"foo.proto\" "
5380 "dependency: \"google/protobuf/descriptor.proto\" "
5387 "foo.proto: foo.proto: OPTION_VALUE: Value must be integer "
5395 "name: \"foo.proto\" "
5396 "dependency: \"google/protobuf/descriptor.proto\" "
5405 "foo.proto: foo.proto: OPTION_VALUE: Value out of range "
5413 "name: \"foo.proto\" "
5414 "dependency: \"google/protobuf/descriptor.proto\" "
5421 "foo.proto: foo.proto: OPTION_VALUE: Value must be integer "
5429 "name: \"foo.proto\" "
5430 "dependency: \"google/protobuf/descriptor.proto\" "
5437 "foo.proto: foo.proto: OPTION_VALUE: Value out of range "
5445 "name: \"foo.proto\" "
5446 "dependency: \"google/protobuf/descriptor.proto\" "
5453 "foo.proto: foo.proto: OPTION_VALUE: Value must be non-negative integer "
5461 "name: \"foo.proto\" "
5462 "dependency: \"google/protobuf/descriptor.proto\" "
5469 "foo.proto: foo.proto: OPTION_VALUE: Value must be non-negative integer "
5477 "name: \"foo.proto\" "
5478 "dependency: \"google/protobuf/descriptor.proto\" "
5485 "foo.proto: foo.proto: OPTION_VALUE: Value must be number "
5493 "name: \"foo.proto\" "
5494 "dependency: \"google/protobuf/descriptor.proto\" "
5501 "foo.proto: foo.proto: OPTION_VALUE: Value must be number "
5509 "name: \"foo.proto\" "
5510 "dependency: \"google/protobuf/descriptor.proto\" "
5517 "foo.proto: foo.proto: OPTION_VALUE: Value must be \"true\" or \"false\" "
5525 "name: \"foo.proto\" "
5526 "dependency: \"google/protobuf/descriptor.proto\" "
5536 "foo.proto: foo.proto: OPTION_VALUE: Value must be identifier for "
5544 "name: \"foo.proto\" "
5545 "dependency: \"google/protobuf/descriptor.proto\" "
5555 "foo.proto: foo.proto: OPTION_VALUE: Enum type \"FooEnum\" has no value "
5563 "name: \"foo.proto\" "
5564 "dependency: \"google/protobuf/descriptor.proto\" "
5576 "foo.proto: foo.proto: OPTION_VALUE: Enum type \"FooEnum1\" has no value "
5585 "name: \"foo.proto\" "
5586 "dependency: \"google/protobuf/descriptor.proto\" "
5593 "foo.proto: foo.proto: OPTION_VALUE: Value must be quoted string "
5600 "name: \"foo.proto\" "
5614 "foo.proto: foo.value: OPTION_NAME: option json_name is not allowed on "
5622 "name: \"foo.proto\" "
5623 "dependency: \"google/protobuf/descriptor.proto\" "
5628 "name: \"bar.proto\" "
5629 "dependency: \"google/protobuf/descriptor.proto\" "
5632 "bar.proto: option2: NUMBER: Extension number 1000 has already been used "
5634 "foo.proto.\n");
5642 "name: \"foo.proto\" "
5643 "dependency: \"google/protobuf/descriptor.proto\" "
5659 "foo.proto: foo.proto: OPTION_VALUE: Option \"foo\" is a message. "
5661 "\"foo = { <proto text format> }\". To set fields within it, use "
5670 "foo.proto: foo.proto: OPTION_VALUE: Error while parsing option "
5679 "foo.proto: foo.proto: OPTION_VALUE: Error while parsing option "
5685 "name: \"bar.proto\" "
5689 "name: \"foo.proto\" "
5690 "dependency: \"bar.proto\" ",
5692 "foo.proto: bar.proto: IMPORT: Files that do not use optimize_for = "
5694 "is not lite, but it imports \"bar.proto\" which is.\n");
5699 "name: \"bar.proto\" "
5706 "name: \"foo.proto\" "
5707 "dependency: \"bar.proto\" "
5712 "foo.proto: ext: EXTENDEE: Extensions to non-lite types can only be "
5719 "name: \"foo.proto\" "
5727 "foo.proto: Foo: NAME: Files with optimize_for = LITE_RUNTIME cannot "
5732 "name: \"bar.proto\" "
5747 "name: \"foo.proto\" "
5765 "foo.proto: TestService.Baz: INPUT_TYPE: \"NoSuchType\" is not defined.\n"
5773 "name: \"foo.proto\" "
5796 TextFormat::ParseFromString("name: \"foo.proto\" "
5811 EXPECT_EQ("Invalid proto descriptor for file \"foo.proto\":", errors[0]);
5817 "name: \"foo.proto\" "
5823 "foo.proto: Bar: NUMBER: "
5831 "name: \"foo.proto\" "
5841 pool_.AddUnusedImportTrackFile("bar.proto");
5843 "name: \"bar.proto\" "
5846 pool_.AddUnusedImportTrackFile("base.proto");
5848 "name: \"base.proto\" "
5851 pool_.AddUnusedImportTrackFile("baz.proto");
5853 "name: \"baz.proto\" "
5856 pool_.AddUnusedImportTrackFile("public.proto");
5858 "name: \"public.proto\" "
5859 "dependency: \"bar.proto\""
5862 // // forward.proto
5863 // import "base.proto" // No warning: Base message is used.
5864 // import "bar.proto" // Will log a warning.
5865 // import public "baz.proto" // No warning: Do not track import public.
5866 // import "public.proto" // No warning: public.proto has import public.
5871 pool_.AddUnusedImportTrackFile("forward.proto");
5873 "name: \"forward.proto\""
5874 "dependency: \"base.proto\""
5875 "dependency: \"bar.proto\""
5876 "dependency: \"baz.proto\""
5877 "dependency: \"public.proto\""
5884 "forward.proto: bar.proto: IMPORT: Import bar.proto is unused.\n");
5890 "name: 'foo.proto' "
5915 "foo.proto: Foo.foo_map: TYPE: map_entry should not be set explicitly. "
5918 "foo.proto: Foo.foo_map: TYPE: Key in map fields cannot be float/double, "
6120 "foo.proto: Foo.foo_map: TYPE: Key in map fields cannot "
6127 "foo.proto: Foo.foo_map: TYPE: Key in map fields cannot "
6155 "foo.proto: Foo.FooMapEntry: NAME: \"FooMapEntry\" is already defined in "
6157 "foo.proto: Foo.foo_map: TYPE: \"FooMapEntry\" is not defined.\n"
6158 "foo.proto: Foo: NAME: Expanded map entry type FooMapEntry conflicts "
6172 "foo.proto: Foo.FooMapEntry: NAME: \"FooMapEntry\" is already defined in "
6174 "foo.proto: Foo: NAME: Expanded map entry type FooMapEntry conflicts "
6189 "foo.proto: Foo.FooMapEntry: NAME: \"FooMapEntry\" is already defined in "
6191 "foo.proto: Foo: NAME: Expanded map entry type FooMapEntry conflicts "
6198 "name: 'foo.proto' "
6204 "foo.proto: bar: NAME: Enum name bar has the same name as BAR "
6213 "name: 'foo.proto' "
6226 "name: 'foo.proto' "
6232 "foo.proto: BAZ: NAME: Enum name BAZ has the same name as FOO_ENUM_BAZ "
6240 "name: 'foo.proto' "
6246 "foo.proto: BAZ: NAME: Enum name BAZ has the same name as FOOENUM_BAZ "
6254 "name: 'foo.proto' "
6260 "foo.proto: BAR__BAZ: NAME: Enum name BAR__BAZ has the same name as "
6268 "name: 'foo.proto' "
6274 "foo.proto: BAR_BAZ: NAME: Enum name BAR_BAZ has the same name as "
6284 "name: 'foo.proto' "
6309 "foo.proto: Foo.FooMapEntry: NAME: \"FooMapEntry\" is already defined in "
6311 "foo.proto: Foo.foo_map: TYPE: \"FooMapEntry\" is not defined.\n"
6312 "foo.proto: Foo: NAME: Expanded map entry type FooMapEntry conflicts "
6318 "name: \"foo.proto\" "
6341 "foo.proto: Foo.foo_map: "
6347 "name: 'foo.proto' "
6353 "foo.proto: Foo.foo: TYPE: Required fields are not allowed in "
6358 "name: 'foo.proto' "
6367 "foo.proto: Foo.Bar.bar: TYPE: Required fields are not allowed in "
6372 "name: 'foo.proto' "
6383 "name: 'foo.proto' "
6390 "foo.proto: Foo.foo: DEFAULT_VALUE: Explicit default values are not "
6394 "name: 'foo.proto' "
6404 "foo.proto: Foo.Bar.bar: DEFAULT_VALUE: Explicit default values are not "
6410 "name: 'foo.proto' "
6417 "foo.proto: Foo: NUMBER: Extension ranges are not allowed in "
6421 "name: 'foo.proto' "
6431 "foo.proto: Foo.Bar: NUMBER: Extension ranges are not allowed in "
6437 "name: 'foo.proto' "
6443 "foo.proto: Foo: NAME: MessageSet is not supported "
6449 "name: 'foo.proto' "
6455 "foo.proto: FooEnum: NUMBER: The first enum value must be "
6459 "name: 'foo.proto' "
6468 "foo.proto: Foo.FooEnum: NUMBER: The first enum value must be "
6473 "name: 'foo.proto' "
6483 "name: 'foo.proto' "
6493 "foo.proto: Foo.foo_group: TYPE: Groups are not supported in proto3 "
6501 "name: 'foo.proto' "
6512 "name: 'bar.proto' "
6513 "dependency: 'foo.proto' "
6520 "bar.proto: Foo.bar: TYPE: Enum type \"foo.FooEnum\" is not a proto3 "
6528 // Add "google/protobuf/descriptor.proto".
6531 // Add "foo.proto":
6532 // import "google/protobuf/descriptor.proto";
6537 file_proto.set_name("foo.proto");
6539 file_proto.add_dependency("google/protobuf/descriptor.proto");
6545 // Copy and change the package of the descriptor.proto
6547 "name: 'google.protobuf.proto' "
6553 "name: 'bar.proto' "
6555 "dependency: 'google.protobuf.proto' "
6560 "bar.proto: bar: EXTENDEE: Extensions in proto3 are only allowed for "
6568 "name: 'foo.proto' "
6575 "foo.proto: Foo: NAME: The JSON camel-case name of field \"Name\" "
6579 "name: 'foo.proto' "
6586 "foo.proto: Foo: NAME: The JSON camel-case name of field \"_a__b_\" "
6593 "name: 'bar.proto' "
6598 pool_.AddUnusedImportTrackFile("foo.proto", true);
6600 "name: 'foo.proto' "
6601 "dependency: 'bar.proto' "
6609 "foo.proto: Foo.foo: EXTENDEE: \"Baz\" is not defined.\n");
6632 "name: 'foo.proto' "
6637 "name: 'bar.proto' "
6638 "dependency: 'foo.proto' "
6645 "name: 'baz.proto' "
6662 // error.proto and error2.proto cyclically import each other.
6663 if (filename == "error.proto") {
6665 output->set_name("error.proto");
6666 output->add_dependency("error2.proto");
6668 } else if (filename == "error2.proto") {
6670 output->set_name("error2.proto");
6671 output->add_dependency("error.proto");
6724 // A DescriptorDatabase which falsely always returns foo.proto when searching
6726 // DescriptorPool to reload foo.proto if it is already loaded.
6742 return FindFileByName("foo.proto", output);
6747 return FindFileByName("foo.proto", output);
6755 const FileDescriptor* foo = pool.FindFileByName("foo.proto");
6757 EXPECT_EQ("foo.proto", foo->name());
6761 EXPECT_EQ(foo, pool.FindFileByName("foo.proto"));
6763 EXPECT_TRUE(pool.FindFileByName("no_such_file.proto") == nullptr);
6769 const FileDescriptor* foo = pool.FindFileByName("foo.proto");
6771 EXPECT_EQ("foo.proto", foo->name());
6775 const FileDescriptor* bar = pool.FindFileByName("bar.proto");
6777 EXPECT_EQ("bar.proto", bar->name());
6788 const FileDescriptor* bar = pool.FindFileByName("bar.proto");
6790 EXPECT_EQ("bar.proto", bar->name());
6794 const FileDescriptor* foo = pool.FindFileByName("foo.proto");
6796 EXPECT_EQ("foo.proto", foo->name());
6809 EXPECT_EQ("foo.proto", file->name());
6810 EXPECT_EQ(file, pool.FindFileByName("foo.proto"));
6821 EXPECT_EQ(type->file(), pool.FindFileByName("foo.proto"));
6835 EXPECT_EQ(extension->file(), pool.FindFileByName("bar.proto"));
6863 EXPECT_TRUE(pool.FindFileByName("error.proto") == nullptr);
6875 EXPECT_TRUE(pool.FindFileByName("error.proto") == nullptr);
6877 "error.proto: error2.proto: IMPORT: File recursively imports itself: "
6878 "error.proto -> error2.proto -> error.proto\n"
6879 "error2.proto: error.proto: IMPORT: Import \"error.proto\" was not "
6881 "error.proto: error2.proto: IMPORT: Import \"error2.proto\" was not "
6893 "baz.proto: Baz.foo: TYPE: \"Foo\" seems to be defined in \"foo.proto\", "
6894 "which is not imported by \"baz.proto\". To use it here, please add "
6909 EXPECT_TRUE(pool.FindFileByName("baz.proto") == nullptr);
6914 // Try to load all of unittest.proto from a DescriptorDatabase. This should
6947 const FileDescriptor* file = pool.FindFileByName("foo.proto");
6993 // First make sure foo.proto is loaded.
7001 // No errors should have been reported. (If foo.proto was incorrectly
7008 // fileN.proto, which defines a message MessageN, which contains fields of
7010 // (file0.proto exists, but is empty), so every other file and message type
7024 FullMatch(filename, "file", ".proto", &file_num);
7063 output->set_name(strings::Substitute("file$0.proto", file_num));
7064 // file0.proto doesn't define Message0
7069 output->add_dependency(strings::Substitute("file$0.proto", i));
7088 EXPECT_TRUE(pool.FindFileByName("file40.proto") == nullptr);
7099 const FileDescriptor* file = pool.FindFileByName("foo.proto");
7205 "import \"google/protobuf/descriptor.proto\";\n"
7237 : source_tree_("/test/test.proto", kSourceLocationTestInput),
7242 // we need descriptor.proto to be accessible by the pool
7258 SimpleDescriptorDatabase simple_db_; // contains descriptor.proto
7259 compiler::SourceTreeDescriptorDatabase source_tree_db_; // loads test.proto
7278 GOOGLE_CHECK_NOTNULL(pool_.FindFileByName("/test/test.proto"));
7310 GOOGLE_CHECK_NOTNULL(pool_.FindFileByName("/test/test.proto"));
7337 GOOGLE_CHECK_NOTNULL(pool_.FindFileByName("/test/test.proto"));
7700 GOOGLE_CHECK_NOTNULL(pool_.FindFileByName("/test/test.proto"));
7702 FileDescriptorProto proto;
7703 file_desc->CopyTo(&proto); // Note, this discards the SourceCodeInfo.
7704 EXPECT_FALSE(proto.has_source_code_info());
7708 GOOGLE_CHECK_NOTNULL(bad1_pool.BuildFile(proto));
7718 GOOGLE_CHECK_NOTNULL(pool_.FindFileByName("/test/test.proto"));
7720 FileDescriptorProto proto;
7721 file_desc->CopyTo(&proto); // Note, this discards the SourceCodeInfo.
7722 EXPECT_FALSE(proto.has_source_code_info());
7724 proto.mutable_source_code_info()->add_location();
7734 GOOGLE_CHECK_NOTNULL(bad2_pool.BuildFile(proto));
7750 : source_tree_("/test/test.proto", kCopySourceCodeInfoToTestInput),
7765 GOOGLE_CHECK_NOTNULL(pool_.FindFileByName("/test/test.proto"));
7775 GOOGLE_CHECK_NOTNULL(pool_.FindFileByName("/test/test.proto"));
7801 void ParseProtoAndAddToDb(const char* proto) {
7803 ASSERT_TRUE(TextFormat::ParseFromString(proto, &tmp));
7807 void ParseProtoAndAddToDb(const std::string& proto) {
7809 ASSERT_TRUE(TextFormat::ParseFromString(proto, &tmp));
7816 ".proto' "
7831 ".proto' "
7850 "name: 'foo.proto' "
7852 "dependency: 'bar.proto' "
7861 EXPECT_FALSE(pool_.InternalIsFileLoaded("foo.proto"));
7862 EXPECT_FALSE(pool_.InternalIsFileLoaded("bar.proto"));
7864 const FileDescriptor* file = pool_.FindFileByName("foo.proto");
7866 // Verify only foo gets built when asking for foo.proto
7868 EXPECT_TRUE(pool_.InternalIsFileLoaded("foo.proto"));
7869 EXPECT_FALSE(pool_.InternalIsFileLoaded("bar.proto"));
7880 EXPECT_FALSE(pool_.InternalIsFileLoaded("bar.proto"));
7885 EXPECT_TRUE(pool_.InternalIsFileLoaded("bar.proto"));
7890 "name: 'foo.proto' "
7892 "dependency: 'enum1.proto' "
7893 "dependency: 'enum2.proto' "
7904 const FileDescriptor* file = pool_.FindFileByName("foo.proto");
7908 EXPECT_FALSE(pool_.InternalIsFileLoaded("enum1.proto"));
7914 EXPECT_TRUE(pool_.InternalIsFileLoaded("enum1.proto"));
7918 EXPECT_FALSE(pool_.InternalIsFileLoaded("enum2.proto"));
7922 EXPECT_TRUE(pool_.InternalIsFileLoaded("enum2.proto"));
7927 "name: 'foo.proto' "
7929 "dependency: 'message1.proto' "
7930 "dependency: 'message2.proto' "
7931 "dependency: 'enum1.proto' "
7932 "dependency: 'enum2.proto' "
7949 const FileDescriptor* file = pool_.FindFileByName("foo.proto");
7953 EXPECT_FALSE(pool_.InternalIsFileLoaded("message1.proto"));
7959 EXPECT_TRUE(pool_.InternalIsFileLoaded("message1.proto"));
7963 EXPECT_FALSE(pool_.InternalIsFileLoaded("message2.proto"));
7967 EXPECT_TRUE(pool_.InternalIsFileLoaded("message2.proto"));
7971 EXPECT_FALSE(pool_.InternalIsFileLoaded("enum1.proto"));
7975 EXPECT_TRUE(pool_.InternalIsFileLoaded("enum1.proto"));
7979 EXPECT_FALSE(pool_.InternalIsFileLoaded("enum2.proto"));
7983 EXPECT_TRUE(pool_.InternalIsFileLoaded("enum2.proto"));
7988 "name: 'foo.proto' "
7990 "dependency: 'bar.proto' "
7991 "dependency: 'baz.proto' "
7995 "name: 'bar.proto' "
8004 EXPECT_FALSE(pool_.InternalIsFileLoaded("foo.proto"));
8005 EXPECT_FALSE(pool_.InternalIsFileLoaded("bar.proto"));
8006 EXPECT_FALSE(pool_.InternalIsFileLoaded("baz.proto"));
8008 const FileDescriptor* file = pool_.FindFileByName("foo.proto");
8010 // Verify foo.bar gets loaded, and bar.proto gets loaded
8011 // to register the extension. baz.proto should not get loaded.
8013 EXPECT_TRUE(pool_.InternalIsFileLoaded("foo.proto"));
8014 EXPECT_TRUE(pool_.InternalIsFileLoaded("bar.proto"));
8015 EXPECT_FALSE(pool_.InternalIsFileLoaded("baz.proto"));
8020 "name: 'foo.proto' "
8022 "dependency: 'message1.proto' "
8023 "dependency: 'message2.proto' "
8024 "dependency: 'message3.proto' "
8025 "dependency: 'message4.proto' "
8036 const FileDescriptor* file = pool_.FindFileByName("foo.proto");
8044 EXPECT_FALSE(pool_.InternalIsFileLoaded("message1.proto"));
8045 EXPECT_FALSE(pool_.InternalIsFileLoaded("message2.proto"));
8048 EXPECT_TRUE(pool_.InternalIsFileLoaded("message1.proto"));
8049 EXPECT_FALSE(pool_.InternalIsFileLoaded("message2.proto"));
8051 EXPECT_TRUE(pool_.InternalIsFileLoaded("message2.proto"));
8063 "google/protobuf/unittest_lazy_dependencies.proto"));
8065 "google/protobuf/unittest_lazy_dependencies_custom_option.proto"));
8067 "google/protobuf/unittest_lazy_dependencies_enum.proto"));
8077 "google/protobuf/unittest_lazy_dependencies.proto"));
8079 "google/protobuf/unittest_lazy_dependencies_custom_option.proto"));
8081 "google/protobuf/unittest_lazy_dependencies_enum.proto"));
8093 "google/protobuf/unittest_lazy_dependencies_custom_option.proto"));
8095 "google/protobuf/unittest_lazy_dependencies_enum.proto"));
8105 "google/protobuf/unittest_lazy_dependencies_custom_option.proto"));
8107 "google/protobuf/unittest_lazy_dependencies_enum.proto"));
8113 "name: 'foo.proto' "
8115 "dependency: 'bar.proto' "
8122 "name: 'bar.proto' "
8124 "dependency: 'baz.proto' "
8132 const FileDescriptor* foo_file = pool_.FindFileByName("foo.proto");
8134 // As expected, requesting foo.proto shouldn't build it's dependencies
8135 EXPECT_TRUE(pool_.InternalIsFileLoaded("foo.proto"));
8136 EXPECT_FALSE(pool_.InternalIsFileLoaded("bar.proto"));
8137 EXPECT_FALSE(pool_.InternalIsFileLoaded("baz.proto"));
8143 EXPECT_TRUE(pool_.InternalIsFileLoaded("bar.proto"));
8144 EXPECT_FALSE(pool_.InternalIsFileLoaded("baz.proto"));