Add a test for size_of Option<ThreadId>

This commit is contained in:
Simon Sapin 2019-03-20 19:04:38 +01:00
parent 8cf720bd19
commit c1d9191fa5

View file

@ -1485,9 +1485,10 @@ fn _assert_sync_and_send() {
mod tests {
use super::Builder;
use crate::any::Any;
use crate::mem;
use crate::sync::mpsc::{channel, Sender};
use crate::result;
use crate::thread;
use crate::thread::{self, ThreadId};
use crate::time::Duration;
use crate::u32;
@ -1717,6 +1718,11 @@ mod tests {
thread::sleep(Duration::from_millis(2));
}
#[test]
fn test_size_of_option_thread_id() {
assert_eq!(mem::size_of::<Option<ThreadId>>(), mem::size_of::<ThreadId>());
}
#[test]
fn test_thread_id_equal() {
assert!(thread::current().id() == thread::current().id());