Fix fallout of removing import_shadowing in tests.
This commit is contained in:
parent
f95e0c21aa
commit
b45d30da34
33 changed files with 97 additions and 116 deletions
|
@ -8,7 +8,7 @@
|
|||
// 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;
|
||||
|
|
|
@ -617,10 +617,9 @@ impl<T: Ord> Extend<T> for BinaryHeap<T> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::prelude::*;
|
||||
use prelude::*;
|
||||
|
||||
use super::BinaryHeap;
|
||||
use vec::Vec;
|
||||
|
||||
#[test]
|
||||
fn test_iterator() {
|
||||
|
|
|
@ -1686,16 +1686,15 @@ impl<'a> Iterator<uint> for TwoBitPositions<'a> {
|
|||
|
||||
#[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;
|
||||
|
||||
|
@ -2038,7 +2037,7 @@ mod tests {
|
|||
#[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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1335,7 +1335,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use std::prelude::*;
|
||||
use prelude::*;
|
||||
|
||||
use super::{BTreeMap, Occupied, Vacant};
|
||||
|
||||
|
@ -1537,7 +1537,7 @@ mod test {
|
|||
|
||||
#[cfg(test)]
|
||||
mod bench {
|
||||
use std::prelude::*;
|
||||
use prelude::*;
|
||||
use std::rand::{weak_rng, Rng};
|
||||
use test::{Bencher, black_box};
|
||||
|
||||
|
|
|
@ -726,7 +726,7 @@ impl<'a, T: Ord> Iterator<&'a T> for UnionItems<'a, T> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use std::prelude::*;
|
||||
use prelude::*;
|
||||
|
||||
use super::BTreeSet;
|
||||
use std::hash;
|
||||
|
|
|
@ -788,14 +788,14 @@ impl<S: Writer, A: Hash<S>> Hash<S> for DList<A> {
|
|||
|
||||
#[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;
|
||||
|
|
|
@ -295,9 +295,9 @@ impl<E:CLike> Extend<E> for EnumSet<E> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use std::prelude::*;
|
||||
use self::Foo::*;
|
||||
use std::mem;
|
||||
use prelude::*;
|
||||
use core::mem;
|
||||
|
||||
use super::{EnumSet, CLike};
|
||||
|
||||
|
|
|
@ -95,3 +95,41 @@ mod std {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -1260,18 +1260,17 @@ impl<T: fmt::Show> fmt::Show for RingBuf<T> {
|
|||
|
||||
#[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)]
|
||||
|
@ -1791,7 +1790,7 @@ mod tests {
|
|||
|
||||
#[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();
|
||||
|
|
|
@ -1343,16 +1343,13 @@ pub mod raw {
|
|||
#[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 }
|
||||
|
||||
|
@ -2764,14 +2761,12 @@ mod tests {
|
|||
|
||||
#[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
|
||||
|
|
|
@ -837,25 +837,12 @@ impl<'a> StrAllocating for &'a str {
|
|||
|
||||
#[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() {
|
||||
|
@ -1829,7 +1816,7 @@ mod tests {
|
|||
|
||||
#[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))
|
||||
|
@ -1939,7 +1926,7 @@ mod tests {
|
|||
|
||||
#[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] = [
|
||||
|
@ -2370,7 +2357,7 @@ mod tests {
|
|||
|
||||
#[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(), "");
|
||||
|
@ -2470,12 +2457,10 @@ mod tests {
|
|||
|
||||
#[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) {
|
||||
|
|
|
@ -1040,14 +1040,11 @@ pub mod raw {
|
|||
|
||||
#[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() {
|
||||
|
|
|
@ -1805,12 +1805,10 @@ impl<'a> fmt::FormatWriter for Vec<u8> {
|
|||
|
||||
#[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
|
||||
|
|
|
@ -672,8 +672,7 @@ impl<V> DoubleEndedIterator<(uint, V)> for MoveItems<V> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test_map {
|
||||
use std::prelude::*;
|
||||
use vec::Vec;
|
||||
use prelude::*;
|
||||
use core::hash::hash;
|
||||
|
||||
use super::VecMap;
|
||||
|
@ -1046,8 +1045,7 @@ mod test_map {
|
|||
|
||||
#[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};
|
||||
|
||||
|
|
|
@ -271,14 +271,9 @@ pub fn hash_with_keys<Sized? T: Hash<SipState>>(k0: u64, k1: u64, value: &T) ->
|
|||
#[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};
|
||||
|
||||
|
|
|
@ -633,7 +633,6 @@ mod tests {
|
|||
use prelude::*;
|
||||
use super::*;
|
||||
use char::from_u32;
|
||||
use str::StrPrelude;
|
||||
|
||||
macro_rules! v2ascii {
|
||||
( [$($e:expr),*]) => (&[$(Ascii{chr:$e}),*]);
|
||||
|
|
|
@ -315,7 +315,6 @@ macro_rules! bitflags {
|
|||
#[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};
|
||||
|
|
|
@ -1428,9 +1428,8 @@ mod test_map {
|
|||
|
||||
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};
|
||||
|
||||
|
|
|
@ -678,7 +678,6 @@ mod test_set {
|
|||
use prelude::*;
|
||||
|
||||
use super::HashSet;
|
||||
use slice::PartialEqSliceExt;
|
||||
|
||||
#[test]
|
||||
fn test_disjoint() {
|
||||
|
|
|
@ -409,7 +409,6 @@ mod test {
|
|||
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
|
||||
|
|
|
@ -823,10 +823,6 @@ mod test {
|
|||
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 {
|
||||
|
|
|
@ -398,13 +398,12 @@ impl<'a> Buffer for BufReader<'a> {
|
|||
|
||||
#[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() {
|
||||
|
|
|
@ -225,11 +225,11 @@ fn in_ms_u64(d: Duration) -> u64 {
|
|||
|
||||
#[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();
|
||||
|
|
|
@ -157,7 +157,7 @@ pub use core::unit;
|
|||
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;
|
||||
|
|
|
@ -349,7 +349,6 @@ pub fn to_str_exp_digits(num: f32, dig: uint, upper: bool) -> String {
|
|||
mod tests {
|
||||
use f32::*;
|
||||
use num::*;
|
||||
use num;
|
||||
|
||||
#[test]
|
||||
fn test_min_nan() {
|
||||
|
@ -364,8 +363,8 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_num() {
|
||||
num::test_num(10f32, 2f32);
|
||||
fn test_num_f32() {
|
||||
test_num(10f32, 2f32);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -357,7 +357,6 @@ pub fn to_str_exp_digits(num: f64, dig: uint, upper: bool) -> String {
|
|||
mod tests {
|
||||
use f64::*;
|
||||
use num::*;
|
||||
use num;
|
||||
|
||||
#[test]
|
||||
fn test_min_nan() {
|
||||
|
@ -372,8 +371,8 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_num() {
|
||||
num::test_num(10f64, 2f64);
|
||||
fn test_num_f64() {
|
||||
test_num(10f64, 2f64);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -1425,7 +1425,6 @@ mod arch_consts {
|
|||
#[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};
|
||||
|
|
|
@ -931,8 +931,6 @@ fn contains_nul<T: BytesContainer>(v: &T) -> bool {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::*;
|
||||
use super::{GenericPath, PosixPath, WindowsPath};
|
||||
use c_str::ToCStr;
|
||||
|
||||
#[test]
|
||||
fn test_cstring() {
|
||||
|
|
|
@ -445,7 +445,6 @@ mod tests {
|
|||
use prelude::*;
|
||||
use super::*;
|
||||
use str;
|
||||
use str::StrPrelude;
|
||||
|
||||
macro_rules! t {
|
||||
(s: $path:expr, $exp:expr) => (
|
||||
|
|
|
@ -153,7 +153,6 @@ mod test {
|
|||
use prelude::*;
|
||||
use sync::Future;
|
||||
use task;
|
||||
use comm::channel;
|
||||
|
||||
#[test]
|
||||
fn test_from_value() {
|
||||
|
|
|
@ -131,10 +131,8 @@ fn spawn_in_pool(jobs: Arc<Mutex<Receiver<Thunk>>>) {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use core::prelude::*;
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
use comm::channel;
|
||||
use iter::range;
|
||||
|
||||
const TEST_TASKS: uint = 4u;
|
||||
|
||||
|
|
|
@ -428,13 +428,11 @@ impl<T: Send> Drop for JoinGuard<T> {
|
|||
|
||||
#[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};
|
||||
|
||||
|
|
|
@ -745,8 +745,7 @@ mod test {
|
|||
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;
|
||||
|
@ -1195,7 +1194,7 @@ mod test {
|
|||
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();
|
||||
|
@ -1207,7 +1206,7 @@ mod test {
|
|||
|
||||
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 */");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue