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

chown: Fix error on mac

This commit is contained in:
Knight 2016-07-04 22:50:54 +08:00
parent 7e4a708e7c
commit f77c4f2b1a

View file

@ -13,12 +13,16 @@ mod test_passwd {
fn test_getuid() { fn test_getuid() {
assert_eq!(0, getuid("root").unwrap()); assert_eq!(0, getuid("root").unwrap());
assert!(getuid("88888888").is_err()); assert!(getuid("88888888").is_err());
assert!(getuid("agroupthatdoesntexist").is_err()); assert!(getuid("auserthatdoesntexist").is_err());
} }
#[test] #[test]
fn test_getgid() { fn test_getgid() {
assert_eq!(0, getgid("root").unwrap()); if cfg!(target_os = "macos") {
assert_eq!(0, getgid("wheel").unwrap());
} else {
assert_eq!(0, getgid("root").unwrap());
}
assert!(getgid("88888888").is_err()); assert!(getgid("88888888").is_err());
assert!(getgid("agroupthatdoesntexist").is_err()); assert!(getgid("agroupthatdoesntexist").is_err());
} }
@ -31,7 +35,11 @@ mod test_passwd {
#[test] #[test]
fn test_gid2grp() { fn test_gid2grp() {
assert_eq!("root", gid2grp(0).unwrap()); if cfg!(target_os = "macos") {
assert_eq!("wheel", gid2grp(0).unwrap());
} else {
assert_eq!("root", gid2grp(0).unwrap());
}
assert!(gid2grp(88888888).is_err()); assert!(gid2grp(88888888).is_err());
} }
} }