File tree 1 file changed +51
-0
lines changed
1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,57 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
128
128
validate_upload_foo ( ) ;
129
129
}
130
130
131
+ #[ cargo_test]
132
+ fn duplicate_version ( ) {
133
+ let registry_dupl = RegistryBuilder :: new ( )
134
+ . http_api ( )
135
+ . http_index ( )
136
+ . add_responder ( "/api/v1/crates/new" , move |_req, _server| Response {
137
+ code : 200 ,
138
+ headers : vec ! [ ] ,
139
+ body : br#"{"errors": [{"detail": "crate version `0.0.1` is already uploaded"}]}"#
140
+ . to_vec ( ) ,
141
+ } )
142
+ . build ( ) ;
143
+
144
+ let p = project ( )
145
+ . file (
146
+ "Cargo.toml" ,
147
+ r#"
148
+ [package]
149
+ name = "foo"
150
+ version = "0.0.1"
151
+ authors = []
152
+ license = "MIT"
153
+ description = "foo"
154
+ "# ,
155
+ )
156
+ . file ( "src/main.rs" , "fn main() {}" )
157
+ . build ( ) ;
158
+
159
+ p. cargo ( "publish" )
160
+ . replace_crates_io ( registry_dupl. index_url ( ) )
161
+ . with_stderr (
162
+ "\
163
+ [UPDATING] crates.io index
164
+ [WARNING] [..]
165
+ See [..]
166
+ [PACKAGING] foo v0.0.1 ([CWD])
167
+ [VERIFYING] foo v0.0.1 ([CWD])
168
+ [..]
169
+ [..]
170
+ [..]
171
+ [UPLOADING] foo v0.0.1 ([CWD])
172
+ error: failed to publish [..]
173
+
174
+ Caused by:
175
+ [..] is already uploaded
176
+ " ,
177
+ )
178
+ . with_status ( 101 )
179
+ . run ( ) ;
180
+ }
181
+
131
182
// Check that the `token` key works at the root instead of under a
132
183
// `[registry]` table.
133
184
#[ cargo_test]
You can’t perform that action at this time.
0 commit comments