Adding missing imports for tests, and gate off others
This commit is contained in:
parent
bc3bee410a
commit
cb4ab76e4a
46 changed files with 141 additions and 109 deletions
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
//! Boolean logic
|
//! Boolean logic
|
||||||
|
|
||||||
use cmp;
|
|
||||||
use option::{None, Option, Some};
|
use option::{None, Option, Some};
|
||||||
|
#[cfg(notest)] use cmp;
|
||||||
|
|
||||||
/// Negation / inverse
|
/// Negation / inverse
|
||||||
pub pure fn not(v: bool) -> bool { !v }
|
pub pure fn not(v: bool) -> bool { !v }
|
||||||
|
@ -80,7 +80,7 @@ impl cmp::Eq for bool {
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_bool_from_str() {
|
pub fn test_bool_from_str() {
|
||||||
do all_values |v| {
|
do all_values |v| {
|
||||||
assert Some(v) == from_str(bool::to_str(v))
|
assert Some(v) == from_str(to_str(v))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,14 @@
|
||||||
|
|
||||||
//! Utilities for manipulating the char type
|
//! Utilities for manipulating the char type
|
||||||
|
|
||||||
use cmp::Eq;
|
|
||||||
use option::{None, Option, Some};
|
use option::{None, Option, Some};
|
||||||
use str;
|
use str;
|
||||||
use u32;
|
use u32;
|
||||||
use uint;
|
use uint;
|
||||||
use unicode;
|
use unicode;
|
||||||
|
|
||||||
|
#[cfg(notest)] use cmp::Eq;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Lu Uppercase_Letter an uppercase letter
|
Lu Uppercase_Letter an uppercase letter
|
||||||
Ll Lowercase_Letter a lowercase letter
|
Ll Lowercase_Letter a lowercase letter
|
||||||
|
@ -304,8 +305,8 @@ fn test_to_digit() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_is_ascii() {
|
fn test_is_ascii() {
|
||||||
assert str::all(~"banana", char::is_ascii);
|
assert str::all(~"banana", is_ascii);
|
||||||
assert ! str::all(~"ประเทศไทย中华Việt Nam", char::is_ascii);
|
assert ! str::all(~"ประเทศไทย中华Việt Nam", is_ascii);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -19,6 +19,8 @@ use libc::{c_void, size_t, c_int};
|
||||||
use ptr;
|
use ptr;
|
||||||
use vec;
|
use vec;
|
||||||
|
|
||||||
|
#[cfg(test)] use rand;
|
||||||
|
|
||||||
extern mod rustrt {
|
extern mod rustrt {
|
||||||
unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
|
unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
|
||||||
src_buf_len: size_t,
|
src_buf_len: size_t,
|
||||||
|
|
|
@ -10,11 +10,7 @@
|
||||||
|
|
||||||
//! Logging
|
//! Logging
|
||||||
|
|
||||||
use cast::transmute;
|
|
||||||
use io;
|
|
||||||
use libc;
|
use libc;
|
||||||
use repr;
|
|
||||||
use vec;
|
|
||||||
|
|
||||||
#[nolink]
|
#[nolink]
|
||||||
extern mod rustrt {
|
extern mod rustrt {
|
||||||
|
@ -48,6 +44,11 @@ pub fn console_off() {
|
||||||
#[cfg(notest)]
|
#[cfg(notest)]
|
||||||
#[lang="log_type"]
|
#[lang="log_type"]
|
||||||
pub fn log_type<T>(level: u32, object: &T) {
|
pub fn log_type<T>(level: u32, object: &T) {
|
||||||
|
use cast::transmute;
|
||||||
|
use io;
|
||||||
|
use repr;
|
||||||
|
use vec;
|
||||||
|
|
||||||
let bytes = do io::with_bytes_writer |writer| {
|
let bytes = do io::with_bytes_writer |writer| {
|
||||||
repr::write_repr(writer, object);
|
repr::write_repr(writer, object);
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,6 +14,7 @@ Functions for the unit type.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#[cfg(notest)]
|
||||||
use cmp::{Eq, Ord};
|
use cmp::{Eq, Ord};
|
||||||
|
|
||||||
#[cfg(notest)]
|
#[cfg(notest)]
|
||||||
|
|
|
@ -11,17 +11,18 @@
|
||||||
//! Operations and constants for `f32`
|
//! Operations and constants for `f32`
|
||||||
|
|
||||||
use cmath;
|
use cmath;
|
||||||
use cmp;
|
|
||||||
use libc::{c_float, c_int};
|
use libc::{c_float, c_int};
|
||||||
use num::NumCast;
|
use num::NumCast;
|
||||||
use num::strconv;
|
use num::strconv;
|
||||||
use num;
|
use num;
|
||||||
use ops;
|
|
||||||
use option::Option;
|
use option::Option;
|
||||||
use unstable::intrinsics::floorf32;
|
use unstable::intrinsics::floorf32;
|
||||||
use from_str;
|
use from_str;
|
||||||
use to_str;
|
use to_str;
|
||||||
|
|
||||||
|
#[cfg(notest)] use cmp;
|
||||||
|
#[cfg(notest)] use ops;
|
||||||
|
|
||||||
pub use cmath::c_float_targ_consts::*;
|
pub use cmath::c_float_targ_consts::*;
|
||||||
|
|
||||||
macro_rules! delegate(
|
macro_rules! delegate(
|
||||||
|
|
|
@ -11,17 +11,18 @@
|
||||||
//! Operations and constants for `f64`
|
//! Operations and constants for `f64`
|
||||||
|
|
||||||
use cmath;
|
use cmath;
|
||||||
use cmp;
|
|
||||||
use libc::{c_double, c_int};
|
use libc::{c_double, c_int};
|
||||||
use num::NumCast;
|
use num::NumCast;
|
||||||
use num::strconv;
|
use num::strconv;
|
||||||
use num;
|
use num;
|
||||||
use ops;
|
|
||||||
use option::Option;
|
use option::Option;
|
||||||
use unstable::intrinsics::floorf64;
|
use unstable::intrinsics::floorf64;
|
||||||
use to_str;
|
use to_str;
|
||||||
use from_str;
|
use from_str;
|
||||||
|
|
||||||
|
#[cfg(notest)] use cmp;
|
||||||
|
#[cfg(notest)] use ops;
|
||||||
|
|
||||||
pub use cmath::c_double_targ_consts::*;
|
pub use cmath::c_double_targ_consts::*;
|
||||||
pub use cmp::{min, max};
|
pub use cmp::{min, max};
|
||||||
|
|
||||||
|
|
|
@ -20,16 +20,17 @@
|
||||||
|
|
||||||
// PORT this must match in width according to architecture
|
// PORT this must match in width according to architecture
|
||||||
|
|
||||||
use cmp::{Eq, Ord};
|
|
||||||
use f64;
|
use f64;
|
||||||
use num::NumCast;
|
use num::NumCast;
|
||||||
use num::strconv;
|
use num::strconv;
|
||||||
use num;
|
use num;
|
||||||
use ops;
|
|
||||||
use option::{None, Option, Some};
|
use option::{None, Option, Some};
|
||||||
use to_str;
|
use to_str;
|
||||||
use from_str;
|
use from_str;
|
||||||
|
|
||||||
|
#[cfg(notest)] use cmp::{Eq, Ord};
|
||||||
|
#[cfg(notest)] use ops;
|
||||||
|
|
||||||
pub use f64::{add, sub, mul, div, rem, lt, le, eq, ne, ge, gt};
|
pub use f64::{add, sub, mul, div, rem, lt, le, eq, ne, ge, gt};
|
||||||
pub use f64::logarithm;
|
pub use f64::logarithm;
|
||||||
pub use f64::{acos, asin, atan2, cbrt, ceil, copysign, cosh, floor};
|
pub use f64::{acos, asin, atan2, cbrt, ceil, copysign, cosh, floor};
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
use T = self::inst::T;
|
use T = self::inst::T;
|
||||||
|
|
||||||
use cmp::{Eq, Ord};
|
|
||||||
use to_str::ToStr;
|
use to_str::ToStr;
|
||||||
use from_str::FromStr;
|
use from_str::FromStr;
|
||||||
use num::{ToStrRadix, FromStrRadix};
|
use num::{ToStrRadix, FromStrRadix};
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
use T = self::inst::T;
|
use T = self::inst::T;
|
||||||
use T_SIGNED = self::inst::T_SIGNED;
|
use T_SIGNED = self::inst::T_SIGNED;
|
||||||
|
|
||||||
use cmp::{Eq, Ord};
|
|
||||||
use to_str::ToStr;
|
use to_str::ToStr;
|
||||||
use from_str::FromStr;
|
use from_str::FromStr;
|
||||||
use num::{ToStrRadix, FromStrRadix};
|
use num::{ToStrRadix, FromStrRadix};
|
||||||
|
@ -20,6 +19,8 @@ use num;
|
||||||
use option::{None, Option, Some};
|
use option::{None, Option, Some};
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
|
|
||||||
|
#[cfg(notest)] use cmp::{Eq, Ord};
|
||||||
|
|
||||||
pub use cmp::{min, max};
|
pub use cmp::{min, max};
|
||||||
|
|
||||||
pub const bits : uint = inst::bits;
|
pub const bits : uint = inst::bits;
|
||||||
|
|
|
@ -143,50 +143,51 @@ pub mod inst {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_next_power_of_two() {
|
fn test_next_power_of_two() {
|
||||||
assert (uint::next_power_of_two(0u) == 0u);
|
assert (next_power_of_two(0u) == 0u);
|
||||||
assert (uint::next_power_of_two(1u) == 1u);
|
assert (next_power_of_two(1u) == 1u);
|
||||||
assert (uint::next_power_of_two(2u) == 2u);
|
assert (next_power_of_two(2u) == 2u);
|
||||||
assert (uint::next_power_of_two(3u) == 4u);
|
assert (next_power_of_two(3u) == 4u);
|
||||||
assert (uint::next_power_of_two(4u) == 4u);
|
assert (next_power_of_two(4u) == 4u);
|
||||||
assert (uint::next_power_of_two(5u) == 8u);
|
assert (next_power_of_two(5u) == 8u);
|
||||||
assert (uint::next_power_of_two(6u) == 8u);
|
assert (next_power_of_two(6u) == 8u);
|
||||||
assert (uint::next_power_of_two(7u) == 8u);
|
assert (next_power_of_two(7u) == 8u);
|
||||||
assert (uint::next_power_of_two(8u) == 8u);
|
assert (next_power_of_two(8u) == 8u);
|
||||||
assert (uint::next_power_of_two(9u) == 16u);
|
assert (next_power_of_two(9u) == 16u);
|
||||||
assert (uint::next_power_of_two(10u) == 16u);
|
assert (next_power_of_two(10u) == 16u);
|
||||||
assert (uint::next_power_of_two(11u) == 16u);
|
assert (next_power_of_two(11u) == 16u);
|
||||||
assert (uint::next_power_of_two(12u) == 16u);
|
assert (next_power_of_two(12u) == 16u);
|
||||||
assert (uint::next_power_of_two(13u) == 16u);
|
assert (next_power_of_two(13u) == 16u);
|
||||||
assert (uint::next_power_of_two(14u) == 16u);
|
assert (next_power_of_two(14u) == 16u);
|
||||||
assert (uint::next_power_of_two(15u) == 16u);
|
assert (next_power_of_two(15u) == 16u);
|
||||||
assert (uint::next_power_of_two(16u) == 16u);
|
assert (next_power_of_two(16u) == 16u);
|
||||||
assert (uint::next_power_of_two(17u) == 32u);
|
assert (next_power_of_two(17u) == 32u);
|
||||||
assert (uint::next_power_of_two(18u) == 32u);
|
assert (next_power_of_two(18u) == 32u);
|
||||||
assert (uint::next_power_of_two(19u) == 32u);
|
assert (next_power_of_two(19u) == 32u);
|
||||||
assert (uint::next_power_of_two(20u) == 32u);
|
assert (next_power_of_two(20u) == 32u);
|
||||||
assert (uint::next_power_of_two(21u) == 32u);
|
assert (next_power_of_two(21u) == 32u);
|
||||||
assert (uint::next_power_of_two(22u) == 32u);
|
assert (next_power_of_two(22u) == 32u);
|
||||||
assert (uint::next_power_of_two(23u) == 32u);
|
assert (next_power_of_two(23u) == 32u);
|
||||||
assert (uint::next_power_of_two(24u) == 32u);
|
assert (next_power_of_two(24u) == 32u);
|
||||||
assert (uint::next_power_of_two(25u) == 32u);
|
assert (next_power_of_two(25u) == 32u);
|
||||||
assert (uint::next_power_of_two(26u) == 32u);
|
assert (next_power_of_two(26u) == 32u);
|
||||||
assert (uint::next_power_of_two(27u) == 32u);
|
assert (next_power_of_two(27u) == 32u);
|
||||||
assert (uint::next_power_of_two(28u) == 32u);
|
assert (next_power_of_two(28u) == 32u);
|
||||||
assert (uint::next_power_of_two(29u) == 32u);
|
assert (next_power_of_two(29u) == 32u);
|
||||||
assert (uint::next_power_of_two(30u) == 32u);
|
assert (next_power_of_two(30u) == 32u);
|
||||||
assert (uint::next_power_of_two(31u) == 32u);
|
assert (next_power_of_two(31u) == 32u);
|
||||||
assert (uint::next_power_of_two(32u) == 32u);
|
assert (next_power_of_two(32u) == 32u);
|
||||||
assert (uint::next_power_of_two(33u) == 64u);
|
assert (next_power_of_two(33u) == 64u);
|
||||||
assert (uint::next_power_of_two(34u) == 64u);
|
assert (next_power_of_two(34u) == 64u);
|
||||||
assert (uint::next_power_of_two(35u) == 64u);
|
assert (next_power_of_two(35u) == 64u);
|
||||||
assert (uint::next_power_of_two(36u) == 64u);
|
assert (next_power_of_two(36u) == 64u);
|
||||||
assert (uint::next_power_of_two(37u) == 64u);
|
assert (next_power_of_two(37u) == 64u);
|
||||||
assert (uint::next_power_of_two(38u) == 64u);
|
assert (next_power_of_two(38u) == 64u);
|
||||||
assert (uint::next_power_of_two(39u) == 64u);
|
assert (next_power_of_two(39u) == 64u);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_overflows() {
|
fn test_overflows() {
|
||||||
|
use uint;
|
||||||
assert (uint::max_value > 0u);
|
assert (uint::max_value > 0u);
|
||||||
assert (uint::min_value <= 0u);
|
assert (uint::min_value <= 0u);
|
||||||
assert (uint::min_value + uint::max_value + 1u == 0u);
|
assert (uint::min_value + uint::max_value + 1u == 0u);
|
||||||
|
@ -194,9 +195,9 @@ pub mod inst {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_div() {
|
fn test_div() {
|
||||||
assert(uint::div_floor(3u, 4u) == 0u);
|
assert(div_floor(3u, 4u) == 0u);
|
||||||
assert(uint::div_ceil(3u, 4u) == 1u);
|
assert(div_ceil(3u, 4u) == 1u);
|
||||||
assert(uint::div_round(3u, 4u) == 1u);
|
assert(div_round(3u, 4u) == 1u);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -46,6 +46,9 @@ use kinds::Copy;
|
||||||
use util;
|
use util;
|
||||||
use num::Zero;
|
use num::Zero;
|
||||||
|
|
||||||
|
#[cfg(test)] use ptr;
|
||||||
|
#[cfg(test)] use str;
|
||||||
|
|
||||||
/// The option type
|
/// The option type
|
||||||
#[deriving_eq]
|
#[deriving_eq]
|
||||||
pub enum Option<T> {
|
pub enum Option<T> {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
//! Operations on unique pointer types
|
//! Operations on unique pointer types
|
||||||
|
|
||||||
use cmp::{Eq, Ord};
|
#[cfg(notest)] use cmp::{Eq, Ord};
|
||||||
|
|
||||||
#[cfg(notest)]
|
#[cfg(notest)]
|
||||||
impl<T:Eq> Eq for ~T {
|
impl<T:Eq> Eq for ~T {
|
||||||
|
|
|
@ -11,12 +11,15 @@
|
||||||
//! Unsafe pointer utility functions
|
//! Unsafe pointer utility functions
|
||||||
|
|
||||||
use cast;
|
use cast;
|
||||||
use cmp::{Eq, Ord};
|
|
||||||
use libc;
|
use libc;
|
||||||
use libc::{c_void, size_t};
|
use libc::{c_void, size_t};
|
||||||
use unstable::intrinsics::{memmove32,memmove64};
|
use unstable::intrinsics::{memmove32,memmove64};
|
||||||
use sys;
|
use sys;
|
||||||
|
|
||||||
|
#[cfg(test)] use vec;
|
||||||
|
#[cfg(test)] use str;
|
||||||
|
#[cfg(notest)] use cmp::{Eq, Ord};
|
||||||
|
|
||||||
#[nolink]
|
#[nolink]
|
||||||
#[abi = "cdecl"]
|
#[abi = "cdecl"]
|
||||||
extern mod libc_ {
|
extern mod libc_ {
|
||||||
|
@ -313,13 +316,13 @@ pub fn test() {
|
||||||
let mut v0 = ~[32000u16, 32001u16, 32002u16];
|
let mut v0 = ~[32000u16, 32001u16, 32002u16];
|
||||||
let mut v1 = ~[0u16, 0u16, 0u16];
|
let mut v1 = ~[0u16, 0u16, 0u16];
|
||||||
|
|
||||||
ptr::copy_memory(ptr::mut_offset(vec::raw::to_mut_ptr(v1), 1u),
|
copy_memory(mut_offset(vec::raw::to_mut_ptr(v1), 1u),
|
||||||
ptr::offset(vec::raw::to_ptr(v0), 1u), 1u);
|
offset(vec::raw::to_ptr(v0), 1u), 1u);
|
||||||
assert (v1[0] == 0u16 && v1[1] == 32001u16 && v1[2] == 0u16);
|
assert (v1[0] == 0u16 && v1[1] == 32001u16 && v1[2] == 0u16);
|
||||||
ptr::copy_memory(vec::raw::to_mut_ptr(v1),
|
copy_memory(vec::raw::to_mut_ptr(v1),
|
||||||
ptr::offset(vec::raw::to_ptr(v0), 2u), 1u);
|
offset(vec::raw::to_ptr(v0), 2u), 1u);
|
||||||
assert (v1[0] == 32002u16 && v1[1] == 32001u16 && v1[2] == 0u16);
|
assert (v1[0] == 32002u16 && v1[1] == 32001u16 && v1[2] == 0u16);
|
||||||
ptr::copy_memory(ptr::mut_offset(vec::raw::to_mut_ptr(v1), 2u),
|
copy_memory(mut_offset(vec::raw::to_mut_ptr(v1), 2u),
|
||||||
vec::raw::to_ptr(v0), 1u);
|
vec::raw::to_ptr(v0), 1u);
|
||||||
assert (v1[0] == 32002u16 && v1[1] == 32001u16 && v1[2] == 32000u16);
|
assert (v1[0] == 32002u16 && v1[1] == 32001u16 && v1[2] == 32000u16);
|
||||||
}
|
}
|
||||||
|
@ -358,15 +361,15 @@ pub fn test_buf_len() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_is_null() {
|
pub fn test_is_null() {
|
||||||
let p: *int = ptr::null();
|
let p: *int = null();
|
||||||
assert p.is_null();
|
assert p.is_null();
|
||||||
assert !p.is_not_null();
|
assert !p.is_not_null();
|
||||||
|
|
||||||
let q = ptr::offset(p, 1u);
|
let q = offset(p, 1u);
|
||||||
assert !q.is_null();
|
assert !q.is_null();
|
||||||
assert q.is_not_null();
|
assert q.is_not_null();
|
||||||
|
|
||||||
let mp: *mut int = ptr::mut_null();
|
let mp: *mut int = mut_null();
|
||||||
assert mp.is_null();
|
assert mp.is_null();
|
||||||
assert !mp.is_not_null();
|
assert !mp.is_not_null();
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ use vec::UnboxedVecRepr;
|
||||||
use vec::raw::{VecRepr, SliceRepr};
|
use vec::raw::{VecRepr, SliceRepr};
|
||||||
use vec;
|
use vec;
|
||||||
|
|
||||||
|
#[cfg(test)] use io;
|
||||||
|
|
||||||
pub use managed::raw::BoxRepr;
|
pub use managed::raw::BoxRepr;
|
||||||
|
|
||||||
/// Helpers
|
/// Helpers
|
||||||
|
@ -575,7 +577,7 @@ struct P {a: int, b: float}
|
||||||
fn test_repr() {
|
fn test_repr() {
|
||||||
|
|
||||||
fn exact_test<T>(t: &T, e:&str) {
|
fn exact_test<T>(t: &T, e:&str) {
|
||||||
let s : &str = io::with_str_writer(|w| repr::write_repr(w, t));
|
let s : &str = io::with_str_writer(|w| write_repr(w, t));
|
||||||
if s != e {
|
if s != e {
|
||||||
error!("expected '%s', got '%s'",
|
error!("expected '%s', got '%s'",
|
||||||
e, s);
|
e, s);
|
||||||
|
|
|
@ -451,7 +451,6 @@ pub fn waitpid(pid: pid_t) -> int {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use debug;
|
use debug;
|
||||||
use io::WriterUtil;
|
|
||||||
use option::{None, Some};
|
use option::{None, Some};
|
||||||
use os;
|
use os;
|
||||||
use run::{readclose, writeclose};
|
use run::{readclose, writeclose};
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
use at_vec;
|
use at_vec;
|
||||||
use cast;
|
use cast;
|
||||||
use char;
|
use char;
|
||||||
use cmp::{Eq, Ord, TotalOrd, Ordering, Less, Equal, Greater};
|
use cmp::{TotalOrd, Ordering, Less, Equal, Greater};
|
||||||
use libc;
|
use libc;
|
||||||
use option::{None, Option, Some};
|
use option::{None, Option, Some};
|
||||||
use ptr;
|
use ptr;
|
||||||
|
@ -29,6 +29,8 @@ use u8;
|
||||||
use uint;
|
use uint;
|
||||||
use vec;
|
use vec;
|
||||||
|
|
||||||
|
#[cfg(notest)] use cmp::{Eq, Ord};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Section: Creating a string
|
Section: Creating a string
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -10,10 +10,11 @@
|
||||||
|
|
||||||
//! Operations on tuples
|
//! Operations on tuples
|
||||||
|
|
||||||
use cmp::{Eq, Ord};
|
|
||||||
use kinds::Copy;
|
use kinds::Copy;
|
||||||
use vec;
|
use vec;
|
||||||
|
|
||||||
|
#[cfg(notest)] use cmp::{Eq, Ord};
|
||||||
|
|
||||||
pub trait CopyableTuple<T, U> {
|
pub trait CopyableTuple<T, U> {
|
||||||
pure fn first() -> T;
|
pure fn first() -> T;
|
||||||
pure fn second() -> U;
|
pure fn second() -> U;
|
||||||
|
|
|
@ -306,13 +306,8 @@ pub impl<T:Owned> Exclusive<T> {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod tests {
|
pub mod tests {
|
||||||
use core::option::{None, Some};
|
|
||||||
|
|
||||||
use cell::Cell;
|
|
||||||
use comm;
|
use comm;
|
||||||
use option;
|
|
||||||
use super::exclusive;
|
use super::exclusive;
|
||||||
use result;
|
|
||||||
use task;
|
use task;
|
||||||
use uint;
|
use uint;
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ use vec;
|
||||||
use rand;
|
use rand;
|
||||||
use libc::{c_void, size_t};
|
use libc::{c_void, size_t};
|
||||||
|
|
||||||
|
#[cfg(test)] use uint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Register a function to be run during runtime shutdown.
|
Register a function to be run during runtime shutdown.
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@ do || {
|
||||||
|
|
||||||
use ops::Drop;
|
use ops::Drop;
|
||||||
|
|
||||||
|
#[cfg(test)] use task::failing;
|
||||||
|
|
||||||
pub trait Finally<T> {
|
pub trait Finally<T> {
|
||||||
fn finally(&self, dtor: &fn()) -> T;
|
fn finally(&self, dtor: &fn()) -> T;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,10 @@ use unstable::intrinsics::atomic_cxchg;
|
||||||
use hashmap::linear::LinearMap;
|
use hashmap::linear::LinearMap;
|
||||||
use sys::Closure;
|
use sys::Closure;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)] use unstable::{SharedMutableState, shared_mutable_state};
|
||||||
use private::{SharedMutableState, shared_mutable_state};
|
#[cfg(test)] use unstable::get_shared_immutable_state;
|
||||||
|
#[cfg(test)] use task::spawn;
|
||||||
|
#[cfg(test)] use uint;
|
||||||
|
|
||||||
pub type GlobalDataKey<T> = &fn(v: T);
|
pub type GlobalDataKey<T> = &fn(v: T);
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,7 @@ pub fn unreachable() -> ! {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use option::{None, Some};
|
||||||
use util::{NonCopyable, id, replace, swap};
|
use util::{NonCopyable, id, replace, swap};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -208,6 +208,8 @@ mod test {
|
||||||
use back::rpath::{get_relative_to, get_rpath_relative_to_output};
|
use back::rpath::{get_relative_to, get_rpath_relative_to_output};
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use back::rpath::{minimize_rpaths, rpaths_to_flags};
|
use back::rpath::{minimize_rpaths, rpaths_to_flags};
|
||||||
|
#[cfg(test)]
|
||||||
|
use driver::session;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_rpaths_to_flags() {
|
pub fn test_rpaths_to_flags() {
|
||||||
|
|
|
@ -344,13 +344,10 @@ pub fn sess_os_to_meta_os(os: os) -> metadata::loader::os {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod test {
|
pub mod test {
|
||||||
use core::prelude::*;
|
|
||||||
|
|
||||||
use driver::session::{bin_crate, building_library, lib_crate};
|
use driver::session::{bin_crate, building_library, lib_crate};
|
||||||
use driver::session::{unknown_crate};
|
use driver::session::{unknown_crate};
|
||||||
|
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::ast_util;
|
|
||||||
use syntax::codemap;
|
use syntax::codemap;
|
||||||
|
|
||||||
pub fn make_crate_type_attr(+t: ~str) -> ast::attribute {
|
pub fn make_crate_type_attr(+t: ~str) -> ast::attribute {
|
||||||
|
|
|
@ -41,6 +41,9 @@ use syntax::fold;
|
||||||
use syntax;
|
use syntax;
|
||||||
use writer = std::ebml::writer;
|
use writer = std::ebml::writer;
|
||||||
|
|
||||||
|
#[cfg(test)] use syntax::parse;
|
||||||
|
#[cfg(test)] use syntax::print::pprust;
|
||||||
|
|
||||||
// Auxiliary maps of things to be encoded
|
// Auxiliary maps of things to be encoded
|
||||||
pub struct Maps {
|
pub struct Maps {
|
||||||
mutbl_map: middle::borrowck::mutbl_map,
|
mutbl_map: middle::borrowck::mutbl_map,
|
||||||
|
@ -1226,6 +1229,8 @@ fn mk_ctxt() -> fake_ext_ctxt {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
fn roundtrip(in_item: Option<@ast::item>) {
|
fn roundtrip(in_item: Option<@ast::item>) {
|
||||||
|
use std::prettyprint;
|
||||||
|
|
||||||
let in_item = in_item.get();
|
let in_item = in_item.get();
|
||||||
let bytes = do io::with_bytes_writer |wr| {
|
let bytes = do io::with_bytes_writer |wr| {
|
||||||
let ebml_w = writer::Encoder(wr);
|
let ebml_w = writer::Encoder(wr);
|
||||||
|
|
|
@ -34,10 +34,8 @@ mod test {
|
||||||
|
|
||||||
pub fn parse_attributes(source: ~str) -> ~[ast::attribute] {
|
pub fn parse_attributes(source: ~str) -> ~[ast::attribute] {
|
||||||
use syntax::parse;
|
use syntax::parse;
|
||||||
use syntax::parse::parser;
|
|
||||||
use syntax::parse::attr::parser_attr;
|
use syntax::parse::attr::parser_attr;
|
||||||
use syntax::codemap;
|
use syntax::codemap;
|
||||||
use syntax::diagnostic;
|
|
||||||
|
|
||||||
let parse_sess = syntax::parse::new_parse_sess(None);
|
let parse_sess = syntax::parse::new_parse_sess(None);
|
||||||
let parser = parse::new_parser_from_source_str(
|
let parser = parse::new_parser_from_source_str(
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
|
|
||||||
use doc;
|
use doc;
|
||||||
|
#[cfg(test)] use extract;
|
||||||
|
#[cfg(test)] use parse;
|
||||||
|
|
||||||
use core::vec;
|
use core::vec;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,10 @@ use markdown_writer::WriterFactory;
|
||||||
use pass::Pass;
|
use pass::Pass;
|
||||||
use sort_pass;
|
use sort_pass;
|
||||||
|
|
||||||
|
#[cfg(test)] use config;
|
||||||
|
#[cfg(test)] use markdown_writer;
|
||||||
|
#[cfg(test)] use page_pass;
|
||||||
|
|
||||||
use core::cell::Cell;
|
use core::cell::Cell;
|
||||||
use core::str;
|
use core::str;
|
||||||
use core::vec;
|
use core::vec;
|
||||||
|
|
|
@ -220,7 +220,7 @@ pub fn make_filename(
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_use_markdown_file_name_based_off_crate() {
|
fn should_use_markdown_file_name_based_off_crate() {
|
||||||
let config = Config {
|
let config = config::Config {
|
||||||
output_dir: Path("output/dir"),
|
output_dir: Path("output/dir"),
|
||||||
output_format: config::Markdown,
|
output_format: config::Markdown,
|
||||||
output_style: config::DocPerCrate,
|
output_style: config::DocPerCrate,
|
||||||
|
@ -234,7 +234,7 @@ fn should_use_markdown_file_name_based_off_crate() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_name_html_crate_file_name_index_html_when_doc_per_mod() {
|
fn should_name_html_crate_file_name_index_html_when_doc_per_mod() {
|
||||||
let config = Config {
|
let config = config::Config {
|
||||||
output_dir: Path("output/dir"),
|
output_dir: Path("output/dir"),
|
||||||
output_format: config::PandocHtml,
|
output_format: config::PandocHtml,
|
||||||
output_style: config::DocPerMod,
|
output_style: config::DocPerMod,
|
||||||
|
@ -248,7 +248,7 @@ fn should_name_html_crate_file_name_index_html_when_doc_per_mod() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_name_mod_file_names_by_path() {
|
fn should_name_mod_file_names_by_path() {
|
||||||
let config = Config {
|
let config = config::Config {
|
||||||
output_dir: Path("output/dir"),
|
output_dir: Path("output/dir"),
|
||||||
output_format: config::PandocHtml,
|
output_format: config::PandocHtml,
|
||||||
output_style: config::DocPerMod,
|
output_style: config::DocPerMod,
|
||||||
|
|
|
@ -14,6 +14,8 @@ use astsrv;
|
||||||
use doc;
|
use doc;
|
||||||
use time;
|
use time;
|
||||||
|
|
||||||
|
#[cfg(test)] use extract;
|
||||||
|
|
||||||
use core::vec;
|
use core::vec;
|
||||||
|
|
||||||
/// A single operation on the document model
|
/// A single operation on the document model
|
||||||
|
|
|
@ -19,6 +19,8 @@ use fold::Fold;
|
||||||
use fold;
|
use fold;
|
||||||
use pass::Pass;
|
use pass::Pass;
|
||||||
|
|
||||||
|
#[cfg(test)] use extract;
|
||||||
|
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
|
|
||||||
pub fn mk_pass() -> Pass {
|
pub fn mk_pass() -> Pass {
|
||||||
|
|
|
@ -63,6 +63,8 @@ fn is_hidden(srv: astsrv::Srv, doc: doc::ItemDoc) -> bool {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_prune_hidden_items() {
|
fn should_prune_hidden_items() {
|
||||||
|
use core::vec;
|
||||||
|
|
||||||
let doc = test::mk_doc(~"#[doc(hidden)] mod a { }");
|
let doc = test::mk_doc(~"#[doc(hidden)] mod a { }");
|
||||||
assert vec::is_empty(doc.cratemod().mods())
|
assert vec::is_empty(doc.cratemod().mods())
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,9 @@ pub fn mk_pass() -> Pass {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
|
use astsrv;
|
||||||
|
use extract;
|
||||||
|
|
||||||
let source = ~"mod z { } fn y() { }";
|
let source = ~"mod z { } fn y() { }";
|
||||||
do astsrv::from_str(source) |srv| {
|
do astsrv::from_str(source) |srv| {
|
||||||
let doc = extract::from_srv(srv.clone(), ~"");
|
let doc = extract::from_srv(srv.clone(), ~"");
|
||||||
|
|
|
@ -38,6 +38,9 @@ pub fn mk_pass() -> Pass {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
|
use astsrv;
|
||||||
|
use extract;
|
||||||
|
|
||||||
let source =
|
let source =
|
||||||
~"mod imod { } \
|
~"mod imod { } \
|
||||||
extern mod inmod {
|
extern mod inmod {
|
||||||
|
|
|
@ -17,6 +17,8 @@ use fold;
|
||||||
use pass::Pass;
|
use pass::Pass;
|
||||||
use util::NominalOp;
|
use util::NominalOp;
|
||||||
|
|
||||||
|
#[cfg(test)] use extract;
|
||||||
|
|
||||||
use std::sort;
|
use std::sort;
|
||||||
|
|
||||||
pub type ItemLtEqOp = @pure fn(v1: &doc::ItemTag, v2: &doc::ItemTag) -> bool;
|
pub type ItemLtEqOp = @pure fn(v1: &doc::ItemTag, v2: &doc::ItemTag) -> bool;
|
||||||
|
|
|
@ -26,6 +26,8 @@ pub fn mk_pass() -> Pass {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_trim_text() {
|
fn should_trim_text() {
|
||||||
|
use core::option::Some;
|
||||||
|
|
||||||
let doc = test::mk_doc(~"#[doc = \" desc \"] \
|
let doc = test::mk_doc(~"#[doc = \" desc \"] \
|
||||||
mod m {
|
mod m {
|
||||||
}");
|
}");
|
||||||
|
|
|
@ -273,7 +273,7 @@ pub impl &Arena {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_arena_destructors() {
|
fn test_arena_destructors() {
|
||||||
let arena = arena::Arena();
|
let arena = Arena();
|
||||||
for uint::range(0, 10) |i| {
|
for uint::range(0, 10) |i| {
|
||||||
// Arena allocate something with drop glue to make sure it
|
// Arena allocate something with drop glue to make sure it
|
||||||
// doesn't leak.
|
// doesn't leak.
|
||||||
|
@ -286,7 +286,7 @@ fn test_arena_destructors() {
|
||||||
|
|
||||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||||
fn test_arena_destructors_fail() {
|
fn test_arena_destructors_fail() {
|
||||||
let arena = arena::Arena();
|
let arena = Arena();
|
||||||
// Put some stuff in the arena.
|
// Put some stuff in the arena.
|
||||||
for uint::range(0, 10) |i| {
|
for uint::range(0, 10) |i| {
|
||||||
// Arena allocate something with drop glue to make sure it
|
// Arena allocate something with drop glue to make sure it
|
||||||
|
|
|
@ -635,8 +635,8 @@ mod test {
|
||||||
use flatpipes::pod;
|
use flatpipes::pod;
|
||||||
use flatpipes::serial;
|
use flatpipes::serial;
|
||||||
use io_util::BufReader;
|
use io_util::BufReader;
|
||||||
use net::tcp::TcpSocketBuf;
|
|
||||||
use flatpipes::{BytePort, FlatChan, FlatPort};
|
use flatpipes::{BytePort, FlatChan, FlatPort};
|
||||||
|
use net::tcp::TcpSocketBuf;
|
||||||
|
|
||||||
use core::int;
|
use core::int;
|
||||||
use core::io::{BytesReader, BytesWriter};
|
use core::io::{BytesReader, BytesWriter};
|
||||||
|
@ -762,7 +762,6 @@ mod test {
|
||||||
|
|
||||||
use core::cell::Cell;
|
use core::cell::Cell;
|
||||||
use net::ip;
|
use net::ip;
|
||||||
use net::tcp::TcpSocket;
|
|
||||||
use net::tcp;
|
use net::tcp;
|
||||||
use uv;
|
use uv;
|
||||||
|
|
||||||
|
|
|
@ -639,7 +639,6 @@ pub mod groups {
|
||||||
mod tests {
|
mod tests {
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
|
|
||||||
use opt = getopts;
|
|
||||||
use getopts::groups::OptGroup;
|
use getopts::groups::OptGroup;
|
||||||
use getopts::*;
|
use getopts::*;
|
||||||
|
|
||||||
|
|
|
@ -819,7 +819,6 @@ mod tests {
|
||||||
use net_url::*;
|
use net_url::*;
|
||||||
|
|
||||||
use core::hashmap::linear::LinearMap;
|
use core::hashmap::linear::LinearMap;
|
||||||
use core::str;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_url_parse() {
|
pub fn test_url_parse() {
|
||||||
|
|
|
@ -1334,15 +1334,15 @@ pub enum inlined_item {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use std;
|
|
||||||
use codemap::*;
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
//are asts encodable?
|
//are asts encodable?
|
||||||
|
|
||||||
// it looks like this *will* be a compiler bug, after
|
// it looks like this *will* be a compiler bug, after
|
||||||
// I get deriving_eq for crates into incoming :)
|
// I get deriving_eq for crates into incoming :)
|
||||||
/*
|
/*
|
||||||
|
use std;
|
||||||
|
use codemap::*;
|
||||||
|
use super::*;
|
||||||
|
|
||||||
#[test] fn check_asts_encodable() {
|
#[test] fn check_asts_encodable() {
|
||||||
let bogus_span = span {lo:BytePos(10),
|
let bogus_span = span {lo:BytePos(10),
|
||||||
hi:BytePos(20),
|
hi:BytePos(20),
|
||||||
|
|
|
@ -1206,14 +1206,7 @@ fn mk_enum_deser_body(
|
||||||
mod test {
|
mod test {
|
||||||
use std::serialize::Encodable;
|
use std::serialize::Encodable;
|
||||||
use std::serialize::Encoder;
|
use std::serialize::Encoder;
|
||||||
use core::dvec::*;
|
|
||||||
use util::testing::*;
|
use util::testing::*;
|
||||||
use core::io;
|
|
||||||
use core::str;
|
|
||||||
use core::option::Option;
|
|
||||||
use core::option::Some;
|
|
||||||
use core::option::None;
|
|
||||||
use std;
|
|
||||||
|
|
||||||
// just adding the ones I want to test, for now:
|
// just adding the ones I want to test, for now:
|
||||||
#[deriving_eq]
|
#[deriving_eq]
|
||||||
|
|
|
@ -500,7 +500,6 @@ impl <K: Eq + Hash + IterBytes ,V: Copy> MapChain<K,V>{
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
|
||||||
use super::MapChain;
|
use super::MapChain;
|
||||||
use util::testing::check_equal;
|
use util::testing::check_equal;
|
||||||
use core::hashmap::linear::LinearMap;
|
use core::hashmap::linear::LinearMap;
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
|
|
||||||
use ast::tt_delim;
|
|
||||||
use ast;
|
use ast;
|
||||||
use codemap::span;
|
use codemap::span;
|
||||||
use ext::base::ext_ctxt;
|
use ext::base::ext_ctxt;
|
||||||
|
|
|
@ -779,7 +779,6 @@ pub mod test {
|
||||||
use core::option::None;
|
use core::option::None;
|
||||||
use diagnostic;
|
use diagnostic;
|
||||||
use parse::token;
|
use parse::token;
|
||||||
use util::interner;
|
|
||||||
use util::testing::{check_equal, check_equal_ptr};
|
use util::testing::{check_equal, check_equal_ptr};
|
||||||
|
|
||||||
// represents a testing reader (incl. both reader and interner)
|
// represents a testing reader (incl. both reader and interner)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue