| 1 |
use debugger_test::debugger_test; |
| 2 |
use tinyvec::*; |
| 3 |
|
| 4 |
#[inline(never)] |
| 5 |
fn __break() { |
| 6 |
println!("breakpoint hit"); |
| 7 |
} |
| 8 |
|
| 9 |
#[debugger_test( |
| 10 |
debugger = "cdb", |
| 11 |
commands = r#" |
| 12 |
dx strings |
| 13 |
dx inline_tv |
| 14 |
dx inline_tv.__0 |
| 15 |
g |
| 16 |
dx slice_vec |
| 17 |
g |
| 18 |
dx strings |
| 19 |
"#, |
| 20 |
expected_statements = r#" |
| 21 |
pattern:strings : \{ len=0x3 \} \[Type: tinyvec::arrayvec::ArrayVec<array\$<.*str.*,7> >\] |
| 22 |
pattern:\[<Raw View>\] \[Type: tinyvec::arrayvec::ArrayVec<array\$<.*str.*,7> >\] |
| 23 |
pattern:\[len\] : 0x3 \[Type: unsigned short\] |
| 24 |
pattern:\[capacity\] : 7 |
| 25 |
pattern:\[0\] : "a" \[Type: .*str.*\] |
| 26 |
pattern:\[1\] : "b" \[Type: .*str.*\] |
| 27 |
pattern:\[2\] : "c" \[Type: .*str.*\] |
| 28 |
|
| 29 |
inline_tv : Inline [Type: enum2$<tinyvec::tinyvec::TinyVec<array$<i32,4> > >] |
| 30 |
[<Raw View>] [Type: enum2$<tinyvec::tinyvec::TinyVec<array$<i32,4> > >] |
| 31 |
[+0x004] __0 : { len=0x4 } [Type: tinyvec::arrayvec::ArrayVec<array$<i32,4> >] |
| 32 |
|
| 33 |
inline_tv.__0 : { len=0x4 } [Type: tinyvec::arrayvec::ArrayVec<array$<i32,4> >] |
| 34 |
[<Raw View>] [Type: tinyvec::arrayvec::ArrayVec<array$<i32,4> >] |
| 35 |
[len] : 0x4 [Type: unsigned short] |
| 36 |
[capacity] : 4 |
| 37 |
[0] : 1 [Type: i32] |
| 38 |
[1] : 2 [Type: i32] |
| 39 |
[2] : 3 [Type: i32] |
| 40 |
[3] : 4 [Type: i32] |
| 41 |
|
| 42 |
pattern:slice_vec : \{ len=0x3 \} \[Type: tinyvec::slicevec::SliceVec<.*str.*>\] |
| 43 |
pattern:\[<Raw View>\] \[Type: tinyvec::slicevec::SliceVec<.*str.*>\] |
| 44 |
pattern:\[len\] : 0x3 \[Type: unsigned __int64\] |
| 45 |
pattern:\[0\] : "a" \[Type: .*str.*\] |
| 46 |
pattern:\[1\] : "b" \[Type: .*str.*\] |
| 47 |
pattern:\[2\] : "d" \[Type: .*str.*\] |
| 48 |
|
| 49 |
pattern:strings : \{ len=0x6 \} \[Type: tinyvec::arrayvec::ArrayVec<array\$<.*str.*,7> >\] |
| 50 |
pattern:\[<Raw View>\] \[Type: tinyvec::arrayvec::ArrayVec<array\$<.*str.*,7> >\] |
| 51 |
pattern:\[len\] : 0x6 \[Type: unsigned short\] |
| 52 |
pattern:\[capacity\] : 7 |
| 53 |
pattern:\[0\] : "a" \[Type: .*str.*\] |
| 54 |
pattern:\[1\] : "b" \[Type: .*str.*\] |
| 55 |
pattern:\[2\] : "d" \[Type: .*str.*\] |
| 56 |
pattern:\[3\] : "e" \[Type: .*str.*\] |
| 57 |
pattern:\[4\] : "f" \[Type: .*str.*\] |
| 58 |
pattern:\[5\] : "g" \[Type: .*str.*\] |
| 59 |
"# |
| 60 |
)] |
| 61 |
#[inline(never)] |
| 62 |
fn test_debugger_visualizer() { |
| 63 |
let mut strings = ArrayVec::<[&str; 7]>::default(); |
| 64 |
strings.push("a"); |
| 65 |
strings.push("b"); |
| 66 |
strings.push("c"); |
| 67 |
assert_eq!(["a", "b", "c"], &strings[..]); |
| 68 |
|
| 69 |
let mut inline_tv = tiny_vec!([i32; 4] => 1, 2, 3); |
| 70 |
assert!(inline_tv.is_inline()); |
| 71 |
|
| 72 |
inline_tv.push(4); |
| 73 |
__break(); |
| 74 |
|
| 75 |
{ |
| 76 |
let mut slice_vec = SliceVec::from(strings.as_mut_slice()); |
| 77 |
assert_eq!(3, slice_vec.capacity()); |
| 78 |
assert_eq!("c", slice_vec.remove(2)); |
| 79 |
slice_vec.push("d"); |
| 80 |
println!("{:?}", slice_vec); |
| 81 |
__break(); |
| 82 |
|
| 83 |
assert_eq!(["a", "b", "d"], &slice_vec[..]); |
| 84 |
} |
| 85 |
|
| 86 |
strings.push("e"); |
| 87 |
strings.push("f"); |
| 88 |
strings.push("g"); |
| 89 |
assert_eq!(["a", "b", "d", "e", "f", "g"], &strings[..]); |
| 90 |
__break(); |
| 91 |
} |