Skip to content

Commit

Permalink
Merge pull request #1228 from SRetip/backtrace_test
Browse files Browse the repository at this point in the history
READY(willbe) : Backtrace test
  • Loading branch information
Wandalen authored Mar 21, 2024
2 parents ace68be + 02ce4c0 commit 8dacebf
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions module/move/willbe/tests/inc/action/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,43 @@ fn plan()
assert!( rep.get( &TestVariant::former().optimization( Optimization::Release ).channel( Channel::Nightly ).features( BTreeSet::default() ).form() ).is_some() );
}

#[ test ]
fn backtrace_should_be()
{
let temp = TempDir::new().unwrap();
let temp = &temp;

let project = ProjectBuilder::new( "fail_build" )
.toml_file( "[features]\nenabled = []" )
.test_file( r#"
#[test]
fn fail() {
assert!(false);
}
"#)
.build( temp )
.unwrap();
let abs = AbsolutePath::try_from( project ).unwrap();

let args = TestsCommandOptions::former()
.dir( abs )
.channels([ Channel::Stable ])
.optimizations([ Optimization::Debug ])
.with_none_features( true )
.form();

let rep = test( args, false ).unwrap_err().0;
println!( "========= OUTPUT =========\n{}\n==========================", rep );

let no_features = rep
.failure_reports[ 0 ]
.tests.get( &TestVariant::former().optimization( Optimization::Debug ).channel( Channel::Stable ).features( BTreeSet::default() ).form() )
.unwrap();

assert!( !no_features.clone().unwrap_err().out.contains( "RUST_BACKTRACE" ) );
assert!( no_features.clone().unwrap_err().out.contains( "stack backtrace" ) );
}

#[ derive( Debug ) ]
pub struct ProjectBuilder
{
Expand Down

0 comments on commit 8dacebf

Please sign in to comment.