diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-12 03:17:57 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-12 03:17:57 +0000 |
commit | 50f55e77df63ed7ab9b8aad348653d44dce80ab2 (patch) | |
tree | 87cee38dfd2eb8c7995a1afd3dc3f479b74412ed /test/test_poll.rs | |
parent | 83407c536e6614c995e0271a984d568799076ab7 (diff) | |
parent | 37929c7dafd86571730e4f566ef520cf0139e008 (diff) | |
download | nix-50f55e77df63ed7ab9b8aad348653d44dce80ab2.zip |
Merge #1035
1035: Implement extra traits for all types r=asomers a=Susurrus
Now that I've gotten all the extra traits implemented for `libc`, they can be easily derived for `nix`'s types. Note that this requires a bump to the minimum supported Rust version, but it's still at least 2 versions behind, so it fits in with policy.
One thing I did notice is that we have an inconsistent approach to our newtypes, where some use a struct and some a tuple struct. We should be consistent here, and should probably use a tuple struct since the name of the single field is irrelevant. This style is already suggested in our `CONVENTIONS.md` doc, so this should be uncontroversial. I'll file a PR after this is merged adding that.
Co-authored-by: Bryant Mairs <bryant@mai.rs>
Diffstat (limited to 'test/test_poll.rs')
-rw-r--r-- | test/test_poll.rs | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/test/test_poll.rs b/test/test_poll.rs index 6cac3b77..aef40e47 100644 --- a/test/test_poll.rs +++ b/test/test_poll.rs @@ -1,5 +1,5 @@ use nix::poll::{PollFlags, poll, PollFd}; -use nix::unistd::{write, pipe, close}; +use nix::unistd::{write, pipe}; #[test] fn test_poll() { @@ -19,24 +19,6 @@ fn test_poll() { assert!(fds[0].revents().unwrap().contains(PollFlags::POLLIN)); } -#[test] -fn test_poll_debug() { - assert_eq!(format!("{:?}", PollFd::new(0, PollFlags::empty())), - "PollFd { fd: 0, events: (empty), revents: (empty) }"); - assert_eq!(format!("{:?}", PollFd::new(1, PollFlags::POLLIN)), - "PollFd { fd: 1, events: POLLIN, revents: (empty) }"); - - // Testing revents requires doing some I/O - let (r, w) = pipe().unwrap(); - let mut fds = [PollFd::new(r, PollFlags::POLLIN)]; - write(w, b" ").unwrap(); - close(w).unwrap(); - poll(&mut fds, -1).unwrap(); - assert_eq!(format!("{:?}", fds[0]), - format!("PollFd {{ fd: {}, events: POLLIN, revents: POLLIN | POLLHUP }}", r)); - close(r).unwrap(); -} - // ppoll(2) is the same as poll except for how it handles timeouts and signals. // Repeating the test for poll(2) should be sufficient to check that our // bindings are correct. |