From f77c4f2b1ab5c037e44455336cc4cde0572b5958 Mon Sep 17 00:00:00 2001 From: Knight Date: Mon, 4 Jul 2016 22:50:54 +0800 Subject: [PATCH] chown: Fix error on mac --- tests/test_chown.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/test_chown.rs b/tests/test_chown.rs index fc978eee2..0d90f6b5a 100644 --- a/tests/test_chown.rs +++ b/tests/test_chown.rs @@ -13,12 +13,16 @@ mod test_passwd { fn test_getuid() { assert_eq!(0, getuid("root").unwrap()); assert!(getuid("88888888").is_err()); - assert!(getuid("agroupthatdoesntexist").is_err()); + assert!(getuid("auserthatdoesntexist").is_err()); } #[test] 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("agroupthatdoesntexist").is_err()); } @@ -31,7 +35,11 @@ mod test_passwd { #[test] 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()); } }