Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
043b99c7
Unverified
Commit
043b99c7
authored
Dec 20, 2018
by
Hao Nguyen
Committed by
GitHub
Dec 20, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5492 from haon4/master
Add conformance test for allow_alias with lower_case enums
parents
71fc8b4b
e24d9a8a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
4 deletions
+33
-4
binary_json_conformance_suite.cc
conformance/binary_json_conformance_suite.cc
+17
-0
conformance_php.php
conformance/conformance_php.php
+1
-0
message.c
ruby/ext/google/protobuf_c/message.c
+3
-4
test_messages_proto3.proto
src/google/protobuf/test_messages_proto3.proto
+12
-0
No files found.
conformance/binary_json_conformance_suite.cc
View file @
043b99c7
...
...
@@ -1386,6 +1386,23 @@ void BinaryAndJsonConformanceSuite::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
,
...
...
conformance/conformance_php.php
View file @
043b99c7
...
...
@@ -8,6 +8,7 @@ require_once("Conformance/TestCategory.php");
require_once
(
"Protobuf_test_messages/Proto3/ForeignMessage.php"
);
require_once
(
"Protobuf_test_messages/Proto3/ForeignEnum.php"
);
require_once
(
"Protobuf_test_messages/Proto3/TestAllTypesProto3.php"
);
require_once
(
"Protobuf_test_messages/Proto3/TestAllTypesProto3/AliasedEnum.php"
);
require_once
(
"Protobuf_test_messages/Proto3/TestAllTypesProto3/NestedMessage.php"
);
require_once
(
"Protobuf_test_messages/Proto3/TestAllTypesProto3/NestedEnum.php"
);
...
...
ruby/ext/google/protobuf_c/message.c
View file @
043b99c7
...
...
@@ -698,10 +698,9 @@ VALUE build_module_from_enumdesc(EnumDescriptor* enumdesc) {
const
char
*
name
=
upb_enum_iter_name
(
&
it
);
int32_t
value
=
upb_enum_iter_number
(
&
it
);
if
(
name
[
0
]
<
'A'
||
name
[
0
]
>
'Z'
)
{
rb_raise
(
cTypeError
,
"Enum value '%s' does not start with an uppercase letter "
"as is required for Ruby constants."
,
name
);
rb_warn
(
"Enum value '%s' does not start with an uppercase letter "
"as is required for Ruby constants."
,
name
);
}
rb_define_const
(
mod
,
name
,
INT2NUM
(
value
));
}
...
...
src/google/protobuf/test_messages_proto3.proto
View file @
043b99c7
...
...
@@ -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
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment