add another test and change Show -> Debug
This commit is contained in:
parent
5952c3adb0
commit
64a8877c55
|
|
@ -85,7 +85,7 @@ mod reader;
|
|||
/// encoding function, the encoder will verify that the structure can be encoded
|
||||
/// within that limit. This verification occurs before any bytes are written to
|
||||
/// the Writer, so recovering from an the error is possible.
|
||||
#[derive(Clone, Copy, Show, Hash, Eq, PartialEq, Ord, PartialOrd)]
|
||||
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Ord, PartialOrd)]
|
||||
pub enum SizeLimit {
|
||||
Infinite,
|
||||
Bounded(u64)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use rustc_serialize::Decoder;
|
|||
|
||||
use super::SizeLimit;
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Show)]
|
||||
#[derive(Eq, PartialEq, Clone, Debug)]
|
||||
pub struct InvalidEncoding {
|
||||
desc: &'static str,
|
||||
detail: Option<String>,
|
||||
|
|
@ -28,7 +28,7 @@ impl fmt::Display for InvalidEncoding {
|
|||
///
|
||||
/// If decoding from a Buffer, assume that the buffer has been left
|
||||
/// in an invalid state.
|
||||
#[derive(Eq, PartialEq, Clone, Show)]
|
||||
#[derive(Eq, PartialEq, Clone, Debug)]
|
||||
pub enum DecodingError {
|
||||
/// If the error stems from the reader that is being used
|
||||
/// during decoding, that error will be stored and returned here.
|
||||
|
|
|
|||
17
src/test.rs
17
src/test.rs
|
|
@ -64,7 +64,7 @@ fn test_tuple() {
|
|||
|
||||
#[test]
|
||||
fn test_basic_struct() {
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)]
|
||||
struct Easy {
|
||||
x: isize,
|
||||
s: String,
|
||||
|
|
@ -75,13 +75,13 @@ fn test_basic_struct() {
|
|||
|
||||
#[test]
|
||||
fn test_nested_struct() {
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)]
|
||||
struct Easy {
|
||||
x: isize,
|
||||
s: String,
|
||||
y: usize
|
||||
}
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)]
|
||||
struct Nest {
|
||||
f: Easy,
|
||||
b: usize,
|
||||
|
|
@ -97,7 +97,7 @@ fn test_nested_struct() {
|
|||
|
||||
#[test]
|
||||
fn test_struct_tuple() {
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)]
|
||||
struct TubStr(usize, String, f32);
|
||||
|
||||
the_same(TubStr(5, "hello".to_string(), 3.2));
|
||||
|
|
@ -112,7 +112,7 @@ fn option() {
|
|||
|
||||
#[test]
|
||||
fn enm() {
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)]
|
||||
enum TestEnum {
|
||||
NoArg,
|
||||
OneArg(usize),
|
||||
|
|
@ -126,7 +126,7 @@ fn enm() {
|
|||
|
||||
#[test]
|
||||
fn struct_enum() {
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)]
|
||||
enum TestEnum {
|
||||
NoArg,
|
||||
OneArg(usize),
|
||||
|
|
@ -232,3 +232,8 @@ fn test_encoded_size() {
|
|||
|
||||
assert!(encoded_size(&vec![0u32, 1u32, 2u32]) == 8 + 3 * (4))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn encode_box() {
|
||||
the_same(Box::new(5));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue