()
| 238 | |
| 239 | #[test] |
| 240 | fn clear_resets_without_dealloc() { |
| 241 | let mut buf = AlignedBuf::with_default_alignment(8192).unwrap(); |
| 242 | let ptr_before = buf.as_ptr(); |
| 243 | buf.write(b"some data"); |
| 244 | buf.clear(); |
| 245 | assert_eq!(buf.len(), 0); |
| 246 | assert!(buf.is_empty()); |
| 247 | assert_eq!(buf.as_ptr(), ptr_before); // Same allocation. |
| 248 | } |
| 249 | } |