Skip to content

Commit a30d9fd

Browse files
committed
test: verify source replacement displays registry key
1 parent 5bf83d8 commit a30d9fd

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

tests/testsuite/source_replacement.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,48 @@ fn undefined_default() {
248248
)
249249
.run();
250250
}
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+
}

0 commit comments

Comments
 (0)