-
Notifications
You must be signed in to change notification settings - Fork 15.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for string APIs for implicit presence fields.
By "string APIs", I mean the following APIs: - mutable_foo - set_allocated_foo - release_foo See also: https://protobuf.dev/reference/cpp/cpp-generated/#implicit-string Add the following test cases (for singular implicit-presence fields): - A single call to mutable_foo() should not result in additional serialization on the wire. - Assigning an empty string to mutable_foo() should not result in additional serialization on the wire. - Calling set_allocated_foo() with an empty string should not result in additional serialization on the wire. - If a field is nonempty, release_foo() effectively clears the field (while returning a pointer to the original data). Adding coverage for these behaviours can increase confidence when we introduce internal hasbits to help with presence tracking for implicit presence fields. mutable_foo will in general set the hasbit, so the generated code will need to check that field is nonempty before serializing. PiperOrigin-RevId: 658562530
- Loading branch information
1 parent
fe7b64e
commit 58a97a4
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters