mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-22 14:57:59 +00:00
Format in rfc style
This commit is contained in:
@@ -13,12 +13,7 @@ use std::str;
|
||||
extern crate serde;
|
||||
|
||||
extern crate serde_test;
|
||||
use self::serde_test::{
|
||||
Error,
|
||||
Token,
|
||||
assert_ser_tokens,
|
||||
assert_ser_tokens_error,
|
||||
};
|
||||
use self::serde_test::{Error, Token, assert_ser_tokens, assert_ser_tokens_error};
|
||||
|
||||
extern crate fnv;
|
||||
use self::fnv::FnvHasher;
|
||||
@@ -372,13 +367,12 @@ fn test_net_ipaddr() {
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_cannot_serialize_paths() {
|
||||
let path = unsafe {
|
||||
str::from_utf8_unchecked(b"Hello \xF0\x90\x80World")
|
||||
};
|
||||
let path = unsafe { str::from_utf8_unchecked(b"Hello \xF0\x90\x80World") };
|
||||
assert_ser_tokens_error(
|
||||
&Path::new(path),
|
||||
&[],
|
||||
Error::Message("path contains invalid UTF-8 characters".to_owned()));
|
||||
Error::Message("path contains invalid UTF-8 characters".to_owned()),
|
||||
);
|
||||
|
||||
let mut path_buf = PathBuf::new();
|
||||
path_buf.push(path);
|
||||
@@ -386,7 +380,8 @@ fn test_cannot_serialize_paths() {
|
||||
assert_ser_tokens_error(
|
||||
&path_buf,
|
||||
&[],
|
||||
Error::Message("path contains invalid UTF-8 characters".to_owned()));
|
||||
Error::Message("path contains invalid UTF-8 characters".to_owned()),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -394,17 +389,21 @@ fn test_enum_skipped() {
|
||||
assert_ser_tokens_error(
|
||||
&Enum::SkippedUnit,
|
||||
&[],
|
||||
Error::Message("the enum variant Enum::SkippedUnit cannot be serialized".to_owned()));
|
||||
Error::Message("the enum variant Enum::SkippedUnit cannot be serialized".to_owned(),),
|
||||
);
|
||||
assert_ser_tokens_error(
|
||||
&Enum::SkippedOne(42),
|
||||
&[],
|
||||
Error::Message("the enum variant Enum::SkippedOne cannot be serialized".to_owned()));
|
||||
Error::Message("the enum variant Enum::SkippedOne cannot be serialized".to_owned(),),
|
||||
);
|
||||
assert_ser_tokens_error(
|
||||
&Enum::SkippedSeq(1, 2),
|
||||
&[],
|
||||
Error::Message("the enum variant Enum::SkippedSeq cannot be serialized".to_owned()));
|
||||
Error::Message("the enum variant Enum::SkippedSeq cannot be serialized".to_owned(),),
|
||||
);
|
||||
assert_ser_tokens_error(
|
||||
&Enum::SkippedMap { _a: 1, _b: 2 },
|
||||
&[],
|
||||
Error::Message("the enum variant Enum::SkippedMap cannot be serialized".to_owned()));
|
||||
Error::Message("the enum variant Enum::SkippedMap cannot be serialized".to_owned(),),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user