mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
tests: extern crates in separated test modules
This commit is contained in:
Executable → Regular
Executable → Regular
+5
-4
@@ -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<T: AsRef<OsStr>>(&self, file_rel_path: T) -> Box<&CmdResult> {
|
||||
let contents = read_scenario_fixture(&self.tmpd, file_rel_path);
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use common::util::*;
|
||||
use tempdir::TempDir;
|
||||
extern crate tempdir;
|
||||
use self::tempdir::TempDir;
|
||||
|
||||
static UTIL_NAME: &'static str = "mktemp";
|
||||
|
||||
|
||||
+2
-2
@@ -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";
|
||||
|
||||
@@ -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);+) => {
|
||||
|
||||
Reference in New Issue
Block a user