Skip to content

Commit 895e2c2

Browse files
committed
test: test user passwd on cygwin
1 parent 609242e commit 895e2c2

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

test/test_unistd.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -1223,15 +1223,18 @@ fn test_access_file_exists() {
12231223
}
12241224

12251225
#[cfg(not(target_os = "redox"))]
1226-
#[cfg_attr(target_os = "cygwin", ignore)]
12271226
#[test]
12281227
fn test_user_into_passwd() {
1229-
// get the UID of the "nobody" user
1230-
#[cfg(not(target_os = "haiku"))]
1231-
let test_username = "nobody";
1232-
// "nobody" unavailable on haiku
1233-
#[cfg(target_os = "haiku")]
1234-
let test_username = "user";
1228+
let test_username = if cfg!(target_os = "haiku") {
1229+
// "nobody" unavailable on haiku
1230+
"user"
1231+
} else if cfg!(target_os = "cygwin") {
1232+
// the Windows admin user
1233+
"Administrator"
1234+
} else {
1235+
// get the UID of the "nobody" user
1236+
"nobody"
1237+
};
12351238

12361239
let nobody = User::from_name(test_username).unwrap().unwrap();
12371240
let pwd: libc::passwd = nobody.into();

0 commit comments

Comments
 (0)