File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -527,3 +527,32 @@ mod serde_impls {
527
527
}
528
528
}
529
529
}
530
+
531
+ #[ cfg( test) ]
532
+ mod tests {
533
+ use super :: * ;
534
+
535
+ #[ test]
536
+ fn test_frame_conversion ( ) {
537
+ // captures an original backtrace, and makes sure that the manual conversion
538
+ // to frames yields the same results.
539
+ let bt = Backtrace :: new ( ) ;
540
+ let original_frames = bt. frames ( ) ;
541
+ let mut original = original_frames. iter ( ) ;
542
+
543
+ let mut frames = 0 ;
544
+ unsafe {
545
+ crate :: trace_unsynchronized ( |frame| {
546
+ // skip the first frame, that happens inside this function so won't match
547
+ // the original backtrace
548
+ if frames > 0 {
549
+ let converted = BacktraceFrame :: from ( frame. clone ( ) ) ;
550
+ let og = original. next ( ) . unwrap ( ) ;
551
+ assert_eq ! ( converted. symbol_address( ) , og. symbol_address( ) ) ;
552
+ }
553
+ frames += 1 ;
554
+ true
555
+ } ) ;
556
+ }
557
+ }
558
+ }
You can’t perform that action at this time.
0 commit comments