11//! Tests for the `cargo yank` command.
22
3- #![ allow( deprecated) ]
4-
53use std:: fs;
64
75use cargo_test_support:: paths:: CargoPathExt ;
86use cargo_test_support:: project;
97use cargo_test_support:: registry;
8+ use cargo_test_support:: str;
109
1110fn setup ( name : & str , version : & str ) {
1211 let dir = registry:: api_path ( ) . join ( format ! ( "api/v1/crates/{}/{}" , name, version) ) ;
@@ -41,14 +40,15 @@ fn explicit_version() {
4140 p. cargo ( "yank --undo --version 0.0.1" )
4241 . replace_crates_io ( registry. index_url ( ) )
4342 . with_status ( 101 )
44- . with_stderr (
45- " Updating crates.io index
43+ . with_stderr_data ( str! [ [ r#"
44+ [UPDATING] crates.io index
464547- error: failed to undo a yank from the registry at file:///[..]
46+ [ERROR] failed to undo a yank from the registry at [ROOTURL]/api
4847
4948Caused by:
50- EOF while parsing a value at line 1 column 0" ,
51- )
49+ EOF while parsing a value at line 1 column 0
50+
51+ "# ] ] )
5252 . run ( ) ;
5353}
5454
@@ -117,14 +117,15 @@ fn inline_version() {
117117 p
. cargo ( "yank --undo [email protected] " ) 118118 . replace_crates_io ( registry. index_url ( ) )
119119 . with_status ( 101 )
120- . with_stderr (
121- " Updating crates.io index
120+ . with_stderr_data ( str! [ [ r#"
121+ [UPDATING] crates.io index
122122123- error: failed to undo a yank from the registry at file:///[..]
123+ [ERROR] failed to undo a yank from the registry at [ROOTURL]/api
124124
125125Caused by:
126- EOF while parsing a value at line 1 column 0" ,
127- )
126+ EOF while parsing a value at line 1 column 0
127+
128+ "# ] ] )
128129 . run ( ) ;
129130}
130131
@@ -149,7 +150,10 @@ fn version_required() {
149150
150151 p. cargo ( "yank foo" )
151152 . with_status ( 101 )
152- . with_stderr ( "error: `--version` is required" )
153+ . with_stderr_data ( str![ [ r#"
154+ [ERROR] `--version` is required
155+
156+ "# ] ] )
153157 . run ( ) ;
154158}
155159
@@ -174,7 +178,10 @@ fn inline_version_without_name() {
174178
175179 p. cargo ( "yank @0.0.1" )
176180 . with_status ( 101 )
177- . with_stderr ( "error: missing crate name for `@0.0.1`" )
181+ . with_stderr_data ( str![ [ r#"
182+ [ERROR] missing crate name for `@0.0.1`
183+
184+ "# ] ] )
178185 . run ( ) ;
179186}
180187
@@ -199,6 +206,9 @@ fn inline_and_explicit_version() {
199206
200207 p
. cargo ( "yank [email protected] --version 0.0.1" ) 201208 . with_status ( 101 )
202- . with_stderr ( "error: cannot specify both `@0.0.1` and `--version`" )
209+ . with_stderr_data ( str![ [ r#"
210+ [ERROR] cannot specify both `@0.0.1` and `--version`
211+
212+ "# ] ] )
203213 . run ( ) ;
204214}
0 commit comments