Mingun
5e37ade519
Move all adjacently tagged enum tests (except flatten) into a dedicated 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
2024-08-16 21:36:52 +05:00
David Tolnay
1a9ffdbd0c
Merge pull request #2788 from Mingun/internally-tagged-enum-tests
...
Consolidate and add new tests of internally tagged enums
2024-08-15 14:42:28 -07:00
Mingun
2adb0e99b0
Add additional checks for unit and newtype_unit tests
...
- check that unit variant can be deserialized from a map
- check that newtype variant with unit can be deserialized from a struct
2024-08-15 23:39:14 +05:00
Mingun
71ed1f2f12
Add tests for special and general cases for internally tagged enums
...
Special case is the tag field first (so the enum variant are known after reading the first entry from map).
General case is the tag field not the first (so we need to buffer entries until we found an entry with tag)
2024-08-15 23:39:13 +05:00
Mingun
47954502af
Add tests with borrowed strings for the tag field name and tag value
2024-08-15 23:39:13 +05:00
Mingun
4987fd15f7
Convert newtype_enum and struct_enum tests into modules
...
Separate testing each variant kind of enum (unit, newtype, tuple, struct) results
in more specific information if that checks fail
(review this commit with "ignore whitespace changes" option on)
2024-08-15 23:39:12 +05:00
Mingun
8bfe0d0ac0
Move and rename tests:
...
- 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
2024-08-15 23:39:12 +05:00
Mingun
7c0e6bd18f
Reuse type in struct_variant_containing_unit_variant
2024-08-15 23:39:11 +05:00
Mingun
41b9c33c2b
Reuse type in newtype_variant_containing_externally_tagged_enum
2024-08-15 23:39:11 +05:00
Mingun
28a775db22
Share externally tagged enum Enum between all tests and reuse in struct_variant_containing_unit_variant
2024-08-15 23:39:10 +05:00
Mingun
e999600f8f
Rename externally tagged enum Inner to Enum
2024-08-15 23:39:10 +05:00
Mingun
d3492d8d36
Reuse type in newtype_variant_containing_unit_struct
2024-08-15 23:39:09 +05:00
Mingun
48de0c51b0
Share unit struct Unit between all tests
2024-08-15 23:39:09 +05:00
Mingun
93bda5f1dc
Rename unit struct to a generic name: Info->Unit
2024-08-15 23:39:09 +05:00
Mingun
2d75ef6b30
Reuse type in newtype_variant_containing_unit
2024-08-15 23:39:07 +05:00
Mingun
f97160f715
Reuse type in unit_variant_with_unknown_fields and add test for sequence
2024-08-15 23:39:06 +05:00
Mingun
eb59c776ca
Use name "tag" to refer to tag field
2024-08-15 23:39:06 +05:00
Mingun
9128201c78
Use the same order of derives
2024-08-15 23:39:05 +05:00
Mingun
2cbfd37072
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_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
- flatten::enum_::internally_tagged::straightforward => containing_flatten
2024-08-15 23:39:05 +05:00
Mingun
0939214c51
Move internally tagged enum tests into a dedicated file
...
Ctrl+X, Ctrl+V
2024-08-15 23:34:01 +05:00
Mingun
8c60f5aea7
Reorder enum variants and tests to canonical order (Unit, Newtype, Tuple, Struct)
2024-08-15 23:34:00 +05:00
Mingun
da0ed4021d
Give meaningful names to enum variants
2024-08-15 23:34:00 +05:00
Mingun
99f905403b
Move all internally tagged enum tests of test_macros
into a dedicated module
...
Moved:
- test_internally_tagged_enum_with_untagged_variant => untagged_variant
- 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)
2024-08-15 23:34:00 +05:00
Mingun
aa0654332d
Convert test_internally_tagged_enum into module
...
(review this commit with "ignore whitespace changes" option on)
2024-08-15 23:33:59 +05:00
David Tolnay
af376c22c3
Merge pull request #2803 from jonhoo/mv-flatten-tests
...
Group flatten tests
2024-08-15 10:53:49 -07:00
Jon Gjengset
477eb7b70e
Group flatten tests
2024-08-15 18:28:49 +02:00
David Tolnay
026e91a68c
Release 1.0.208
2024-08-15 08:41:27 -07:00
David Tolnay
bfbedac919
Merge pull request #2802 from jonhoo/flatten-unit-struct
...
Support (de-)serializing flattened unit struct
2024-08-15 08:40:11 -07:00
Jon Gjengset
4036ff88ed
Support (de-)serializing flattened unit struct
...
Fixes #2801 .
2024-08-15 15:50:54 +02:00
David Tolnay
1b4da41f97
Release 1.0.207
2024-08-12 13:06:46 -07:00
David Tolnay
f61d452814
Touch up PR 2795
2024-08-12 13:03:10 -07:00
David Tolnay
f9866097a0
Merge pull request #2795 from Mingun/has-flatten-rework
...
`has_flatten` rework
2024-08-12 13:02:58 -07:00
Mingun
77a6a9d4e1
Take into account only not skipped flatten fields when choose serialization form
...
Consequence: `FlattenSkipSerializing`
- uses `serialize_struct` instead of `serialize_map`
2024-08-11 20:12:09 +05:00
Mingun
547d843cca
Remove dead code - serialize_struct_as_map always called when cattrs.has_flatten()==true
2024-08-11 20:12:08 +05:00
Mingun
005cb84593
Fail with an understandable message is number of fields for serialization is too many
2024-08-11 20:12:07 +05:00
Mingun
fd5b5e9aa5
Correctly calculate has_flatten
attribute in all cases for deserialization
...
Consequence: `FlattenSkipDeserializing[DenyUnknown]`
- does not collect data in Field, because do not read them anyway
- gets `deserialize_in_place` method
- gets ability to deserialize from sequence (visit_seq method)
- uses `deserialize_struct` instead of `deserialize_map`
2024-08-11 20:01:33 +05:00
Mingun
0647a7c1fe
Fix creating and filling a collections that was not read
2024-08-11 20:01:00 +05:00
David Tolnay
85c73ef8de
Release 1.0.206
2024-08-11 00:08:37 -07:00
David Tolnay
5ba1796a7e
Resolve doc_markdown pedantic lint on regression test function
...
warning: you should put bare URLs between `<`/`>` or make a proper Markdown link
--> test_suite/tests/test_annotations.rs:2383:25
|
2383 | /// Regression test for https://github.com/serde-rs/serde/issues/1904
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `<https://github.com/serde-rs/serde/issues/1904 >`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
= note: `-W clippy::doc-markdown` implied by `-W clippy::pedantic`
= help: to override `-W clippy::pedantic` add `#[allow(clippy::doc_markdown)]`
2024-08-11 00:08:16 -07:00
David Tolnay
e52b7b380f
Touch up PR 2567
2024-08-11 00:05:56 -07:00
David Tolnay
84c7419652
Merge pull request #2794 from dtolnay/neverread
...
Temporarily ignore collection_is_never_read on FlattenSkipDeserializing
2024-08-11 00:05:31 -07:00
David Tolnay
536221b1f9
Temporarily ignore collection_is_never_read on FlattenSkipDeserializing
...
error: collection is never read
--> test_suite/tests/test_gen.rs:723:25
|
723 | #[derive(Serialize, Deserialize)]
| ^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collection_is_never_read
note: the lint level is defined here
--> test_suite/tests/test_gen.rs:23:9
|
23 | #![deny(clippy::collection_is_never_read)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
2024-08-10 23:59:23 -07:00
David Tolnay
fc55ac70d3
Merge pull request #2567 from Mingun/fix-2565
...
Correctly process flatten fields in enum variants
2024-08-10 23:28:22 -07:00
Mingun
2afe5b4ef9
Add regression test for issue #2792
2024-08-10 21:29:39 +05:00
Mingun
b4ec2595c9
Correctly process flatten fields in enum variants
...
- Fix incorrect deserialization of variants that doesn't contain flatten field when other contains
- Fix a panic when deriving `Deserialize` for an enum with tuple and struct with flatten field
Fixes (2):
regression::issue2565::simple_variant
regression::issue1904 (compilation)
2024-08-09 19:59:23 +05:00
Mingun
c3ac7b675a
Add regression test for issue #1904
...
Currently panics in derive:
error: proc-macro derive panicked
--> test_suite\tests\test_annotations.rs:2386:25
|
2386 | #[derive(Serialize, Deserialize, PartialEq, Debug)]
| ^^^^^^^^^^^
|
= help: message: assertion failed: !cattrs.has_flatten()
error: proc-macro derive panicked
--> test_suite\tests\regression\issue1904.rs:57:10
|
57 | #[derive(Deserialize)]
| ^^^^^^^^^^^
|
= help: message: assertion failed: !cattrs.has_flatten()
error: proc-macro derive panicked
--> test_suite\tests\regression\issue1904.rs:47:10
|
47 | #[derive(Deserialize)]
| ^^^^^^^^^^^
|
= help: message: assertion failed: !cattrs.has_flatten()
error: proc-macro derive panicked
--> test_suite\tests\regression\issue1904.rs:37:10
|
37 | #[derive(Deserialize)]
| ^^^^^^^^^^^
|
= help: message: assertion failed: !cattrs.has_flatten()
error: proc-macro derive panicked
--> test_suite\tests\regression\issue1904.rs:27:10
|
27 | #[derive(Deserialize)]
| ^^^^^^^^^^^
|
= help: message: assertion failed: !cattrs.has_flatten()
error: proc-macro derive panicked
--> test_suite\tests\regression\issue1904.rs:16:10
|
16 | #[derive(Deserialize)]
| ^^^^^^^^^^^
|
= help: message: assertion failed: !cattrs.has_flatten()
error: proc-macro derive panicked
--> test_suite\tests\regression\issue1904.rs:7:10
|
7 | #[derive(Deserialize)]
| ^^^^^^^^^^^
|
= help: message: assertion failed: !cattrs.has_flatten()
2024-08-09 19:55:56 +05:00
Mingun
24614e44bf
Add regression test for issue #2565
...
failures (1):
regression::issue2565::simple_variant
2024-08-09 19:53:14 +05:00
David Tolnay
9b868ef831
Release 1.0.205
2024-08-07 18:53:21 -07:00
David Tolnay
c3eaf76430
Merge pull request #2791 from dtolnay/flatten
...
Skip collecting unmatched fields in variants that do not use flatten
2024-08-07 18:52:21 -07:00
David Tolnay
32958dec3b
Skip collecting unmatched fields in variants that do not use flatten
2024-08-07 18:43:47 -07:00