1
Fork 0
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:
Sylvestre Ledru 2020-11-29 16:32:21 +01:00 committed by GitHub
parent 89f8624936
commit 11ecf80a25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 123 additions and 9 deletions

View file

@ -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"));
}