diff --git a/tests/common/macros.rs b/tests/common/macros.rs old mode 100755 new mode 100644 diff --git a/tests/common/util.rs b/tests/common/util.rs old mode 100755 new mode 100644 index 1193b79b0..76af81e18 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -1,4 +1,5 @@ #![allow(dead_code)] +extern crate tempdir; use std::env; use std::fs::{self, File, OpenOptions}; @@ -14,7 +15,7 @@ use std::ffi::OsStr; use std::rc::Rc; use std::thread::sleep; use std::time::Duration; -use tempdir::TempDir; +use self::tempdir::TempDir; #[cfg(windows)] static PROGNAME: &'static str = "uutils.exe"; @@ -64,7 +65,7 @@ impl CmdResult { assert!(!self.success); Box::new(self) } - + /// asserts that the command resulted in empty (zero-length) stderr stream output /// generally, it's better to use stdout_only() instead, /// but you might find yourself using this function if @@ -74,7 +75,7 @@ impl CmdResult { assert_eq!(0, self.stderr.len()); Box::new(self) } - + /// asserts that the command resulted in empty (zero-length) stderr stream output /// unless asserting there was neither stdout or stderr, stderr_only is usually a better choice /// generally, it's better to use stderr_only() instead, @@ -93,7 +94,7 @@ impl CmdResult { assert_eq!(String::from(msg.as_ref()).trim_right(), self.stdout.trim_right()); Box::new(self) } - + /// like stdout_is(...), but expects the contents of the file at the provided relative path pub fn stdout_is_fixture>(&self, file_rel_path: T) -> Box<&CmdResult> { let contents = read_scenario_fixture(&self.tmpd, file_rel_path); diff --git a/tests/test_factor.rs b/tests/test_factor.rs index 33b8a2418..1912a24e5 100644 --- a/tests/test_factor.rs +++ b/tests/test_factor.rs @@ -8,9 +8,14 @@ // use common::util::*; -use rand::{weak_rng, Rng}; -use rand::distributions::{IndependentSample, Range}; -use sieve::Sieve; + +#[path="../src/factor/sieve.rs"] +mod sieve; +use self::sieve::Sieve; + +extern crate rand; +use self::rand::{weak_rng, Rng}; +use self::rand::distributions::{IndependentSample, Range}; const NUM_PRIMES: usize = 10000; const LOG_PRIMES: f64 = 14.0; // ceil(log2(NUM_PRIMES)) diff --git a/tests/test_mktemp.rs b/tests/test_mktemp.rs index 99c4f0a70..0783c5d2c 100644 --- a/tests/test_mktemp.rs +++ b/tests/test_mktemp.rs @@ -1,5 +1,6 @@ use common::util::*; -use tempdir::TempDir; +extern crate tempdir; +use self::tempdir::TempDir; static UTIL_NAME: &'static str = "mktemp"; diff --git a/tests/test_split.rs b/tests/test_split.rs index a01817a79..582f3e0b1 100644 --- a/tests/test_split.rs +++ b/tests/test_split.rs @@ -4,8 +4,8 @@ extern crate regex; use std::fs::{File, read_dir}; use std::io::{Read, Write}; use std::path::Path; -use rand::{Rng, thread_rng}; -use regex::Regex; +use self::rand::{Rng, thread_rng}; +use self::regex::Regex; use common::util::*; static UTIL_NAME: &'static str = "split"; diff --git a/tests/tests.rs b/tests/tests.rs index b9145f8a0..86f489fa0 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1,19 +1,6 @@ -extern crate filetime; -extern crate libc; -extern crate rand; -extern crate regex; -extern crate tempdir; -extern crate time; - -#[cfg(windows)] extern crate kernel32; -#[cfg(windows)] extern crate winapi; - #[macro_use] mod common; -#[path="../src/factor/sieve.rs"] -mod sieve; - // For conditional compilation macro_rules! unix_only { ($($fea:expr, $m:ident);+) => {