mirror of
https://github.com/uutils/coreutils
synced 2024-11-15 17:28:03 +00:00
Move common methods into test library.
This commit is contained in:
parent
c3802bb69c
commit
4aed2eafa8
2 changed files with 17 additions and 12 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue