File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,6 +65,50 @@ backtrace = """
6565 root. close ( ) . unwrap ( ) ;
6666}
6767
68+ #[ test]
69+ #[ cfg_attr( debug_assertions, ignore) ]
70+ fn release_with_backtraces ( ) {
71+ let root = snapbox:: dir:: DirRoot :: mutable_temp ( ) . unwrap ( ) ;
72+ let root_path = root. path ( ) . unwrap ( ) ;
73+
74+ #[ cfg( unix) ]
75+ let envs = [ ( "TMPDIR" , root_path) ] ;
76+ #[ cfg( not( unix) ) ]
77+ let envs: [ ( & str , & str ) ; 0 ] = [ ] ;
78+
79+ snapbox:: cmd:: Command :: new ( snapbox:: cmd:: cargo_bin!( "single-panic-test" ) )
80+ . envs ( envs)
81+ . env ( "RUST_BACKTRACE" , "1" )
82+ . assert ( )
83+ . stderr_eq ( snapbox:: str![ [ r#"
84+
85+ thread 'main' ([..]) panicked at tests/single-panic/src/main.rs:[..]:
86+ OMG EVERYTHING IS ON FIRE!!!
87+ stack backtrace:
88+ ...
89+ note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
90+
91+ "# ] ] )
92+ . code ( 101 ) ;
93+
94+ #[ cfg( unix) ]
95+ {
96+ let files = root_path
97+ . read_dir ( )
98+ . unwrap ( )
99+ . map ( |e| {
100+ let e = e. unwrap ( ) ;
101+ let path = e. path ( ) ;
102+ let content = std:: fs:: read_to_string ( & path) ;
103+ ( path, content)
104+ } )
105+ . collect :: < Vec < _ > > ( ) ;
106+ assert ! ( files. is_empty( ) , "{files:?}" ) ;
107+ }
108+
109+ root. close ( ) . unwrap ( ) ;
110+ }
111+
68112#[ test]
69113#[ cfg_attr( not( debug_assertions) , ignore) ]
70114fn debug ( ) {
You can’t perform that action at this time.
0 commit comments