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.)
This commit is contained in:
David Tolnay
2017-10-17 09:49:39 -07:00
parent 4cecaf8d02
commit 4ed0362c8e
6 changed files with 79 additions and 61 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ fn ip_addr_roundtrip() {
seq b"1234".iter().map(|&b| Token::U8(b)),
Token::TupleEnd,
],
false,
Some(false),
);
}
@@ -40,6 +40,6 @@ fn socked_addr_roundtrip() {
Token::U16(1234),
Token::TupleEnd,
],
false,
Some(false),
);
}