File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -277,6 +277,8 @@ pub fn parse(target_list: &TargetList) -> Result<Args> {
277277#[ cfg( test) ]
278278mod tests {
279279 use super :: * ;
280+ use crate :: rustc;
281+ use crate :: shell:: Verbosity ;
280282
281283 #[ test]
282284 fn is_verbose_test ( ) {
@@ -289,4 +291,20 @@ mod tests {
289291 assert ! ( is_verbose( "-vvvv" ) ) ;
290292 assert ! ( !is_verbose( "-version" ) ) ;
291293 }
294+
295+ #[ test]
296+ #[ should_panic]
297+ fn test_recursive_alias ( ) {
298+ let mut args = Args :: default ( ) ;
299+ let target_list =
300+ rustc:: target_list ( & mut Verbosity :: Quiet . into ( ) ) . expect ( "failed to get target list" ) ;
301+
302+ parse_subcommand (
303+ "recursive" . to_owned ( ) ,
304+ & mut args,
305+ & target_list,
306+ Some ( "recursive" ) ,
307+ )
308+ . ok ( ) ;
309+ }
292310}
Original file line number Diff line number Diff line change @@ -208,7 +208,14 @@ impl MessageInfo {
208208 pub fn fatal < T : fmt:: Display > ( & mut self , message : T , code : i32 ) -> ! {
209209 self . error ( message)
210210 . expect ( "could not display fatal message" ) ;
211- std:: process:: exit ( code) ;
211+
212+ // need to catch panics in unittests, otherwise
213+ // want the custom styled error message
214+ if cfg ! ( test) {
215+ panic ! ( "" ) ;
216+ } else {
217+ std:: process:: exit ( code) ;
218+ }
212219 }
213220
214221 /// prints a red 'error' message.
You can’t perform that action at this time.
0 commit comments