Skip to content

Commit

Permalink
Update and un-xfail auto-encode test
Browse files Browse the repository at this point in the history
Closes #6122
  • Loading branch information
emberian committed Dec 16, 2013
1 parent 7b42497 commit b1fcba6
Showing 1 changed file with 34 additions and 42 deletions.
76 changes: 34 additions & 42 deletions src/test/run-pass/auto-encode.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// xfail-fast

// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand All @@ -10,14 +10,15 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test #6122
#[feature(managed_boxes)];

extern mod extra;

// These tests used to be separate files, but I wanted to refactor all
// the common code.

use std::hashmap::{HashMap, HashSet};
use std::io::Decorator;

use EBReader = extra::ebml::reader;
use EBWriter = extra::ebml::writer;
Expand All @@ -32,17 +33,14 @@ fn test_ebml<A:
Encodable<EBWriter::Encoder> +
Decodable<EBReader::Decoder>
>(a1: &A) {
let bytes = do io::with_bytes_writer |wr| {
let mut ebml_w = EBWriter::Encoder(wr);
a1.encode(&mut ebml_w)
};
let mut wr = @mut std::io::mem::MemWriter::new();
let mut ebml_w = EBWriter::Encoder(wr);
a1.encode(&mut ebml_w);
let bytes = wr.inner_ref().to_owned();

let d = EBReader::Doc(@bytes);
let mut decoder = EBReader::Decoder(d);
let a2: A = Decodable::decode(&mut decoder);
if !(*a1 == a2) {
::std::sys::FailWithCause::fail_with(~"explicit failure" + "foo",
"auto-encode.rs", 43u);
}
assert!(*a1 == a2);
}

Expand Down Expand Up @@ -139,47 +137,41 @@ pub fn main() {
let a = &Plus(@Minus(@Val(3u), @Val(10u)), @Plus(@Val(22u), @Val(5u)));
test_ebml(a);

// let a = &Spanned {lo: 0u, hi: 5u, node: 22u};
// test_ebml(a);
let a = &Spanned {lo: 0u, hi: 5u, node: 22u};
test_ebml(a);

// let a = &Point {x: 3u, y: 5u};
// test_ebml(a);
//
// let a = &@[1u, 2u, 3u];
// test_ebml(a);
//
// let a = &Top(22u);
// test_ebml(a);
//
// let a = &Bottom(222u);
// test_ebml(a);
//
// let a = &A;
// test_ebml(a);
//
// let a = &B;
// test_ebml(a);
let a = &Point {x: 3u, y: 5u};
test_ebml(a);

let a = &@[1u, 2u, 3u];
test_ebml(a);

let a = &Top(22u);
test_ebml(a);

let a = &Bottom(222u);
test_ebml(a);

let a = &A;
test_ebml(a);

let a = &B;
test_ebml(a);

println("Hi1");
let a = &time::now();
test_ebml(a);

println("Hi2");
// test_ebml(&1.0f32);
// test_ebml(&1.0f64);
test_ebml(&1.0f);
// println("Hi3");
// test_ebml(&'a');
test_ebml(&1.0f32);
test_ebml(&1.0f64);
test_ebml(&'a');

println("Hi4");
let mut a = HashMap::new();
test_ebml(&a);
a.insert(1, 2);
println("Hi4");
test_ebml(&a);

// let mut a = HashSet::new();
// test_ebml(&a);
// a.insert(1);
// test_ebml(&a);
let mut a = HashSet::new();
test_ebml(&a);
a.insert(1);
test_ebml(&a);
}

5 comments on commit b1fcba6

@bors
Copy link
Contributor

@bors bors commented on b1fcba6 Dec 16, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on b1fcba6 Dec 16, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging cmr/rust/auto_encode = b1fcba6 into auto

@bors
Copy link
Contributor

@bors bors commented on b1fcba6 Dec 16, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmr/rust/auto_encode = b1fcba6 merged ok, testing candidate = 35e5056

@bors
Copy link
Contributor

@bors bors commented on b1fcba6 Dec 16, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on b1fcba6 Dec 16, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 35e5056

Please sign in to comment.