| 1 |
/// This file tests `smallvec!` without actually having the macro in scope. |
| 2 |
/// This forces any recursion to use a `$crate` prefix to reliably find itself. |
| 3 |
|
| 4 |
#[test] |
| 5 |
fn smallvec() { |
| 6 |
let mut vec: smallvec::SmallVec<[i32; 2]>; |
| 7 |
|
| 8 |
macro_rules! check { |
| 9 |
($init:tt) => { |
| 10 |
vec = smallvec::smallvec! $init; |
| 11 |
assert_eq!(*vec, *vec! $init); |
| 12 |
} |
| 13 |
} |
| 14 |
|
| 15 |
check!([0; 0]); |
| 16 |
check!([1; 1]); |
| 17 |
check!([2; 2]); |
| 18 |
check!([3; 3]); |
| 19 |
|
| 20 |
check!([]); |
| 21 |
check!([1]); |
| 22 |
check!([1, 2]); |
| 23 |
check!([1, 2, 3]); |
| 24 |
} |