-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement the new proto3 field presence feature #34 #200
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for taking this on! The changes mostly look good to me. I have one question in FileBuilder.kt
about something I'm confused about. The other comments are minor code style fixes.
The only other suggestion I have is to add some unit tests to runtime/commonTest
to check that a few invariants are maintained when an instance of Proto3PresenceMain
is encoded to a byte array and then that byte array is decoded back into a Proto3PresenceMain
instance. Something along these lines (where msg
is the result of calling encodeToByteArray()
and then decodeFromByteArray()
):
Proto3PresenceMain(optionalInt = 0, requiredInt = 0)
=> assert thatmsg.optionalInt == 0
andproto.requiredInt == 0
Proto3PresenceMain()
=> assert thatmsg.optionalInt == null
andmsg.requiredInt == 0
- Maybe similar tests on some of the other data types like messages, enums, and oneof fields?
protoc-gen-pbandk/lib/src/commonMain/kotlin/pbandk/gen/FileBuilder.kt
Outdated
Show resolved
Hide resolved
protoc-gen-pbandk/lib/src/jvmTest/resources/protos/proto_3_presence.proto
Outdated
Show resolved
Hide resolved
protoc-gen-pbandk/lib/src/jvmTest/resources/protos/proto_3_presence.proto
Outdated
Show resolved
Hide resolved
protoc-gen-pbandk/lib/src/commonMain/kotlin/pbandk/gen/FileBuilder.kt
Outdated
Show resolved
Hide resolved
protoc-gen-pbandk/lib/src/commonMain/kotlin/pbandk/gen/FileBuilder.kt
Outdated
Show resolved
Hide resolved
a4e6e74
to
dd65832
Compare
Doesn't tests based on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NiematojakTomasz I got a chance to come back to this PR finally and add the unit tests I was suggesting. Sorry for the long delay and thank you again for contributing support for this feature!
Fix #34