diff --git a/test/common/util.rs b/test/common/util.rs index 75a609b5c..f8db8a8a8 100644 --- a/test/common/util.rs +++ b/test/common/util.rs @@ -1,5 +1,6 @@ #![allow(dead_code)] +use std::env; use std::fs::{self, File}; use std::io::{Read, Write}; #[cfg(unix)] @@ -93,3 +94,15 @@ pub fn cleanup(path: &'static str) { Err(_) => {} } } + +pub fn current_directory() -> String { + env::current_dir().unwrap().into_os_string().into_string().unwrap() +} + +pub fn repeat_str(s: &str, n: u32) -> String { + let mut repeated = String::new(); + for _ in 0 .. n { + repeated.push_str(s); + } + repeated +} diff --git a/test/readlink.rs b/test/readlink.rs index 3e495cbec..6471d1d92 100644 --- a/test/readlink.rs +++ b/test/readlink.rs @@ -1,21 +1,13 @@ -use std::env; use std::process::Command; use std::str; +use util::*; static PROGNAME: &'static str = "./readlink"; static GIBBERISH: &'static str = "supercalifragilisticexpialidocious"; -fn current_directory() -> String { - env::current_dir().unwrap().into_os_string().into_string().unwrap() -} - -fn repeat_str(s: &str, n: u32) -> String { - let mut repeated = String::new(); - for _ in 0 .. n { - repeated.push_str(s); - } - repeated -} +#[path = "common/util.rs"] +#[macro_use] +mod util; #[test] fn test_canonicalize() {