// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::prelude::*;
+use prelude::*;
use std::rand;
use std::rand::Rng;
use test::Bencher;
#[cfg(test)]
mod tests {
- use std::prelude::*;
+ use prelude::*;
use super::BinaryHeap;
- use vec::Vec;
#[test]
fn test_iterator() {
#[cfg(test)]
mod tests {
- use std::prelude::*;
- use std::iter::range_step;
+ use prelude::*;
+ use core::iter::range_step;
+ use core::u32;
use std::rand;
use std::rand::Rng;
- use std::u32;
use test::{Bencher, black_box};
use super::{Bitv, BitvSet, from_fn, from_bytes};
use bitv;
- use vec::Vec;
static BENCH_BITS : uint = 1 << 14;
#[test]
fn test_from_bytes() {
let bitv = from_bytes(&[0b10110110, 0b00000000, 0b11111111]);
- let str = format!("{}{}{}", "10110110", "00000000", "11111111");
+ let str = concat!("10110110", "00000000", "11111111");
assert_eq!(bitv.to_string(), str);
}
#[cfg(test)]
mod test {
- use std::prelude::*;
+ use prelude::*;
use super::{BTreeMap, Occupied, Vacant};
#[cfg(test)]
mod bench {
- use std::prelude::*;
+ use prelude::*;
use std::rand::{weak_rng, Rng};
use test::{Bencher, black_box};
#[cfg(test)]
mod test {
- use std::prelude::*;
+ use prelude::*;
use super::BTreeSet;
use std::hash;
#[cfg(test)]
mod tests {
- use std::prelude::*;
+ use prelude::*;
use std::rand;
use std::hash;
+ use std::task::spawn;
use test::Bencher;
use test;
use super::{DList, Node, ListInsertion};
- use vec::Vec;
pub fn check_links<T>(list: &DList<T>) {
let mut len = 0u;
#[cfg(test)]
mod test {
- use std::prelude::*;
use self::Foo::*;
- use std::mem;
+ use prelude::*;
+ use core::mem;
use super::{EnumSet, CLike};
pub use core::kinds; // deriving(Copy)
pub use core::hash; // deriving(Hash)
}
+
+#[cfg(test)]
+mod prelude {
+ // from core.
+ pub use core::borrow::IntoCow;
+ pub use core::char::Char;
+ pub use core::clone::Clone;
+ pub use core::cmp::{PartialEq, Eq, Equiv, PartialOrd, Ord};
+ pub use core::cmp::Ordering::{Less, Equal, Greater};
+ pub use core::iter::range;
+ pub use core::iter::{FromIterator, Extend, IteratorExt};
+ pub use core::iter::{Iterator, DoubleEndedIterator, RandomAccessIterator};
+ pub use core::iter::{IteratorCloneExt, CloneIteratorExt, DoubleEndedIteratorExt};
+ pub use core::iter::{IteratorOrdExt, MutableDoubleEndedIterator, ExactSizeIterator};
+ pub use core::kinds::{Copy, Send, Sized, Sync};
+ pub use core::mem::drop;
+ pub use core::ops::{Drop, Fn, FnMut, FnOnce};
+ pub use core::option::Option;
+ pub use core::option::Option::{Some, None};
+ pub use core::ptr::RawPtr;
+ pub use core::result::Result;
+ pub use core::result::Result::{Ok, Err};
+
+ // in core and collections (may differ).
+ pub use slice::{PartialEqSliceExt, OrdSliceExt};
+ pub use slice::{AsSlice, SliceExt};
+ pub use str::{from_str, Str, StrPrelude};
+
+ // from other crates.
+ pub use alloc::boxed::Box;
+ pub use unicode::char::UnicodeChar;
+
+ // from collections.
+ pub use slice::{CloneSliceExt, VectorVector};
+ pub use str::{IntoMaybeOwned, UnicodeStrPrelude, StrAllocating, StrVector};
+ pub use string::{String, ToString};
+ pub use vec::Vec;
+}
#[cfg(test)]
mod tests {
- use core::iter;
use self::Taggy::*;
use self::Taggypar::*;
- use std::cmp;
+ use prelude::*;
+ use core::cmp;
+ use core::iter;
use std::fmt::Show;
- use std::prelude::*;
use std::hash;
use test::Bencher;
use test;
use super::RingBuf;
- use vec::Vec;
#[test]
#[allow(deprecated)]
#[test]
fn test_from_iter() {
- use std::iter;
+ use core::iter;
let v = vec!(1i,2,3,4,5,6,7);
let deq: RingBuf<int> = v.iter().map(|&x| x).collect();
let u: Vec<int> = deq.iter().map(|&x| x).collect();
#[cfg(test)]
mod tests {
use std::boxed::Box;
- use std::cell::Cell;
- use std::default::Default;
- use std::mem;
- use std::prelude::*;
+ use prelude::*;
+ use core::cell::Cell;
+ use core::default::Default;
+ use core::mem;
use std::rand::{Rng, task_rng};
use std::rc::Rc;
- use std::rt;
- use slice::*;
-
- use vec::Vec;
+ use super::ElementSwaps;
fn square(n: uint) -> uint { n * n }
#[cfg(test)]
mod bench {
- use std::prelude::*;
+ use prelude::*;
+ use core::mem;
+ use core::ptr;
use std::rand::{weak_rng, Rng};
- use std::mem;
- use std::ptr;
use test::{Bencher, black_box};
- use vec::Vec;
-
#[bench]
fn iterator(b: &mut Bencher) {
// peculiar numbers to stop LLVM from optimising the summation
#[cfg(test)]
mod tests {
- use std::iter::AdditiveIterator;
- use std::iter::range;
- use std::default::Default;
- use std::char::Char;
- use std::clone::Clone;
- use std::cmp::{Ord, PartialOrd, Equiv};
- use std::cmp::Ordering::{Equal, Greater, Less};
- use std::option::Option;
- use std::option::Option::{Some, None};
- use std::ptr::RawPtr;
- use std::iter::{Iterator, IteratorExt, DoubleEndedIteratorExt};
-
- use super::*;
- use std::slice::{AsSlice, SliceExt};
- use string::String;
- use vec::Vec;
- use slice::CloneSliceExt;
-
- use unicode::char::UnicodeChar;
+ use prelude::*;
+ use core::default::Default;
+ use core::iter::AdditiveIterator;
+ use super::{eq_slice, from_utf8, is_utf8, is_utf16, raw};
+ use super::truncate_utf16_at_nul;
+ use super::{Owned, Slice};
#[test]
fn test_eq_slice() {
#[test]
fn test_lev_distance() {
- use std::char::{ from_u32, MAX };
+ use core::char::{ from_u32, MAX };
// Test bytelength agnosticity
for c in range(0u32, MAX as u32)
.filter_map(|i| from_u32(i))
#[test]
fn test_graphemes() {
- use std::iter::order;
+ use core::iter::order;
// official Unicode test data
// from http://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt
let test_same: [(_, &[_]), .. 325] = [
#[test]
fn test_str_default() {
- use std::default::Default;
+ use core::default::Default;
fn t<S: Default + Str>() {
let s: S = Default::default();
assert_eq!(s.as_slice(), "");
#[cfg(test)]
mod bench {
+ use prelude::*;
use test::Bencher;
use test::black_box;
use super::*;
- use std::iter::{IteratorExt, DoubleEndedIteratorExt};
- use std::str::StrPrelude;
- use std::slice::SliceExt;
#[bench]
fn char_iterator(b: &mut Bencher) {
#[cfg(test)]
mod tests {
- use std::prelude::*;
+ use prelude::*;
use test::Bencher;
- use slice::CloneSliceExt;
- use str::{Str, StrPrelude};
use str;
- use super::{as_string, String, ToString};
- use vec::Vec;
+ use super::as_string;
#[test]
fn test_as_string() {
#[cfg(test)]
mod tests {
- extern crate test;
-
- use std::prelude::*;
- use std::mem::size_of;
+ use prelude::*;
+ use core::mem::size_of;
use test::Bencher;
- use super::{as_vec, unzip, raw, Vec};
+ use super::{as_vec, unzip, raw};
struct DropCounter<'a> {
count: &'a mut int
#[cfg(test)]
mod test_map {
- use std::prelude::*;
- use vec::Vec;
+ use prelude::*;
use core::hash::hash;
use super::VecMap;
#[cfg(test)]
mod bench {
- extern crate test;
- use self::test::Bencher;
+ use test::Bencher;
use super::VecMap;
use bench::{insert_rand_n, insert_seq_n, find_rand_n, find_seq_n};
#[cfg(test)]
mod tests {
use test::Bencher;
- use std::prelude::*;
+ use prelude::*;
use std::fmt;
- use str::Str;
- use string::String;
- use slice::{AsSlice, SliceExt};
- use vec::Vec;
-
use super::super::{Hash, Writer};
use super::{SipState, hash, hash_with_keys};
use prelude::*;
use super::*;
use char::from_u32;
- use str::StrPrelude;
macro_rules! v2ascii {
( [$($e:expr),*]) => (&[$(Ascii{chr:$e}),*]);
#[cfg(test)]
#[allow(non_upper_case_globals)]
mod tests {
- use kinds::Copy;
use hash;
use option::Option::{Some, None};
use ops::{BitOr, BitAnd, BitXor, Sub, Not};
use super::HashMap;
use super::{Occupied, Vacant};
- use cmp::Equiv;
use hash;
- use iter::{Iterator,range_inclusive,range_step_inclusive};
+ use iter::{range_inclusive, range_step_inclusive};
use cell::RefCell;
use rand::{weak_rng, Rng};
use prelude::*;
use super::HashSet;
- use slice::PartialEqSliceExt;
#[test]
fn test_disjoint() {
use super::super::{IoResult, EndOfFile};
use super::super::mem::MemReader;
use self::test::Bencher;
- use str::StrPrelude;
/// A type, free to create, primarily intended for benchmarking creation of
/// wrappers that, just for construction, don't need a Reader/Writer that
use io;
use str;
use io::fs::*;
- use path::Path;
- use io;
- use ops::Drop;
- use str::StrPrelude;
macro_rules! check { ($e:expr) => (
match $e {
#[cfg(test)]
mod test {
- extern crate test;
+ extern crate "test" as test_crate;
use prelude::*;
use super::*;
use io::*;
use io;
- use self::test::Bencher;
- use str::StrPrelude;
+ use self::test_crate::Bencher;
#[test]
fn test_vec_writer() {
#[cfg(test)]
mod test {
- use super::*;
- use time::Duration;
- use task::spawn;
use prelude::*;
+ use super::Timer;
+ use time::Duration;
+
#[test]
fn test_io_timer_sleep_simple() {
let mut timer = Timer::new().unwrap();
pub use core::result;
pub use core::option;
-pub use alloc::boxed;
+#[cfg(not(test))] pub use alloc::boxed;
pub use alloc::rc;
pub use core_collections::slice;
mod tests {
use f32::*;
use num::*;
- use num;
#[test]
fn test_min_nan() {
}
#[test]
- fn test_num() {
- num::test_num(10f32, 2f32);
+ fn test_num_f32() {
+ test_num(10f32, 2f32);
}
#[test]
mod tests {
use f64::*;
use num::*;
- use num;
#[test]
fn test_min_nan() {
}
#[test]
- fn test_num() {
- num::test_num(10f64, 2f64);
+ fn test_num_f64() {
+ test_num(10f64, 2f64);
}
#[test]
#[cfg(test)]
mod tests {
use prelude::*;
- use c_str::ToCStr;
use option;
use os::{env, getcwd, getenv, make_absolute};
use os::{split_paths, join_paths, setenv, unsetenv};
#[cfg(test)]
mod tests {
use prelude::*;
- use super::{GenericPath, PosixPath, WindowsPath};
- use c_str::ToCStr;
#[test]
fn test_cstring() {
use prelude::*;
use super::*;
use str;
- use str::StrPrelude;
macro_rules! t {
(s: $path:expr, $exp:expr) => (
use prelude::*;
use sync::Future;
use task;
- use comm::channel;
#[test]
fn test_from_value() {
#[cfg(test)]
mod test {
- use core::prelude::*;
+ use prelude::*;
use super::*;
- use comm::channel;
- use iter::range;
const TEST_TASKS: uint = 4u;
#[cfg(test)]
mod test {
+ use prelude::*;
use any::{Any, AnyRefExt};
use boxed::BoxAny;
- use prelude::*;
- use result::Result::{Ok, Err};
use result;
use std::io::{ChanReader, ChanWriter};
- use string::String;
use thunk::Thunk;
use super::{Thread, Builder};
use owned_slice::OwnedSlice;
use ast;
use abi;
- use attr;
- use attr::AttrMetaMethods;
+ use attr::{first_attr_value_str_by_name, AttrMetaMethods};
use parse::parser::Parser;
use parse::token::{str_to_ident};
use print::pprust::view_item_to_string;
let name = "<source>".to_string();
let source = "/// doc comment\r\nfn foo() {}".to_string();
let item = parse_item_from_source_str(name.clone(), source, Vec::new(), &sess).unwrap();
- let doc = attr::first_attr_value_str_by_name(item.attrs.as_slice(), "doc").unwrap();
+ let doc = first_attr_value_str_by_name(item.attrs.as_slice(), "doc").unwrap();
assert_eq!(doc.get(), "/// doc comment");
let source = "/// doc comment\r\n/// line 2\r\nfn foo() {}".to_string();
let source = "/** doc comment\r\n * with CRLF */\r\nfn foo() {}".to_string();
let item = parse_item_from_source_str(name, source, Vec::new(), &sess).unwrap();
- let doc = attr::first_attr_value_str_by_name(item.attrs.as_slice(), "doc").unwrap();
+ let doc = first_attr_value_str_by_name(item.attrs.as_slice(), "doc").unwrap();
assert_eq!(doc.get(), "/** doc comment\n * with CRLF */");
}
}