| 43 | // removed on Windows. |
| 44 | #ifndef __WINDOWS__ |
| 45 | TEST_F(IOTest, Poll) |
| 46 | { |
| 47 | int pipes[2]; |
| 48 | ASSERT_NE(-1, pipe(pipes)); |
| 49 | |
| 50 | // Test discard when polling. |
| 51 | Future<short> future = io::poll(pipes[0], io::READ); |
| 52 | EXPECT_TRUE(future.isPending()); |
| 53 | future.discard(); |
| 54 | AWAIT_DISCARDED(future); |
| 55 | |
| 56 | // Test successful polling. |
| 57 | future = io::poll(pipes[0], io::READ); |
| 58 | EXPECT_TRUE(future.isPending()); |
| 59 | ASSERT_EQ(3, write(pipes[1], "hi", 3)); |
| 60 | AWAIT_EXPECT_EQ(io::READ, future); |
| 61 | |
| 62 | ASSERT_SOME(os::close(pipes[0])); |
| 63 | ASSERT_SOME(os::close(pipes[1])); |
| 64 | } |
| 65 | #endif // __WINDOWS__ |
| 66 | |
| 67 |
no test coverage detected