diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2017-10-07 05:15:39 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2017-10-07 05:15:39 +0000 |
commit | 2166e71091d68ce3f1462c78a7f1ede5548c265b (patch) | |
tree | 1118f24d361e71f1e15adf298c550cf4cc35f54e /test/sys/test_aio.rs | |
parent | d3303c219ea74b41301afa2c6dc9f43bcb4a91ed (diff) | |
parent | 6bb37041ba0c5be864eec71418fb65b91994ed7f (diff) | |
download | nix-2166e71091d68ce3f1462c78a7f1ede5548c265b.zip |
Merge #773
773: Add more accessors for AioCb r=asomers a=asomers
Diffstat (limited to 'test/sys/test_aio.rs')
-rw-r--r-- | test/sys/test_aio.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/sys/test_aio.rs b/test/sys/test_aio.rs index b74e3f63..630dff9a 100644 --- a/test/sys/test_aio.rs +++ b/test/sys/test_aio.rs @@ -21,6 +21,28 @@ fn poll_aio(aiocb: &mut AioCb) -> Result<()> { } } +#[test] +fn test_accessors() { + let mut rbuf = vec![0; 4]; + let aiocb = AioCb::from_mut_slice( 1001, + 2, //offset + &mut rbuf, + 42, //priority + SigevNotify::SigevSignal { + signal: Signal::SIGUSR2, + si_value: 99 + }, + LioOpcode::LIO_NOP); + assert_eq!(1001, aiocb.fd()); + assert_eq!(Some(LioOpcode::LIO_NOP), aiocb.lio_opcode()); + assert_eq!(4, aiocb.nbytes()); + assert_eq!(2, aiocb.offset()); + assert_eq!(42, aiocb.priority()); + let sev = aiocb.sigevent().sigevent(); + assert_eq!(Signal::SIGUSR2 as i32, sev.sigev_signo); + assert_eq!(99, sev.sigev_value.sival_ptr as i64); +} + // Tests AioCb.cancel. We aren't trying to test the OS's implementation, only our // bindings. So it's sufficient to check that AioCb.cancel returned any // AioCancelStat value. |