add another test and change Show -> Debug

This commit is contained in:
Ty Overby 2015-02-05 01:18:44 -08:00
parent 5952c3adb0
commit 64a8877c55
3 changed files with 14 additions and 9 deletions

View File

@ -85,7 +85,7 @@ mod reader;
/// encoding function, the encoder will verify that the structure can be encoded /// encoding function, the encoder will verify that the structure can be encoded
/// within that limit. This verification occurs before any bytes are written to /// within that limit. This verification occurs before any bytes are written to
/// the Writer, so recovering from an the error is possible. /// 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 { pub enum SizeLimit {
Infinite, Infinite,
Bounded(u64) Bounded(u64)

View File

@ -7,7 +7,7 @@ use rustc_serialize::Decoder;
use super::SizeLimit; use super::SizeLimit;
#[derive(Eq, PartialEq, Clone, Show)] #[derive(Eq, PartialEq, Clone, Debug)]
pub struct InvalidEncoding { pub struct InvalidEncoding {
desc: &'static str, desc: &'static str,
detail: Option<String>, detail: Option<String>,
@ -28,7 +28,7 @@ impl fmt::Display for InvalidEncoding {
/// ///
/// If decoding from a Buffer, assume that the buffer has been left /// If decoding from a Buffer, assume that the buffer has been left
/// in an invalid state. /// in an invalid state.
#[derive(Eq, PartialEq, Clone, Show)] #[derive(Eq, PartialEq, Clone, Debug)]
pub enum DecodingError { pub enum DecodingError {
/// If the error stems from the reader that is being used /// If the error stems from the reader that is being used
/// during decoding, that error will be stored and returned here. /// during decoding, that error will be stored and returned here.

View File

@ -64,7 +64,7 @@ fn test_tuple() {
#[test] #[test]
fn test_basic_struct() { fn test_basic_struct() {
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)] #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)]
struct Easy { struct Easy {
x: isize, x: isize,
s: String, s: String,
@ -75,13 +75,13 @@ fn test_basic_struct() {
#[test] #[test]
fn test_nested_struct() { fn test_nested_struct() {
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)] #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)]
struct Easy { struct Easy {
x: isize, x: isize,
s: String, s: String,
y: usize y: usize
} }
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)] #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)]
struct Nest { struct Nest {
f: Easy, f: Easy,
b: usize, b: usize,
@ -97,7 +97,7 @@ fn test_nested_struct() {
#[test] #[test]
fn test_struct_tuple() { fn test_struct_tuple() {
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)] #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)]
struct TubStr(usize, String, f32); struct TubStr(usize, String, f32);
the_same(TubStr(5, "hello".to_string(), 3.2)); the_same(TubStr(5, "hello".to_string(), 3.2));
@ -112,7 +112,7 @@ fn option() {
#[test] #[test]
fn enm() { fn enm() {
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)] #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)]
enum TestEnum { enum TestEnum {
NoArg, NoArg,
OneArg(usize), OneArg(usize),
@ -126,7 +126,7 @@ fn enm() {
#[test] #[test]
fn struct_enum() { fn struct_enum() {
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)] #[derive(RustcEncodable, RustcDecodable, PartialEq, Debug)]
enum TestEnum { enum TestEnum {
NoArg, NoArg,
OneArg(usize), OneArg(usize),
@ -232,3 +232,8 @@ fn test_encoded_size() {
assert!(encoded_size(&vec![0u32, 1u32, 2u32]) == 8 + 3 * (4)) assert!(encoded_size(&vec![0u32, 1u32, 2u32]) == 8 + 3 * (4))
} }
#[test]
fn encode_box() {
the_same(Box::new(5));
}