Skip to content

Commit

Permalink
Remove test of impl Debug for PollFd
Browse files Browse the repository at this point in the history
As this is now derived, having a test is unnecessary
  • Loading branch information
Susurrus committed Jun 4, 2019
1 parent c3b1d2e commit 9760a30
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions test/test_poll.rs
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -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.
Expand Down

0 comments on commit 9760a30

Please sign in to comment.