2
0
Fork 0
mirror of https://github.com/uutils/coreutils synced 2024-12-29 14:33:19 +00:00
coreutils/tests/by-util/test_sync.rs

42 lines
915 B
Rust
Raw Normal View History

use crate::common::util::*;
extern crate tempfile;
use std::fs;
use tempfile::tempdir;
#[test]
fn test_sync_default() {
2021-04-17 23:28:06 +00:00
new_ucmd!().succeeds();
}
#[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();
2021-04-17 23:28:06 +00:00
new_ucmd!()
.arg("--file-system")
.arg(&temporary_path)
.succeeds();
}
#[test]
fn test_sync_data() {
// Todo add a second arg
let temporary_directory = tempdir().unwrap();
let temporary_path = fs::canonicalize(temporary_directory.path()).unwrap();
2021-04-17 23:28:06 +00:00
new_ucmd!().arg("--data").arg(&temporary_path).succeeds();
}
#[test]
fn test_sync_no_existing_files() {
2021-04-17 23:28:06 +00:00
new_ucmd!()
.arg("--data")
.arg("do-no-exist")
.fails()
2021-05-26 00:07:49 +00:00
.stderr_contains("cannot stat");
}