Add conformance test for enum alias of the same name with different case
This commit is contained in:
parent
4b02f652e0
commit
3d46d8dfe4
@ -1373,6 +1373,23 @@ void ConformanceTestSuiteImpl::RunSuiteImpl() {
|
||||
"EnumField", REQUIRED,
|
||||
R"({"optionalNestedEnum": "FOO"})",
|
||||
"optional_nested_enum: FOO");
|
||||
// Enum fields with alias
|
||||
RunValidJsonTest(
|
||||
"EnumFieldWithAlias", REQUIRED,
|
||||
R"({"optionalAliasedEnum": "ALIAS_BAZ"})",
|
||||
"optional_aliased_enum: ALIAS_BAZ");
|
||||
RunValidJsonTest(
|
||||
"EnumFieldWithAliasUseAlias", REQUIRED,
|
||||
R"({"optionalAliasedEnum": "QUX"})",
|
||||
"optional_aliased_enum: ALIAS_BAZ");
|
||||
RunValidJsonTest(
|
||||
"EnumFieldWithAliasLowerCase", REQUIRED,
|
||||
R"({"optionalAliasedEnum": "qux"})",
|
||||
"optional_aliased_enum: ALIAS_BAZ");
|
||||
RunValidJsonTest(
|
||||
"EnumFieldWithAliasDifferentCase", REQUIRED,
|
||||
R"({"optionalAliasedEnum": "bAz"})",
|
||||
"optional_aliased_enum: ALIAS_BAZ");
|
||||
// Enum values must be represented as strings.
|
||||
ExpectParseFailureForJson(
|
||||
"EnumFieldNotQuoted", REQUIRED,
|
||||
|
@ -73,6 +73,17 @@ message TestAllTypesProto3 {
|
||||
NEG = -1; // Intentionally negative.
|
||||
}
|
||||
|
||||
enum AliasedEnum {
|
||||
option allow_alias = true;
|
||||
|
||||
ALIAS_FOO = 0;
|
||||
ALIAS_BAR = 1;
|
||||
ALIAS_BAZ = 2;
|
||||
QUX = 2;
|
||||
qux = 2;
|
||||
bAz = 2;
|
||||
}
|
||||
|
||||
// Singular
|
||||
int32 optional_int32 = 1;
|
||||
int64 optional_int64 = 2;
|
||||
@ -95,6 +106,7 @@ message TestAllTypesProto3 {
|
||||
|
||||
NestedEnum optional_nested_enum = 21;
|
||||
ForeignEnum optional_foreign_enum = 22;
|
||||
AliasedEnum optional_aliased_enum = 23;
|
||||
|
||||
string optional_string_piece = 24 [ctype=STRING_PIECE];
|
||||
string optional_cord = 25 [ctype=CORD];
|
||||
|
Loading…
Reference in New Issue
Block a user