@@ -262,9 +262,10 @@ fn find_closest_dont_correct_nonsense() {
262
262
. cwd ( & paths:: root ( ) )
263
263
. with_status ( 101 )
264
264
. with_stderr (
265
- "[ERROR] no such subcommand: \
266
- `there-is-no-way-that-there-is-a-command-close-to-this`
267
- " ,
265
+ "\
266
+ [ERROR] no such subcommand: `there-is-no-way-that-there-is-a-command-close-to-this`
267
+
268
+ <tab>View all installed commands with `cargo --list`" ,
268
269
)
269
270
. run ( ) ;
270
271
}
@@ -273,7 +274,12 @@ fn find_closest_dont_correct_nonsense() {
273
274
fn displays_subcommand_on_error ( ) {
274
275
cargo_process ( "invalid-command" )
275
276
. with_status ( 101 )
276
- . with_stderr ( "[ERROR] no such subcommand: `invalid-command`\n " )
277
+ . with_stderr (
278
+ "\
279
+ [ERROR] no such subcommand: `invalid-command`
280
+
281
+ <tab>View all installed commands with `cargo --list`" ,
282
+ )
277
283
. run ( ) ;
278
284
}
279
285
@@ -380,3 +386,32 @@ fn closed_output_ok() {
380
386
assert ! ( status. success( ) ) ;
381
387
assert ! ( s. is_empty( ) , "{}" , s) ;
382
388
}
389
+
390
+ #[ cargo_test]
391
+ fn subcommand_leading_plus_output_contains ( ) {
392
+ cargo_process ( "+nightly" )
393
+ . with_status ( 101 )
394
+ . with_stderr (
395
+ "\
396
+ error: no such subcommand: `+nightly`
397
+
398
+ <tab>Cargo does not handle `+toolchain` directives.
399
+ <tab>Did you mean to invoke `cargo` through `rustup` instead?" ,
400
+ )
401
+ . run ( ) ;
402
+ }
403
+
404
+ #[ cargo_test]
405
+ fn full_did_you_mean ( ) {
406
+ cargo_process ( "bluid" )
407
+ . with_status ( 101 )
408
+ . with_stderr (
409
+ "\
410
+ error: no such subcommand: `bluid`
411
+
412
+ <tab>Did you mean `build`?
413
+
414
+ <tab>View all installed commands with `cargo --list`" ,
415
+ )
416
+ . run ( ) ;
417
+ }
0 commit comments