summaryrefslogtreecommitdiff
path: root/test/test_poll.rs
diff options
context:
space:
mode:
authorAmanjeev Sethi <aj@amanjeev.com>2019-02-10 22:44:18 -0500
committerAmanjeev Sethi <aj@amanjeev.com>2019-02-12 15:25:47 -0500
commit1b2fadd21a7f8784624d81094255530bb2cdca23 (patch)
tree36e28968d8d1ceefaf745e3bbb294f3731c4eece /test/test_poll.rs
parent7ae7a1f9554a06d947da9cb0a496a1e2e264982a (diff)
downloadnix-1b2fadd21a7f8784624d81094255530bb2cdca23.zip
`PollFd` event flags renamed to `PollFlags` from `EventFlags`.
Most of the EventFlags have been renamed already, but Poll was the only one remaining. This commit fixes that. Issue 317 https://github.com/nix-rust/nix/issues/317
Diffstat (limited to 'test/test_poll.rs')
-rw-r--r--test/test_poll.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/test_poll.rs b/test/test_poll.rs
index 23df1517..6cac3b77 100644
--- a/test/test_poll.rs
+++ b/test/test_poll.rs
@@ -1,34 +1,34 @@
-use nix::poll::{EventFlags, poll, PollFd};
+use nix::poll::{PollFlags, poll, PollFd};
use nix::unistd::{write, pipe, close};
#[test]
fn test_poll() {
let (r, w) = pipe().unwrap();
- let mut fds = [PollFd::new(r, EventFlags::POLLIN)];
+ let mut fds = [PollFd::new(r, PollFlags::POLLIN)];
// Poll an idle pipe. Should timeout
let nfds = poll(&mut fds, 100).unwrap();
assert_eq!(nfds, 0);
- assert!(!fds[0].revents().unwrap().contains(EventFlags::POLLIN));
+ assert!(!fds[0].revents().unwrap().contains(PollFlags::POLLIN));
write(w, b".").unwrap();
// Poll a readable pipe. Should return an event.
let nfds = poll(&mut fds, 100).unwrap();
assert_eq!(nfds, 1);
- assert!(fds[0].revents().unwrap().contains(EventFlags::POLLIN));
+ assert!(fds[0].revents().unwrap().contains(PollFlags::POLLIN));
}
#[test]
fn test_poll_debug() {
- assert_eq!(format!("{:?}", PollFd::new(0, EventFlags::empty())),
+ assert_eq!(format!("{:?}", PollFd::new(0, PollFlags::empty())),
"PollFd { fd: 0, events: (empty), revents: (empty) }");
- assert_eq!(format!("{:?}", PollFd::new(1, EventFlags::POLLIN)),
+ 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, EventFlags::POLLIN)];
+ let mut fds = [PollFd::new(r, PollFlags::POLLIN)];
write(w, b" ").unwrap();
close(w).unwrap();
poll(&mut fds, -1).unwrap();
@@ -52,17 +52,17 @@ fn test_ppoll() {
let timeout = TimeSpec::milliseconds(1);
let (r, w) = pipe().unwrap();
- let mut fds = [PollFd::new(r, EventFlags::POLLIN)];
+ let mut fds = [PollFd::new(r, PollFlags::POLLIN)];
// Poll an idle pipe. Should timeout
let nfds = ppoll(&mut fds, timeout, SigSet::empty()).unwrap();
assert_eq!(nfds, 0);
- assert!(!fds[0].revents().unwrap().contains(EventFlags::POLLIN));
+ assert!(!fds[0].revents().unwrap().contains(PollFlags::POLLIN));
write(w, b".").unwrap();
// Poll a readable pipe. Should return an event.
let nfds = ppoll(&mut fds, timeout, SigSet::empty()).unwrap();
assert_eq!(nfds, 1);
- assert!(fds[0].revents().unwrap().contains(EventFlags::POLLIN));
+ assert!(fds[0].revents().unwrap().contains(PollFlags::POLLIN));
}