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> {
277
277
#[ cfg( test) ]
278
278
mod tests {
279
279
use super :: * ;
280
+ use crate :: rustc;
281
+ use crate :: shell:: Verbosity ;
280
282
281
283
#[ test]
282
284
fn is_verbose_test ( ) {
@@ -289,4 +291,20 @@ mod tests {
289
291
assert ! ( is_verbose( "-vvvv" ) ) ;
290
292
assert ! ( !is_verbose( "-version" ) ) ;
291
293
}
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
+ }
292
310
}
Original file line number Diff line number Diff line change @@ -208,7 +208,14 @@ impl MessageInfo {
208
208
pub fn fatal < T : fmt:: Display > ( & mut self , message : T , code : i32 ) -> ! {
209
209
self . error ( message)
210
210
. 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
+ }
212
219
}
213
220
214
221
/// prints a red 'error' message.
You can’t perform that action at this time.
0 commit comments