David Tolnay
eb6bf16a51
Revert "Catch wrong field names length in serde_test"
...
There are at least two reasonable things to expect the len field to
check: the length of the fields array passed to deserialize_struct, or
the number of field tokens. Even beyond these, in some cases it can be
useful to test deserialization with a bogus len to test how the
Deserialize impl reacts to an incorrect size_hint.
This reverts commit 436cafb0a3 which was
released in serde_test 1.0.20.
2017-11-29 22:21:05 -08:00
David Tolnay
436cafb0a3
Catch wrong field names length in serde_test
2017-11-12 10:16:43 -08:00
David Tolnay
501bae42f5
Fix space in serde_test panic message
...
Without this, the message contains "representationsmust".
2017-11-06 22:46:28 -08:00
David Tolnay
213071fe5c
Combine identical match arms in serde_test
...
As recommended by Clippy's match_same_arms lint.
2017-11-06 22:27:51 -08:00
David Tolnay
cfd26c6fda
Avoid cloning Copy types
...
As recommended by Clippy's clone_on_copy lint.
2017-11-06 22:26:55 -08:00
David Tolnay
88f5b9511d
Use .. in patterns
...
As recommended by Clippy's unneeded_field_pattern lint.
2017-11-06 22:24:25 -08:00
Markus Westerlind
aad7a7987f
Add an example to the Configure trait
2017-11-06 10:35:22 +01:00
David Tolnay
4ed0362c8e
Panic by default in serde_test is_human_readable
...
The serde_test Serializer and Deserializer panic in is_human_readable unless the
readableness has been set explicitly through one of the hidden functions. This
is to force types that have distinct readable/compact representations to be
tested explicitly in one or the other, rather than with a plain assert_tokens
which arbitrarily picks one.
We need to follow up by designing a better API in serde_test to expose this
publicly. For now serde_test cannot be used to test types that rely on
is_human_readable. (The hidden functions are meant for our test suite only.)
2017-10-17 09:49:42 -07:00
Markus Westerlind
e9b530a000
Hide is_human_readable constructors in serde_test
...
Until a good API can be found
2017-10-13 17:37:47 +02:00
Markus Westerlind
0dccbb1f11
Serialize to binary if the serde format is not human readable
...
This implements the KISS suggested in https://github.com/serde-rs/serde/issues/790 .
It is possible that one of the other approaches may be better but this
seemed like the simplest one to reignite som discussion.
Personally I find the original suggestion of adding two traits perhaps slightly
cleaner in theory but I think it ends up more complicated in the end
since the added traits also need to be duplicated to to the `Seed`
traits.
Closes #790
2017-09-07 16:20:57 +02:00
David Tolnay
4767ca3f5d
Use struct variants in token
2017-04-19 12:20:17 -07:00
David Tolnay
26a6ba177c
Remove error from serde_test public API
2017-04-19 11:54:48 -07:00
David Tolnay
0734b44a3a
Remove unneeded trait bounds
2017-04-19 10:41:58 -07:00
David Tolnay
86deb8db79
Remove seq_fixed_size in favor of tuple
2017-04-17 12:07:49 -07:00
David Tolnay
c13a37d4db
Rename VariantAccess methods to not conflict with Deserializer
2017-04-15 12:35:04 -07:00
David Tolnay
54bbf81dfc
Put deserialize_struct and deserialize_enum adjacent
2017-04-14 22:00:27 -07:00
David Tolnay
5b118fdef4
Reorder methods to match the serializer trait
2017-04-14 15:24:21 -07:00
David Tolnay
337c6e91d8
Access terminology in serde_test
2017-04-14 15:07:19 -07:00
David Tolnay
0c5db90de8
Simplify size_hint to Option<usize>
2017-04-14 13:31:46 -07:00
David Tolnay
e77e7c4bba
Rename Deserializer::deserialize to deserialize_any
2017-04-14 12:52:57 -07:00
David Tolnay
31cec05712
Access traits
2017-04-14 12:24:35 -07:00
David Tolnay
3f920f645c
License boilerplate
2017-04-13 17:34:42 -07:00
David Tolnay
ea8fb97beb
Format in rfc style
2017-04-13 12:32:29 -07:00
David Tolnay
07154303ed
Implement Debug for public types
2017-04-13 11:04:16 -07:00
David Tolnay
0d82bbf74f
Rename ValueDeserializer trait to IntoDeserializer
2017-04-11 23:20:35 -07:00
David Tolnay
a38b24136b
Rename deserialize_struct_field to deserialize_identifier
...
Because it applies to both struct fields and discriminants of an enum.
2017-04-09 13:35:22 -07:00
David Tolnay
826b53f691
Update token names in serde_test
2017-04-05 10:30:46 -07:00
David Tolnay
f03e8e6056
Exhaustive match in serde_test deserializer
2017-04-05 09:54:12 -07:00
David Tolnay
67ed7a0edd
Eliminate Sep tokens in serde_test
2017-04-05 09:42:27 -07:00
David Tolnay
c3d9b42cdf
Fix handling of option and newtype in IgnoredAny
2017-04-05 09:19:22 -07:00
David Tolnay
b2377d4c0b
Allow enums in ignored map value in serde_test
2017-04-05 08:54:30 -07:00
David Tolnay
b43554fbb1
Require slice of tokens in serde_test::Deserializer
2017-04-05 00:22:00 -07:00
David Tolnay
5871fb9ce0
Remove lifetime from serde_test::Token
2017-04-05 00:17:50 -07:00
David Tolnay
211e2bb8d9
Support borrowed tokens in serde_test
2017-04-04 09:56:01 -07:00
David Tolnay
d3a2f5e268
Add a 'de lifetime to the deserialize traits
2017-03-29 00:10:34 -07:00
Clar Charr
09e467cc4c
Documentation for serde_test.
2017-02-28 18:20:27 -05:00
David Tolnay
5fbdadefb2
Deserializing enums in serde_test
2017-02-24 13:47:04 -08:00
David Tolnay
e8651a52e7
Rustfmt
2017-02-12 22:15:59 -08:00
David Tolnay
ff21d557c7
Untagged and internally tagged enums
2017-02-02 18:48:30 -08:00
David Tolnay
87040b4bc4
Fix clippy lints in serde_test
2017-01-25 20:42:44 -08:00
David Tolnay
e0c049dbf2
Remove usize and isize from data model
2017-01-25 09:08:06 -08:00
David Tolnay
a4126e4c5a
Errors
2017-01-21 09:13:01 -08:00
David Tolnay
5ecfb3b388
Update serde_test to use seeds
2017-01-19 01:24:33 -08:00
Oliver Schneider
b26f291d93
add missing Vec<u8> deserialization hint to Deserializer
2017-01-16 16:55:13 +01:00
David Tolnay
7372f152bd
Update serde_test for Deserializer changes
2017-01-14 13:42:45 -08:00
David Tolnay
88debb3fb8
Remove SeqVisitor::end() and MapVisitor::end()
2017-01-13 13:34:38 -08:00
Oliver Schneider
5b668ed87a
attempt to test the field names, but deem it too complex and opt to at least improve the code
2017-01-12 20:17:55 +01:00
David Tolnay
eb6fb1d40e
Merge pull request #523 from serde-rs/enum
...
Enum deserialization API
2017-01-08 00:45:50 -08:00
David Tolnay
7a0e8f73b4
Remove the Deserialize trait bound on Visitor::Value
2017-01-03 01:50:10 -08:00
David Tolnay
85f1bf0259
Enum deserialization API
2016-08-23 22:17:28 -04:00