Debian Codegraph @

.cargo/vendor/anyhow/tests/test_repr.rs

raw
1 #![allow(clippy::extra_unused_type_parameters)]
2
3 mod drop;
4
5 use self::drop::{DetectDrop, Flag};
6 use anyhow::Error;
7 use std::mem;
8
9 #[test]
10 fn test_error_size() {
11 assert_eq!(mem::size_of::<Error>(), mem::size_of::<usize>());
12 }
13
14 #[test]
15 fn test_null_pointer_optimization() {
16 assert_eq!(mem::size_of::<Result<(), Error>>(), mem::size_of::<usize>());
17 }
18
19 #[test]
20 fn test_autotraits() {
21 fn assert<E: Unpin + Send + Sync + 'static>() {}
22 assert::<Error>();
23 }
24
25 #[test]
26 fn test_drop() {
27 let has_dropped = Flag::new();
28 drop(Error::new(DetectDrop::new(&has_dropped)));
29 assert!(has_dropped.get());
30 }