mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 23:32:39 +00:00
Merge pull request #411 from Arcterus/mkdir-test-warn
Remove warnings from the mkdir tests
This commit is contained in:
commit
ab1d224c49
1 changed files with 23 additions and 23 deletions
|
@ -1,12 +1,12 @@
|
||||||
use std::io::process::Command;
|
use std::io::process::Command;
|
||||||
use std::io::fs::{rmdir, PathExtensions};
|
use std::io::fs::{rmdir, PathExtensions};
|
||||||
|
|
||||||
static exe: &'static str = "./mkdir";
|
static EXE: &'static str = "./mkdir";
|
||||||
static test_dir1: &'static str = "mkdir_test1";
|
static TEST_DIR1: &'static str = "mkdir_test1";
|
||||||
static test_dir2: &'static str = "mkdir_test2";
|
static TEST_DIR2: &'static str = "mkdir_test2";
|
||||||
static test_dir3: &'static str = "mkdir_test3";
|
static TEST_DIR3: &'static str = "mkdir_test3";
|
||||||
static test_dir4: &'static str = "mkdir_test4/mkdir_test4_1";
|
static TEST_DIR4: &'static str = "mkdir_test4/mkdir_test4_1";
|
||||||
static test_dir5: &'static str = "mkdir_test5/mkdir_test5_1";
|
static TEST_DIR5: &'static str = "mkdir_test5/mkdir_test5_1";
|
||||||
|
|
||||||
fn cleanup(dir: &'static str) {
|
fn cleanup(dir: &'static str) {
|
||||||
let d = dir.into_string();
|
let d = dir.into_string();
|
||||||
|
@ -18,51 +18,51 @@ fn cleanup(dir: &'static str) {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mkdir_mkdir() {
|
fn test_mkdir_mkdir() {
|
||||||
cleanup(test_dir1);
|
cleanup(TEST_DIR1);
|
||||||
let prog = Command::new(exe).arg(test_dir1).status();
|
let prog = Command::new(EXE).arg(TEST_DIR1).status();
|
||||||
let exit_success = prog.unwrap().success();
|
let exit_success = prog.unwrap().success();
|
||||||
cleanup(test_dir1);
|
cleanup(TEST_DIR1);
|
||||||
assert_eq!(exit_success, true);
|
assert_eq!(exit_success, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mkdir_dup_dir() {
|
fn test_mkdir_dup_dir() {
|
||||||
cleanup(test_dir2);
|
cleanup(TEST_DIR2);
|
||||||
let prog = Command::new(exe).arg(test_dir2).status();
|
let prog = Command::new(EXE).arg(TEST_DIR2).status();
|
||||||
let exit_success = prog.unwrap().success();
|
let exit_success = prog.unwrap().success();
|
||||||
if !exit_success {
|
if !exit_success {
|
||||||
cleanup(test_dir2);
|
cleanup(TEST_DIR2);
|
||||||
fail!();
|
fail!();
|
||||||
}
|
}
|
||||||
let prog2 = Command::new(exe).arg(test_dir2).status();
|
let prog2 = Command::new(EXE).arg(TEST_DIR2).status();
|
||||||
let exit_success2 = prog2.unwrap().success();
|
let exit_success2 = prog2.unwrap().success();
|
||||||
cleanup(test_dir2);
|
cleanup(TEST_DIR2);
|
||||||
assert_eq!(exit_success2, false);
|
assert_eq!(exit_success2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mkdir_mode() {
|
fn test_mkdir_mode() {
|
||||||
cleanup(test_dir3);
|
cleanup(TEST_DIR3);
|
||||||
let prog = Command::new(exe).arg("-m").arg("755").arg(test_dir3).status();
|
let prog = Command::new(EXE).arg("-m").arg("755").arg(TEST_DIR3).status();
|
||||||
let exit_success = prog.unwrap().success();
|
let exit_success = prog.unwrap().success();
|
||||||
cleanup(test_dir3);
|
cleanup(TEST_DIR3);
|
||||||
assert_eq!(exit_success, true);
|
assert_eq!(exit_success, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mkdir_parent() {
|
fn test_mkdir_parent() {
|
||||||
cleanup(test_dir4);
|
cleanup(TEST_DIR4);
|
||||||
let prog = Command::new(exe).arg("-p").arg(test_dir4).status();
|
let prog = Command::new(EXE).arg("-p").arg(TEST_DIR4).status();
|
||||||
let exit_success = prog.unwrap().success();
|
let exit_success = prog.unwrap().success();
|
||||||
cleanup(test_dir4);
|
cleanup(TEST_DIR4);
|
||||||
assert_eq!(exit_success, true);
|
assert_eq!(exit_success, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mkdir_no_parent() {
|
fn test_mkdir_no_parent() {
|
||||||
cleanup(test_dir5);
|
cleanup(TEST_DIR5);
|
||||||
let prog = Command::new(exe).arg(test_dir5).status();
|
let prog = Command::new(EXE).arg(TEST_DIR5).status();
|
||||||
let exit_success = prog.unwrap().success();
|
let exit_success = prog.unwrap().success();
|
||||||
cleanup(test_dir5);
|
cleanup(TEST_DIR5);
|
||||||
assert_eq!(exit_success, false);
|
assert_eq!(exit_success, false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue