File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -824,12 +824,22 @@ mod tests {
824824 let _outer = Context :: enter_suppressed ( ) ;
825825 assert_eq ! ( Context :: is_current_suppressed( ) , true ) ;
826826
827- // Second level suppression (redundant but should work)
827+ // Second level. This component is unaware of Suppression,
828+ // and just attaches a new context. Since it is from current,
829+ // it'll already have suppression enabled.
828830 {
829- let _inner = Context :: enter_suppressed ( ) ;
831+ let _inner = Context :: current ( ) . with_value ( ValueA ( 1 ) ) . attach ( ) ;
830832 assert_eq ! ( Context :: is_current_suppressed( ) , true ) ;
831833 }
832834
835+ // Another scenario. This component is unaware of Suppression,
836+ // and just attaches a new context, not from Current. Since it is
837+ // not from current it will not have suppression enabled.
838+ {
839+ let _inner = Context :: new ( ) . with_value ( ValueA ( 1 ) ) . attach ( ) ;
840+ assert_eq ! ( Context :: is_current_suppressed( ) , false ) ;
841+ }
842+
833843 // Still suppressed after inner scope
834844 assert_eq ! ( Context :: is_current_suppressed( ) , true ) ;
835845 }
You can’t perform that action at this time.
0 commit comments