-
-
Notifications
You must be signed in to change notification settings - Fork 779
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
Consolidate and add new tests of adjacently tagged enums #2804
Merged
Conversation
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
…ed module Moved and renamed: From test_annotatons - test_adjacently_tagged_enum_bytes => bytes - flatten::enum_::adjacently_tagged::straitforward=> struct_with_flatten - test_expecting_message_adjacently_tagged_enum => expecting_message - test_partially_untagged_adjacently_tagged_enum => partially_untagged From test_macros - test_adjacently_tagged_newtype_struct => newtype_with_newtype - test_adjacently_tagged_enum - test_adjacently_tagged_enum_deny_unknown_fields => deny_unknown_fields
(review this commit with "ignore whitespace changes" option on)
Change 0i32 to 1u8 so the test can be merged with the previous in the next commit
`newtype` test also integrates test with `Bytes` tag, so be like Removed the first assert_tokens because it is the same as the first assert in the merged method
(review this commit with "ignore whitespace changes" option on)
…ed for Unit case There is no difference what variant is deserialized so we can test only one kind of variant
(review this commit with "ignore whitespace changes" option on)
(review this commit with "ignore whitespace changes" option on)
(review this commit with "ignore whitespace changes" option on)
dtolnay
approved these changes
Aug 23, 2024
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.
Thank you!
These test suite PRs are much appreciated.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Similar to #2788, this PR moves all tests which tests top-level adjacently tagged enums (those which is defined using
#[serde(tag = "t", content = "c")]
attribute) into a dedicated file, removes duplicated tests and organizes tests in a logical manner. Flatten tests when adjacently tagged enum is flattened into structure I consider foremost as flatten tests, so they left untouched.Removed tests which tests deserialization of generated
tag
andcontent
field names from integers and bytes for each enum variant kind, such tests leaved only forUnit
variant. This is because they are handled by the eitherTagOrContentFieldVisitor
orTagContentOtherFieldVisitor
, which can be tested only once.Added tests includes deserialization from sequential representation, so this part of generated code becomes tested:
serde/serde_derive/src/de.rs
Lines 1680 to 1708 in 1a9ffdb