@@ -7,6 +7,7 @@ use std::str;
7
7
use cargo;
8
8
use cargotest:: cargo_process;
9
9
use cargotest:: support:: paths:: { self , CargoPathExt } ;
10
+ use cargotest:: support:: registry:: Package ;
10
11
use cargotest:: support:: { basic_bin_manifest, execs, project, Project } ;
11
12
use hamcrest:: { assert_that, existing_file} ;
12
13
@@ -115,18 +116,47 @@ fn list_command_resolves_symlinks() {
115
116
116
117
#[ test]
117
118
fn find_closest_biuld_to_build ( ) {
118
- let mut pr = cargo_process ( ) ;
119
- pr. arg ( "biuld" ) ;
120
-
121
119
assert_that (
122
- pr ,
123
- execs ( ) . with_status ( 1 ) . with_stderr_contains (
120
+ cargo_process ( ) . arg ( "biuld" ) ,
121
+ execs ( ) . with_status ( 101 ) . with_stderr_contains (
124
122
"\
125
- error: The subcommand 'biuld' wasn't recognized
126
- <tab>Did you mean 'build'?
123
+ error: no such subcommand: `biuld`
124
+
125
+ <tab>Did you mean `build`?
127
126
" ,
128
127
) ,
129
128
) ;
129
+
130
+ // But, if we actually have `biuld`, it must work!
131
+ // https://github.com/rust-lang/cargo/issues/5201
132
+ Package :: new ( "cargo-biuld" , "1.0.0" )
133
+ . file (
134
+ "src/main.rs" ,
135
+ r#"
136
+ fn main() {
137
+ println!("Similar, but not identical to, build");
138
+ }
139
+ "# ,
140
+ )
141
+ . publish ( ) ;
142
+
143
+ assert_that (
144
+ cargo_process ( ) . arg ( "install" ) . arg ( "cargo-biuld" ) ,
145
+ execs ( ) . with_status ( 0 ) ,
146
+ ) ;
147
+ assert_that (
148
+ cargo_process ( ) . arg ( "biuld" ) ,
149
+ execs ( )
150
+ . with_status ( 0 )
151
+ . with_stdout ( "Similar, but not identical to, build\n " ) ,
152
+ ) ;
153
+ assert_that (
154
+ cargo_process ( ) . arg ( "--list" ) ,
155
+ execs ( )
156
+ . with_status ( 0 )
157
+ . with_stdout_contains ( " build\n " )
158
+ . with_stdout_contains ( " biuld\n " ) ,
159
+ ) ;
130
160
}
131
161
132
162
// if a subcommand is more than 3 edit distance away, we don't make a suggestion
0 commit comments