diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-12-12 21:38:57 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-12-24 19:59:52 -0800 |
| commit | 018d60509c04cdebdf8b0d9e2b58f2604538e516 (patch) | |
| tree | 00245c6192d883dbc4d45cbb10a314c4e2239d07 /src/libstd/io/test.rs | |
| parent | d830fcc6eb5173061888d4b128c0670a49515f58 (diff) | |
| download | rust-018d60509c04cdebdf8b0d9e2b58f2604538e516.tar.gz rust-018d60509c04cdebdf8b0d9e2b58f2604538e516.zip | |
std: Get stdtest all passing again
This commit brings the library up-to-date in order to get all tests passing again
Diffstat (limited to 'src/libstd/io/test.rs')
| -rw-r--r-- | src/libstd/io/test.rs | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/src/libstd/io/test.rs b/src/libstd/io/test.rs index 212e4ebffa8..dd24150e03e 100644 --- a/src/libstd/io/test.rs +++ b/src/libstd/io/test.rs @@ -8,9 +8,48 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[macro_escape]; + +use os; +use prelude::*; +use rand; +use rand::Rng; +use std::io::net::ip::*; +use sync::atomics::{AtomicUint, INIT_ATOMIC_UINT, Relaxed}; + +macro_rules! iotest ( + { fn $name:ident() $b:block } => ( + mod $name { + #[allow(unused_imports)]; + + use super::super::*; + use super::*; + use io; + use prelude::*; + use io::*; + use io::fs::*; + use io::net::tcp::*; + use io::net::ip::*; + use io::net::udp::*; + use io::net::unix::*; + use str; + use util; + + fn f() $b + + #[test] fn green() { f() } + #[test] fn native() { + use native; + let (p, c) = Chan::new(); + do native::task::spawn { c.send(f()) } + p.recv(); + } + } + ) +) + /// Get a port number, starting at 9600, for use in tests pub fn next_test_port() -> u16 { - use unstable::atomics::{AtomicUint, INIT_ATOMIC_UINT, Relaxed}; static mut next_offset: AtomicUint = INIT_ATOMIC_UINT; unsafe { base_port() + next_offset.fetch_add(1, Relaxed) as u16 @@ -44,9 +83,6 @@ all want to use ports. This function figures out which workspace it is running in and assigns a port range based on it. */ fn base_port() -> u16 { - use os; - use str::StrSlice; - use vec::ImmutableVector; let base = 9600u16; let range = 1000u16; |
