File tree 1 file changed +45
-0
lines changed
1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -248,3 +248,48 @@ fn undefined_default() {
248
248
)
249
249
. run ( ) ;
250
250
}
251
+
252
+ #[ cargo_test]
253
+ fn source_replacement_with_registry_url ( ) {
254
+ let alternative = RegistryBuilder :: new ( ) . alternative ( ) . http_api ( ) . build ( ) ;
255
+ Package :: new ( "bar" , "0.0.1" ) . alternative ( true ) . publish ( ) ;
256
+
257
+ let crates_io = setup_replacement ( & format ! (
258
+ r#"
259
+ [source.crates-io]
260
+ replace-with = 'using-registry-url'
261
+
262
+ [source.using-registry-url]
263
+ registry = '{}'
264
+ "# ,
265
+ alternative. index_url( )
266
+ ) ) ;
267
+
268
+ let p = project ( )
269
+ . file (
270
+ "Cargo.toml" ,
271
+ r#"
272
+ [package]
273
+ name = "foo"
274
+ version = "0.0.1"
275
+ [dependencies.bar]
276
+ version = "0.0.1"
277
+ "# ,
278
+ )
279
+ . file ( "src/lib.rs" , "" )
280
+ . build ( ) ;
281
+
282
+ p. cargo ( "check" )
283
+ . replace_crates_io ( crates_io. index_url ( ) )
284
+ . with_stderr (
285
+ "\
286
+ [UPDATING] `using-registry-url` index
287
+ [DOWNLOADING] crates ...
288
+ [DOWNLOADED] bar v0.0.1 (registry `using-registry-url`)
289
+ [CHECKING] bar v0.0.1
290
+ [CHECKING] foo v0.0.1 ([CWD])
291
+ [FINISHED] dev [..]
292
+ " ,
293
+ )
294
+ . run ( ) ;
295
+ }
You can’t perform that action at this time.
0 commit comments