|
|
|
@ -6411,9 +6411,8 @@ TEST_F(ValidationErrorTest, EnumValuesConflictWithDifferentCasing) { |
|
|
|
|
"}", |
|
|
|
|
"foo.proto: bar: NAME: Enum name bar has the same name as BAR " |
|
|
|
|
"if you ignore case and strip out the enum name prefix (if any). " |
|
|
|
|
"This is error-prone and can lead to undefined behavior. " |
|
|
|
|
"Please avoid doing this. If you are using allow_alias, please assign " |
|
|
|
|
"the same numeric value to both enums.\n"); |
|
|
|
|
"(If you are using allow_alias, please assign the same numeric " |
|
|
|
|
"value to both enums.) This is not allowed in proto3.\n"); |
|
|
|
|
|
|
|
|
|
// Not an error because both enums are mapped to the same value.
|
|
|
|
|
BuildFile( |
|
|
|
@ -6439,9 +6438,8 @@ TEST_F(ValidationErrorTest, EnumValuesConflictWhenPrefixesStripped) { |
|
|
|
|
"}", |
|
|
|
|
"foo.proto: BAZ: NAME: Enum name BAZ has the same name as FOO_ENUM_BAZ " |
|
|
|
|
"if you ignore case and strip out the enum name prefix (if any). " |
|
|
|
|
"This is error-prone and can lead to undefined behavior. " |
|
|
|
|
"Please avoid doing this. If you are using allow_alias, please assign " |
|
|
|
|
"the same numeric value to both enums.\n"); |
|
|
|
|
"(If you are using allow_alias, please assign the same numeric value " |
|
|
|
|
"to both enums.) This is not allowed in proto3.\n"); |
|
|
|
|
|
|
|
|
|
BuildFileWithErrors( |
|
|
|
|
"syntax: 'proto3'" |
|
|
|
@ -6453,9 +6451,8 @@ TEST_F(ValidationErrorTest, EnumValuesConflictWhenPrefixesStripped) { |
|
|
|
|
"}", |
|
|
|
|
"foo.proto: BAZ: NAME: Enum name BAZ has the same name as FOOENUM_BAZ " |
|
|
|
|
"if you ignore case and strip out the enum name prefix (if any). " |
|
|
|
|
"This is error-prone and can lead to undefined behavior. " |
|
|
|
|
"Please avoid doing this. If you are using allow_alias, please assign " |
|
|
|
|
"the same numeric value to both enums.\n"); |
|
|
|
|
"(If you are using allow_alias, please assign the same numeric value " |
|
|
|
|
"to both enums.) This is not allowed in proto3.\n"); |
|
|
|
|
|
|
|
|
|
BuildFileWithErrors( |
|
|
|
|
"syntax: 'proto3'" |
|
|
|
@ -6467,9 +6464,8 @@ TEST_F(ValidationErrorTest, EnumValuesConflictWhenPrefixesStripped) { |
|
|
|
|
"}", |
|
|
|
|
"foo.proto: BAR__BAZ: NAME: Enum name BAR__BAZ has the same name as " |
|
|
|
|
"FOO_ENUM_BAR_BAZ if you ignore case and strip out the enum name prefix " |
|
|
|
|
"(if any). This is error-prone and can lead to undefined behavior. " |
|
|
|
|
"Please avoid doing this. If you are using allow_alias, please assign " |
|
|
|
|
"the same numeric value to both enums.\n"); |
|
|
|
|
"(if any). (If you are using allow_alias, please assign the same numeric " |
|
|
|
|
"value to both enums.) This is not allowed in proto3.\n"); |
|
|
|
|
|
|
|
|
|
BuildFileWithErrors( |
|
|
|
|
"syntax: 'proto3'" |
|
|
|
@ -6481,9 +6477,8 @@ TEST_F(ValidationErrorTest, EnumValuesConflictWhenPrefixesStripped) { |
|
|
|
|
"}", |
|
|
|
|
"foo.proto: BAR_BAZ: NAME: Enum name BAR_BAZ has the same name as " |
|
|
|
|
"FOO_ENUM__BAR_BAZ if you ignore case and strip out the enum name prefix " |
|
|
|
|
"(if any). This is error-prone and can lead to undefined behavior. " |
|
|
|
|
"Please avoid doing this. If you are using allow_alias, please assign " |
|
|
|
|
"the same numeric value to both enums.\n"); |
|
|
|
|
"(if any). (If you are using allow_alias, please assign the same numeric " |
|
|
|
|
"value to both enums.) This is not allowed in proto3.\n"); |
|
|
|
|
|
|
|
|
|
// This isn't an error because the underscore will cause the PascalCase to
|
|
|
|
|
// differ by case (BarBaz vs. Barbaz).
|
|
|
|
@ -6828,8 +6823,9 @@ TEST_F(ValidationErrorTest, ValidateProto3JsonName) { |
|
|
|
|
" field { name:'name' number:1 label:LABEL_OPTIONAL type:TYPE_INT32 }" |
|
|
|
|
" field { name:'Name' number:2 label:LABEL_OPTIONAL type:TYPE_INT32 }" |
|
|
|
|
"}", |
|
|
|
|
"foo.proto: Foo: NAME: The JSON camel-case name of field \"Name\" " |
|
|
|
|
"conflicts with field \"name\". This is not allowed in proto3.\n"); |
|
|
|
|
"foo.proto: Foo: NAME: The default JSON name of field \"Name\" (\"Name\") " |
|
|
|
|
"conflicts with the default JSON name of field \"name\" (\"name\"). This is " |
|
|
|
|
"not allowed in proto3.\n"); |
|
|
|
|
// Underscores are ignored.
|
|
|
|
|
BuildFileWithErrors( |
|
|
|
|
"name: 'foo.proto' " |
|
|
|
@ -6839,8 +6835,9 @@ TEST_F(ValidationErrorTest, ValidateProto3JsonName) { |
|
|
|
|
" field { name:'ab' number:1 label:LABEL_OPTIONAL type:TYPE_INT32 }" |
|
|
|
|
" field { name:'_a__b_' number:2 label:LABEL_OPTIONAL type:TYPE_INT32 }" |
|
|
|
|
"}", |
|
|
|
|
"foo.proto: Foo: NAME: The JSON camel-case name of field \"_a__b_\" " |
|
|
|
|
"conflicts with field \"ab\". This is not allowed in proto3.\n"); |
|
|
|
|
"foo.proto: Foo: NAME: The default JSON name of field \"_a__b_\" (\"AB\") " |
|
|
|
|
"conflicts with the default JSON name of field \"ab\" (\"ab\"). This is not " |
|
|
|
|
"allowed in proto3.\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|