From 1b2fadd21a7f8784624d81094255530bb2cdca23 Mon Sep 17 00:00:00 2001 From: Amanjeev Sethi Date: Sun, 10 Feb 2019 22:44:18 -0500 Subject: `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 --- test/test_poll.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'test/test_poll.rs') 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)); } -- cgit v1.2.3