]> git.lizzy.rs Git - rust.git/blobdiff - library/alloc/tests/vec.rs
Rollup merge of #98429 - b-naber:use-correct-substs-discriminant-cast, r=lcnr
[rust.git] / library / alloc / tests / vec.rs
index cc768c73c0e0391abf597e8a6f1a0ae9a9147d9b..5520f6ebf19045d4232eb413dc09034d8cd3a466 100644 (file)
@@ -2128,6 +2128,15 @@ fn new() -> C<'a> {
     c3.refs.v[1].set(Some(&c2));
 }
 
+#[test]
+fn test_zero_sized_capacity() {
+    for len in [0, 1, 2, 4, 8, 16, 32, 64, 128, 256] {
+        let v = Vec::<()>::with_capacity(len);
+        assert_eq!(v.len(), 0);
+        assert_eq!(v.capacity(), usize::MAX);
+    }
+}
+
 #[test]
 fn test_zero_sized_vec_push() {
     const N: usize = 8;