mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
tests ~ reorganize tests
This commit is contained in:
parent
1c88bc8c45
commit
de0375f909
75 changed files with 0 additions and 0 deletions
48
tests/by-util/test_chown.rs
Normal file
48
tests/by-util/test_chown.rs
Normal file
|
@ -0,0 +1,48 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
extern crate chown;
|
||||
// pub use self::uu_chown::*;
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_passgrp {
|
||||
use super::chown::entries::{gid2grp, grp2gid, uid2usr, usr2uid};
|
||||
|
||||
#[test]
|
||||
fn test_usr2uid() {
|
||||
assert_eq!(0, usr2uid("root").unwrap());
|
||||
assert!(usr2uid("88888888").is_err());
|
||||
assert!(usr2uid("auserthatdoesntexist").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_grp2gid() {
|
||||
if cfg!(target_os = "linux") || cfg!(target_os = "android") || cfg!(target_os = "windows") {
|
||||
assert_eq!(0, grp2gid("root").unwrap())
|
||||
} else {
|
||||
assert_eq!(0, grp2gid("wheel").unwrap());
|
||||
}
|
||||
assert!(grp2gid("88888888").is_err());
|
||||
assert!(grp2gid("agroupthatdoesntexist").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_uid2usr() {
|
||||
assert_eq!("root", uid2usr(0).unwrap());
|
||||
assert!(uid2usr(88888888).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gid2grp() {
|
||||
if cfg!(target_os = "linux") || cfg!(target_os = "android") || cfg!(target_os = "windows") {
|
||||
assert_eq!("root", gid2grp(0).unwrap());
|
||||
} else {
|
||||
assert_eq!("wheel", gid2grp(0).unwrap());
|
||||
}
|
||||
assert!(gid2grp(88888888).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_option() {
|
||||
new_ucmd!().arg("-w").arg("-q").arg("/").fails();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue