1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-05 07:27:46 +00:00

Fix doc-test for entries on macOS

This commit is contained in:
Alex Lyon 2019-05-12 21:57:01 -07:00 committed by Roy Ivy III
parent cdafcce400
commit 12ce90d9cb
2 changed files with 11 additions and 4 deletions

View file

@ -9,7 +9,7 @@ task:
- sh rustup.sh -y - sh rustup.sh -y
build_script: build_script:
- . $HOME/.cargo/env - . $HOME/.cargo/env
- cargo build - cargo build --all-features
test_script: test_script:
- . $HOME/.cargo/env - . $HOME/.cargo/env
- cargo test - cargo test --all-features

View file

@ -11,10 +11,17 @@
//! //!
//! ``` //! ```
//! use uucore::entries::{self, Locate}; //! use uucore::entries::{self, Locate};
//!
//! let root_group = if cfg!(any(target_os = "linux", target_os = "android")) {
//! "root"
//! } else {
//! "wheel"
//! };
//!
//! assert_eq!("root", entries::uid2usr(0).unwrap()); //! assert_eq!("root", entries::uid2usr(0).unwrap());
//! assert_eq!(0, entries::usr2uid("root").unwrap()); //! assert_eq!(0, entries::usr2uid("root").unwrap());
//! assert!(entries::gid2grp(0).is_ok()); //! assert!(entries::gid2grp(0).is_ok());
//! assert!(entries::grp2gid("root").is_ok()); //! assert!(entries::grp2gid(root_group).is_ok());
//! //!
//! assert!(entries::Passwd::locate(0).is_ok()); //! assert!(entries::Passwd::locate(0).is_ok());
//! assert!(entries::Passwd::locate("0").is_ok()); //! assert!(entries::Passwd::locate("0").is_ok());
@ -22,7 +29,7 @@
//! //!
//! assert!(entries::Group::locate(0).is_ok()); //! assert!(entries::Group::locate(0).is_ok());
//! assert!(entries::Group::locate("0").is_ok()); //! assert!(entries::Group::locate("0").is_ok());
//! assert!(entries::Group::locate("root").is_ok()); //! assert!(entries::Group::locate(root_group).is_ok());
//! ``` //! ```
#[cfg(any(target_os = "freebsd", target_os = "macos"))] #[cfg(any(target_os = "freebsd", target_os = "macos"))]