Restore visit_bytes for identifying variants and fields

This commit is contained in:
David Tolnay
2017-01-18 21:11:51 -08:00
parent b1fbbfd3ce
commit 0a10116bf5
2 changed files with 36 additions and 12 deletions
+8 -9
View File
@@ -3,7 +3,7 @@ use std::net;
use std::path::PathBuf;
use std::time::Duration;
use serde::de::{Deserialize, Type};
use serde::de::Deserialize;
extern crate fnv;
use self::fnv::FnvHasher;
@@ -781,6 +781,13 @@ declare_tests! {
Token::Unit,
],
}
test_enum_unit_bytes {
Enum::Unit => &[
Token::EnumStart("Enum"),
Token::Bytes(b"Unit"),
Token::Unit,
],
}
test_box {
Box::new(0i32) => &[Token::I32(0)],
}
@@ -933,12 +940,4 @@ declare_error_tests! {
],
Error::InvalidValue("expected variant index 0 <= i < 4".to_owned()),
}
test_enum_unit_bytes<Enum> {
&[
Token::EnumStart("Enum"),
Token::Bytes(b"Unit"),
Token::Unit,
],
Error::InvalidType(Type::Bytes),
}
}