File tree Expand file tree Collapse file tree 2 files changed +41
-3
lines changed Expand file tree Collapse file tree 2 files changed +41
-3
lines changed Original file line number Diff line number Diff line change @@ -494,11 +494,21 @@ impl TestArgs {
494494 self . flamechart ) &&
495495 num_filtered != 1
496496 {
497+ let action = if self . flamegraph {
498+ "generate a flamegraph"
499+ } else if self . flamechart {
500+ "generate a flamechart"
501+ } else {
502+ "run the debugger"
503+ } ;
504+ let filter = if filter. is_empty ( ) {
505+ String :: new ( )
506+ } else {
507+ format ! ( "\n \n Filter used:\n {filter}" )
508+ } ;
497509 eyre:: bail!(
498510 "{num_filtered} tests matched your criteria, but exactly 1 test must match in order to {action}.\n \n \
499- Use --match-contract and --match-path to further limit the search.\n \
500- Filter used:\n {filter}",
501- action = if self . flamegraph { "generate a flamegraph" } else if self . flamechart { "generate a flamechart" } else { "run the debugger" } ,
511+ Use --match-contract and --match-path to further limit the search.{filter}",
502512 ) ;
503513 }
504514
Original file line number Diff line number Diff line change @@ -2174,3 +2174,31 @@ Warning: the following cheatcode(s) are deprecated and will be removed in future
21742174"# ] ] ) ;
21752175 }
21762176) ;
2177+
2178+ forgetest_init ! ( requires_single_test, |prj, cmd| {
2179+ cmd. args( [ "test" , "--debug" , "test" ] ) . assert_failure( ) . stderr_eq( str ![ [ r#"
2180+ Error:
2181+ 2 tests matched your criteria, but exactly 1 test must match in order to run the debugger.
2182+
2183+ Use --match-contract and --match-path to further limit the search.
2184+
2185+ Filter used:
2186+ match-test: `test`
2187+
2188+
2189+ "# ] ] ) ;
2190+ cmd. forge_fuse( ) . args( [ "test" , "--flamegraph" ] ) . assert_failure( ) . stderr_eq( str ![ [ r#"
2191+ Error:
2192+ 2 tests matched your criteria, but exactly 1 test must match in order to generate a flamegraph.
2193+
2194+ Use --match-contract and --match-path to further limit the search.
2195+
2196+ "# ] ] ) ;
2197+ cmd. forge_fuse( ) . args( [ "test" , "--flamechart" ] ) . assert_failure( ) . stderr_eq( str ![ [ r#"
2198+ Error:
2199+ 2 tests matched your criteria, but exactly 1 test must match in order to generate a flamechart.
2200+
2201+ Use --match-contract and --match-path to further limit the search.
2202+
2203+ "# ] ] ) ;
2204+ } ) ;
You can’t perform that action at this time.
0 commit comments