mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
feature(sync): add --data & --file-system (#1639)
This commit is contained in:
parent
89f8624936
commit
11ecf80a25
2 changed files with 123 additions and 9 deletions
|
@ -1,11 +1,39 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
use std::fs;
|
||||
extern crate tempfile;
|
||||
use self::tempfile::tempdir;
|
||||
|
||||
#[test]
|
||||
fn test_sync_default() {
|
||||
new_ucmd!().run();
|
||||
let result = new_ucmd!().run();
|
||||
assert!(result.success);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sync_incorrect_arg() {
|
||||
new_ucmd!().arg("--foo").fails();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sync_fs() {
|
||||
let temporary_directory = tempdir().unwrap();
|
||||
let temporary_path = fs::canonicalize(temporary_directory.path()).unwrap();
|
||||
let result = new_ucmd!().arg("--file-system").arg(&temporary_path).run();
|
||||
assert!(result.success);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sync_data() {
|
||||
// Todo add a second arg
|
||||
let temporary_directory = tempdir().unwrap();
|
||||
let temporary_path = fs::canonicalize(temporary_directory.path()).unwrap();
|
||||
let result = new_ucmd!().arg("--data").arg(&temporary_path).run();
|
||||
assert!(result.success);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sync_no_existing_files() {
|
||||
let result = new_ucmd!().arg("--data").arg("do-no-exist").fails();
|
||||
assert!(result.stderr.contains("error: cannot stat"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue