-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add map test cases to no_field_presence_test.
Maps behave in a very interesting way if they are set to be implicit-presence fields. First of all they present the possibility that the key or value (or both) can be the default zero value. When that happens, the gencode behaviour and the reflection behaviour is actually different. For example, gencode would not count zero entries in the map. However, reflection APIs such as HasField will return true for zero map entry fields. In essence, for maps, reflection behaves like explicit presence, but gencode behaves like implicit presence. (Note that this is not exactly *intended*, but it's just hard to change...) I'm adding unit tests in no_field_presence_test to cover this quirk. PiperOrigin-RevId: 671126144
- Loading branch information
1 parent
b8764f0
commit a743ffb
Showing
2 changed files
with
249 additions
and
1 deletion.
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