Skip to content

Commit

Permalink
Test that data is recvable after sender is dropped
Browse files Browse the repository at this point in the history
Add test for servo#30. Test that data can be retrieved from the receiver
after the sender has been dropped.
  • Loading branch information
dlrobertson committed Mar 28, 2016
1 parent dbe1874 commit a97a2b2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*~
*.swp
*.swo
target
Cargo.lock
11 changes: 11 additions & 0 deletions test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,3 +456,14 @@ fn embedded_bytes_receivers() {
assert_eq!(&bytes, &received_bytes[..]);
}

#[test]
fn test_so_linger() {
let (sender, receiver) = ipc::channel().unwrap();
sender.send(42).unwrap();
drop(sender);
let val = match receiver.recv() {
Ok(val) => val,
Err(e) => { panic!("err: `{}`", e); }
};
assert_eq!(val, 42);
}

0 comments on commit a97a2b2

Please sign in to comment.