From 0e213b78c9deb3595b4e1aea8b752b8fcac5bc6b Mon Sep 17 00:00:00 2001 From: SRetip Date: Thu, 21 Mar 2024 11:28:34 +0200 Subject: [PATCH 1/3] add test --- module/move/willbe/tests/inc/action/test.rs | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/module/move/willbe/tests/inc/action/test.rs b/module/move/willbe/tests/inc/action/test.rs index 80a2251d2f..b7fd0d774c 100644 --- a/module/move/willbe/tests/inc/action/test.rs +++ b/module/move/willbe/tests/inc/action/test.rs @@ -181,6 +181,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 { From ff80d8950b084ce988d298db9cb1cad6787368ab Mon Sep 17 00:00:00 2001 From: SRetip Date: Thu, 21 Mar 2024 11:48:58 +0200 Subject: [PATCH 2/3] before merge fix --- module/move/willbe/tests/inc/action/test.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/module/move/willbe/tests/inc/action/test.rs b/module/move/willbe/tests/inc/action/test.rs index b7fd0d774c..64cb8f589d 100644 --- a/module/move/willbe/tests/inc/action/test.rs +++ b/module/move/willbe/tests/inc/action/test.rs @@ -204,6 +204,7 @@ fn backtrace_should_be() .channels([ Channel::Stable ]) .optimizations([ Optimization::Debug ]) .with_none_features( true ) + .with_progress( false ) .form(); let rep = test( args, false ).unwrap_err().0; From 02ce4c0d71c69bb7c8643ff9c10230d4654f7461 Mon Sep 17 00:00:00 2001 From: SRetip Date: Thu, 21 Mar 2024 12:22:34 +0200 Subject: [PATCH 3/3] remove explicit false --- module/move/willbe/tests/inc/action/test.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/module/move/willbe/tests/inc/action/test.rs b/module/move/willbe/tests/inc/action/test.rs index 64cb8f589d..b7fd0d774c 100644 --- a/module/move/willbe/tests/inc/action/test.rs +++ b/module/move/willbe/tests/inc/action/test.rs @@ -204,7 +204,6 @@ fn backtrace_should_be() .channels([ Channel::Stable ]) .optimizations([ Optimization::Debug ]) .with_none_features( true ) - .with_progress( false ) .form(); let rep = test( args, false ).unwrap_err().0;