1
1
//! Tests for the `cargo yank` command.
2
2
3
- #![ allow( deprecated) ]
4
-
5
3
use std:: fs;
6
4
7
5
use cargo_test_support:: paths:: CargoPathExt ;
8
6
use cargo_test_support:: project;
9
7
use cargo_test_support:: registry;
8
+ use cargo_test_support:: str;
10
9
11
10
fn setup ( name : & str , version : & str ) {
12
11
let dir = registry:: api_path ( ) . join ( format ! ( "api/v1/crates/{}/{}" , name, version) ) ;
@@ -41,14 +40,15 @@ fn explicit_version() {
41
40
p. cargo ( "yank --undo --version 0.0.1" )
42
41
. replace_crates_io ( registry. index_url ( ) )
43
42
. with_status ( 101 )
44
- . with_stderr (
45
- " Updating crates.io index
43
+ . with_stderr_data ( str! [ [ r#"
44
+ [UPDATING] crates.io index
46
45
47
- error: failed to undo a yank from the registry at file:///[..]
46
+ [ERROR] failed to undo a yank from the registry at [ROOTURL]/api
48
47
49
48
Caused 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
+ "# ] ] )
52
52
. run ( ) ;
53
53
}
54
54
@@ -117,14 +117,15 @@ fn inline_version() {
117
117
p
. cargo ( "yank --undo [email protected] " )
118
118
. replace_crates_io ( registry. index_url ( ) )
119
119
. with_status ( 101 )
120
- . with_stderr (
121
- " Updating crates.io index
120
+ . with_stderr_data ( str! [ [ r#"
121
+ [UPDATING] crates.io index
122
122
123
- error: failed to undo a yank from the registry at file:///[..]
123
+ [ERROR] failed to undo a yank from the registry at [ROOTURL]/api
124
124
125
125
Caused 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
+ "# ] ] )
128
129
. run ( ) ;
129
130
}
130
131
@@ -149,7 +150,10 @@ fn version_required() {
149
150
150
151
p. cargo ( "yank foo" )
151
152
. with_status ( 101 )
152
- . with_stderr ( "error: `--version` is required" )
153
+ . with_stderr_data ( str![ [ r#"
154
+ [ERROR] `--version` is required
155
+
156
+ "# ] ] )
153
157
. run ( ) ;
154
158
}
155
159
@@ -174,7 +178,10 @@ fn inline_version_without_name() {
174
178
175
179
p. cargo ( "yank @0.0.1" )
176
180
. 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
+ "# ] ] )
178
185
. run ( ) ;
179
186
}
180
187
@@ -199,6 +206,9 @@ fn inline_and_explicit_version() {
199
206
200
207
p
. cargo ( "yank [email protected] --version 0.0.1" )
201
208
. 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
+ "# ] ] )
203
213
. run ( ) ;
204
214
}
0 commit comments