-
Notifications
You must be signed in to change notification settings - Fork 742
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
Exhaustive internally tagged tests + support of internally tagged enums in non self-describing formats #2569
base: master
Are you sure you want to change the base?
Commits on Aug 7, 2023
-
Use correct tokens in test to represent an enum variant
Unit variant of externally tagged enum cannot be deserialized from the string token by itself. It is ContentDeserializer + serde_test::Deserializer that makes this possible, because serde_test::Deserializer produces Content::Str() from Token::BorrowedStr() and ContentDeserializer produces unit variant from Content::Str(). The following tokens all produces Content::String(variant): - Token::String(variant) - Token::Str(variant) - Token::UnitVariant { variant, .. } Token::BorrowedStr(variant) produces Content::Str(variant) that was the real purpose to use it in test in serde-rs#933. This actually makes this test testing `Content` rather than type itself. Correct way to represent enum one of: - [xxxVariant { .. }] - [Enum { .. }, xxxVariant { variant, .. }] - [Enum { .. }, String(variant), <variant content>] - [Enum { .. }, Str(variant), <variant content>] - [Enum { .. }, BorrowedStr(variant), <variant content>]
Configuration menu - View commit details
-
Copy full SHA for 84d1c53 - Browse repository at this point
Copy the full SHA 84d1c53View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6a097ec - Browse repository at this point
Copy the full SHA 6a097ecView commit details -
Convert test_internally_tagged_enum into module
(review this commit with "ignore whitespace changes" option on)
Configuration menu - View commit details
-
Copy full SHA for 4437833 - Browse repository at this point
Copy the full SHA 4437833View commit details -
Move all internally tagged enum tests into a dedicated module
Moved: - test_internally_tagged_bytes => string_and_bytes mod - test_internally_tagged_struct_variant_containing_unit_variant => struct_variant_containing_unit_variant - test_internally_tagged_borrow => borrow - test_enum_in_internally_tagged_enum => newtype_variant_containing_externally_tagged_enum - test_internally_tagged_newtype_variant_containing_unit_struct => newtype_variant_containing_unit_struct (review this commit with "ignore whitespace changes" option on)
Configuration menu - View commit details
-
Copy full SHA for 6fadf4d - Browse repository at this point
Copy the full SHA 6fadf4dView commit details -
We already have two tests where inner types serialized as a Struct container and as a Map container. No need yet another test for a Map container
Configuration menu - View commit details
-
Copy full SHA for 269be57 - Browse repository at this point
Copy the full SHA 269be57View commit details -
Configuration menu - View commit details
-
Copy full SHA for 55c0bfb - Browse repository at this point
Copy the full SHA 55c0bfbView commit details -
Configuration menu - View commit details
-
Copy full SHA for b1af745 - Browse repository at this point
Copy the full SHA b1af745View commit details -
Configuration menu - View commit details
-
Copy full SHA for 23323b6 - Browse repository at this point
Copy the full SHA 23323b6View commit details -
Move all other internally tagged enum tests into a dedicated file
Moved all except flattened tests: - test_internally_tagged_enum_with_skipped_conflict => with_skipped_conflict - test_internally_tagged_enum_containing_flatten => containing_flatten - test_internally_tagged_enum_new_type_with_unit => newtype_variant_containing_unit - test_internally_tagged_unit_enum_with_unknown_fields => unit_variant_with_unknown_fields - test_expecting_message_internally_tagged_enum => expecting_message
Configuration menu - View commit details
-
Copy full SHA for 310e00a - Browse repository at this point
Copy the full SHA 310e00aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4e12f39 - Browse repository at this point
Copy the full SHA 4e12f39View commit details -
Configuration menu - View commit details
-
Copy full SHA for 45512d6 - Browse repository at this point
Copy the full SHA 45512d6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2be1112 - Browse repository at this point
Copy the full SHA 2be1112View commit details -
Configuration menu - View commit details
-
Copy full SHA for 541d76e - Browse repository at this point
Copy the full SHA 541d76eView commit details -
Configuration menu - View commit details
-
Copy full SHA for b01f5bd - Browse repository at this point
Copy the full SHA b01f5bdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 047e7a5 - Browse repository at this point
Copy the full SHA 047e7a5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4770a7e - Browse repository at this point
Copy the full SHA 4770a7eView commit details -
Configuration menu - View commit details
-
Copy full SHA for dfc8527 - Browse repository at this point
Copy the full SHA dfc8527View commit details -
Share externally tagged enum Enum between all tests and reuse in stru…
…ct_variant_containing_unit_variant
Configuration menu - View commit details
-
Copy full SHA for 23f3e22 - Browse repository at this point
Copy the full SHA 23f3e22View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5af0e8e - Browse repository at this point
Copy the full SHA 5af0e8eView commit details -
Configuration menu - View commit details
-
Copy full SHA for b2cca0d - Browse repository at this point
Copy the full SHA b2cca0dView commit details -
- newtype_variant_containing_unit -> newtype_unit - newtype_variant_containing_unit_struct -> newtype_unit_struct - newtype_variant_containing_externally_tagged_enum -> newtype_enum - struct_variant_containing_unit_variant -> struct_enum
Configuration menu - View commit details
-
Copy full SHA for 43ab6d6 - Browse repository at this point
Copy the full SHA 43ab6d6View commit details -
Convert newtype_enum and struct_enum tests into modules
(review this commit with "ignore whitespace changes" option on)
Configuration menu - View commit details
-
Copy full SHA for 9b4cb8b - Browse repository at this point
Copy the full SHA 9b4cb8bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 437cf03 - Browse repository at this point
Copy the full SHA 437cf03View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5a18a4d - Browse repository at this point
Copy the full SHA 5a18a4dView commit details
Commits on Aug 12, 2023
-
Add missing tests for enum variants as a values of struct variant of …
…internally tagged enum failures (3) - until serde-rs/test#31 is merged: struct_enum::newtype struct_enum::struct_ struct_enum::tuple
Configuration menu - View commit details
-
Copy full SHA for de4c2de - Browse repository at this point
Copy the full SHA de4c2deView commit details -
Configuration menu - View commit details
-
Copy full SHA for 426b3a5 - Browse repository at this point
Copy the full SHA 426b3a5View commit details -
Add test for sequence in newtype_variant_containing_unit
failures(1): newtype_unit
Configuration menu - View commit details
-
Copy full SHA for f869500 - Browse repository at this point
Copy the full SHA f869500View commit details -
Unify handling of unit and unit structs in ContentDeserializer
In theory, ContentRefDeserializer should have matching implementation, but handling empty maps and sequences as units breaks some cases with untagged enums: - test_untagged_newtype_variant_containing_unit_struct_not_map
Configuration menu - View commit details
-
Copy full SHA for b4e73e2 - Browse repository at this point
Copy the full SHA b4e73e2View commit details -
Configuration menu - View commit details
-
Copy full SHA for b9a4860 - Browse repository at this point
Copy the full SHA b9a4860View commit details -
Deserializer should not check correctness of data, this is the respon…
…sibility of the Visitor
Configuration menu - View commit details
-
Copy full SHA for 1006028 - Browse repository at this point
Copy the full SHA 1006028View commit details -
Add support for internally tagged enums in non self-describing formats
Deserializer methods are only hints which deserializer is not obliged to follow. Both TaggedContentVisitor and InternallyTaggedUnitVisitor accepts only visit_map and visit_seq and that is what derived implementation of Deserialize does for structs. Therefore it is fine to call deserialize_map here, as that already did in derived deserialize implementation
Configuration menu - View commit details
-
Copy full SHA for dafede9 - Browse repository at this point
Copy the full SHA dafede9View commit details -
Add support for struct variants in untagged and adjacently tagged enu…
…ms in non self-describing formats Visitor that passed th the deserialize_any supports only visit_map method, so we can always requests deserialize_map
Configuration menu - View commit details
-
Copy full SHA for a08c600 - Browse repository at this point
Copy the full SHA a08c600View commit details