1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

feature(install): install group support

This commit is contained in:
Sylvestre Ledru 2020-11-16 22:54:41 +01:00
parent 763de90fda
commit 015e18731f
3 changed files with 62 additions and 33 deletions

View file

@ -1,5 +1,6 @@
use crate::common::util::*;
use std::os::unix::fs::PermissionsExt;
use rust_users::*;
#[test]
fn test_install_help() {
@ -206,6 +207,27 @@ fn test_install_target_new_file() {
assert!(at.file_exists(&format!("{}/{}", dir, file)));
}
#[test]
fn test_install_target_new_file_with_group() {
let (at, mut ucmd) = at_and_ucmd!();
let file = "test_install_target_new_filer_file_j";
let dir = "test_install_target_new_file_dir_j";
let gid = get_effective_gid();
at.touch(file);
at.mkdir(dir);
ucmd.arg(file)
.arg("--group")
.arg(gid.to_string())
.arg(format!("{}/{}", dir, file))
.succeeds()
.no_stderr();
assert!(at.file_exists(file));
assert!(at.file_exists(&format!("{}/{}", dir, file)));
}
#[test]
fn test_install_target_new_file_failing_nonexistent_parent() {
let (at, mut ucmd) = at_and_ucmd!();