Skip to content

Commit 8c75e2f

Browse files
committed
Update tests to use registry names
1 parent 4efaa4e commit 8c75e2f

18 files changed

+211
-221
lines changed

src/cargo/core/package_id.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,15 @@ mod tests {
252252
let loc = CRATES_IO_INDEX.into_url().unwrap();
253253
let pkg_id = PackageId::new("foo", "1.0.0", SourceId::for_registry(&loc).unwrap()).unwrap();
254254
assert_eq!(
255-
r#"PackageId { name: "foo", version: "1.0.0", source: "registry `https://github.com/rust-lang/crates.io-index`" }"#,
255+
r#"PackageId { name: "foo", version: "1.0.0", source: "registry `crates-io`" }"#,
256256
format!("{:?}", pkg_id)
257257
);
258258

259259
let expected = r#"
260260
PackageId {
261261
name: "foo",
262262
version: "1.0.0",
263-
source: "registry `https://github.com/rust-lang/crates.io-index`",
263+
source: "registry `crates-io`",
264264
}
265265
"#
266266
.trim();
@@ -271,7 +271,7 @@ PackageId {
271271
PackageId {
272272
name: "foo",
273273
version: "1.0.0",
274-
source: "registry `https://github.com/rust-lang/crates.io-index`"
274+
source: "registry `crates-io`"
275275
}
276276
"#
277277
.trim();

tests/testsuite/alt_registry.rs

Lines changed: 52 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,16 @@ fn depend_on_alt_registry() {
2929
Package::new("bar", "0.0.1").alternative(true).publish();
3030

3131
p.cargo("build")
32-
.with_stderr(&format!(
32+
.with_stderr(
3333
"\
34-
[UPDATING] `{reg}` index
34+
[UPDATING] `alternative` index
3535
[DOWNLOADING] crates ...
36-
[DOWNLOADED] bar v0.0.1 (registry `[ROOT][..]`)
37-
[COMPILING] bar v0.0.1 (registry `[ROOT][..]`)
36+
[DOWNLOADED] bar v0.0.1 (registry `alternative`)
37+
[COMPILING] bar v0.0.1 (registry `alternative`)
3838
[COMPILING] foo v0.0.1 ([CWD])
3939
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
4040
",
41-
reg = registry::alt_registry_path().to_str().unwrap()
42-
))
41+
)
4342
.run();
4443

4544
p.cargo("clean").run();
@@ -48,7 +47,7 @@ fn depend_on_alt_registry() {
4847
p.cargo("build")
4948
.with_stderr(
5049
"\
51-
[COMPILING] bar v0.0.1 (registry `[ROOT][..]`)
50+
[COMPILING] bar v0.0.1 (registry `alternative`)
5251
[COMPILING] foo v0.0.1 ([CWD])
5352
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
5453
",
@@ -83,19 +82,18 @@ fn depend_on_alt_registry_depends_on_same_registry_no_index() {
8382
.publish();
8483

8584
p.cargo("build")
86-
.with_stderr(&format!(
85+
.with_stderr(
8786
"\
88-
[UPDATING] `{reg}` index
87+
[UPDATING] `alternative` index
8988
[DOWNLOADING] crates ...
90-
[DOWNLOADED] [..] v0.0.1 (registry `[ROOT][..]`)
91-
[DOWNLOADED] [..] v0.0.1 (registry `[ROOT][..]`)
92-
[COMPILING] baz v0.0.1 (registry `[ROOT][..]`)
93-
[COMPILING] bar v0.0.1 (registry `[ROOT][..]`)
89+
[DOWNLOADED] [..] v0.0.1 (registry `alternative`)
90+
[DOWNLOADED] [..] v0.0.1 (registry `alternative`)
91+
[COMPILING] baz v0.0.1 (registry `alternative`)
92+
[COMPILING] bar v0.0.1 (registry `alternative`)
9493
[COMPILING] foo v0.0.1 ([CWD])
9594
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
9695
",
97-
reg = registry::alt_registry_path().to_str().unwrap()
98-
))
96+
)
9997
.run();
10098
}
10199

@@ -126,19 +124,18 @@ fn depend_on_alt_registry_depends_on_same_registry() {
126124
.publish();
127125

128126
p.cargo("build")
129-
.with_stderr(&format!(
127+
.with_stderr(
130128
"\
131-
[UPDATING] `{reg}` index
129+
[UPDATING] `alternative` index
132130
[DOWNLOADING] crates ...
133-
[DOWNLOADED] [..] v0.0.1 (registry `[ROOT][..]`)
134-
[DOWNLOADED] [..] v0.0.1 (registry `[ROOT][..]`)
135-
[COMPILING] baz v0.0.1 (registry `[ROOT][..]`)
136-
[COMPILING] bar v0.0.1 (registry `[ROOT][..]`)
131+
[DOWNLOADED] [..] v0.0.1 (registry `alternative`)
132+
[DOWNLOADED] [..] v0.0.1 (registry `alternative`)
133+
[COMPILING] baz v0.0.1 (registry `alternative`)
134+
[COMPILING] bar v0.0.1 (registry `alternative`)
137135
[COMPILING] foo v0.0.1 ([CWD])
138136
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
139137
",
140-
reg = registry::alt_registry_path().to_str().unwrap()
141-
))
138+
)
142139
.run();
143140
}
144141

@@ -169,21 +166,19 @@ fn depend_on_alt_registry_depends_on_crates_io() {
169166
.publish();
170167

171168
p.cargo("build")
172-
.with_stderr_unordered(&format!(
169+
.with_stderr_unordered(
173170
"\
174-
[UPDATING] `{alt_reg}` index
175-
[UPDATING] `{reg}` index
171+
[UPDATING] `alternative` index
172+
[UPDATING] `dummy-registry` index
176173
[DOWNLOADING] crates ...
177-
[DOWNLOADED] baz v0.0.1 (registry `[ROOT][..]`)
178-
[DOWNLOADED] bar v0.0.1 (registry `[ROOT][..]`)
174+
[DOWNLOADED] baz v0.0.1 (registry `dummy-registry`)
175+
[DOWNLOADED] bar v0.0.1 (registry `alternative`)
179176
[COMPILING] baz v0.0.1
180-
[COMPILING] bar v0.0.1 (registry `[ROOT][..]`)
177+
[COMPILING] bar v0.0.1 (registry `alternative`)
181178
[COMPILING] foo v0.0.1 ([CWD])
182179
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
183180
",
184-
alt_reg = registry::alt_registry_path().to_str().unwrap(),
185-
reg = registry::registry_path().to_str().unwrap()
186-
))
181+
)
187182
.run();
188183
}
189184

@@ -403,20 +398,19 @@ fn alt_registry_and_crates_io_deps() {
403398
.publish();
404399

405400
p.cargo("build")
406-
.with_stderr_contains(format!(
407-
"[UPDATING] `{}` index",
408-
registry::alt_registry_path().to_str().unwrap()
409-
))
410-
.with_stderr_contains(&format!(
411-
"[UPDATING] `{}` index",
412-
registry::registry_path().to_str().unwrap()
413-
))
414-
.with_stderr_contains("[DOWNLOADED] crates_io_dep v0.0.1 (registry `[ROOT][..]`)")
415-
.with_stderr_contains("[DOWNLOADED] alt_reg_dep v0.1.0 (registry `[ROOT][..]`)")
416-
.with_stderr_contains("[COMPILING] alt_reg_dep v0.1.0 (registry `[ROOT][..]`)")
417-
.with_stderr_contains("[COMPILING] crates_io_dep v0.0.1")
418-
.with_stderr_contains("[COMPILING] foo v0.0.1 ([CWD])")
419-
.with_stderr_contains("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s")
401+
.with_stderr_unordered(
402+
"\
403+
[UPDATING] `alternative` index
404+
[UPDATING] `dummy-registry` index
405+
[DOWNLOADING] crates ...
406+
[DOWNLOADED] crates_io_dep v0.0.1 (registry `dummy-registry`)
407+
[DOWNLOADED] alt_reg_dep v0.1.0 (registry `alternative`)
408+
[COMPILING] alt_reg_dep v0.1.0 (registry `alternative`)
409+
[COMPILING] crates_io_dep v0.0.1
410+
[COMPILING] foo v0.0.1 ([CWD])
411+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
412+
",
413+
)
420414
.run();
421415
}
422416

@@ -607,7 +601,7 @@ fn patch_alt_reg() {
607601
p.cargo("build")
608602
.with_stderr(
609603
"\
610-
[UPDATING] `[ROOT][..]` index
604+
[UPDATING] `alternative` index
611605
[COMPILING] bar v0.1.0 ([CWD]/bar)
612606
[COMPILING] foo v0.0.1 ([CWD])
613607
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
@@ -697,24 +691,20 @@ fn no_api() {
697691
.build();
698692

699693
p.cargo("build")
700-
.with_stderr(&format!(
694+
.with_stderr(
701695
"\
702-
[UPDATING] `{reg}` index
696+
[UPDATING] `alternative` index
703697
[DOWNLOADING] crates ...
704-
[DOWNLOADED] bar v0.0.1 (registry `[ROOT][..]`)
705-
[COMPILING] bar v0.0.1 (registry `[ROOT][..]`)
698+
[DOWNLOADED] bar v0.0.1 (registry `alternative`)
699+
[COMPILING] bar v0.0.1 (registry `alternative`)
706700
[COMPILING] foo v0.0.1 ([CWD])
707701
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
708702
",
709-
reg = registry::alt_registry_path().to_str().unwrap()
710-
))
703+
)
711704
.run();
712705

713706
// Check all of the API commands.
714-
let err = format!(
715-
"[ERROR] registry `{}` does not support API commands",
716-
registry::alt_registry_path().display()
717-
);
707+
let err = "[ERROR] registry `alternative` does not support API commands";
718708

719709
p.cargo("login --registry alternative TOKEN")
720710
.with_status(101)
@@ -1244,17 +1234,16 @@ fn registries_index_relative_url() {
12441234
Package::new("bar", "0.0.1").alternative(true).publish();
12451235

12461236
p.cargo("build")
1247-
.with_stderr(&format!(
1237+
.with_stderr(
12481238
"\
1249-
[UPDATING] `{reg}` index
1239+
[UPDATING] `relative` index
12501240
[DOWNLOADING] crates ...
1251-
[DOWNLOADED] bar v0.0.1 (registry `[ROOT][..]`)
1252-
[COMPILING] bar v0.0.1 (registry `[ROOT][..]`)
1241+
[DOWNLOADED] bar v0.0.1 (registry `relative`)
1242+
[COMPILING] bar v0.0.1 (registry `relative`)
12531243
[COMPILING] foo v0.0.1 ([CWD])
12541244
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
12551245
",
1256-
reg = registry::alt_registry_path().to_str().unwrap()
1257-
))
1246+
)
12581247
.run();
12591248
}
12601249

tests/testsuite/bad_config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ Caused by:
912912
failed to load source for dependency `bar`
913913
914914
Caused by:
915-
Unable to update registry `https://[..]`
915+
Unable to update registry `crates-io`
916916
917917
Caused by:
918918
could not find a configured source with the name `bar` \
@@ -958,7 +958,7 @@ Caused by:
958958
failed to load source for dependency `bar`
959959
960960
Caused by:
961-
Unable to update registry `https://[..]`
961+
Unable to update registry `crates-io`
962962
963963
Caused by:
964964
detected a cycle of `replace-with` sources, [..]
@@ -1006,7 +1006,7 @@ Caused by:
10061006
failed to load source for dependency `bar`
10071007
10081008
Caused by:
1009-
Unable to update registry `https://[..]`
1009+
Unable to update registry `crates-io`
10101010
10111011
Caused by:
10121012
detected a cycle of `replace-with` sources, the source `crates-io` is \
@@ -1445,7 +1445,7 @@ fn redefined_sources() {
14451445
.with_status(101)
14461446
.with_stderr(
14471447
"\
1448-
[ERROR] source `foo` defines source registry `https://github.com/rust-lang/crates.io-index`, \
1448+
[ERROR] source `foo` defines source registry `crates-io`, \
14491449
but that source is already defined by `crates-io`
14501450
note: Sources are not allowed to be defined multiple times.
14511451
",

tests/testsuite/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4777,7 +4777,7 @@ fn avoid_dev_deps() {
47774777
"\
47784778
[UPDATING] [..]
47794779
[ERROR] no matching package named `baz` found
4780-
location searched: registry `https://github.com/rust-lang/crates.io-index`
4780+
location searched: registry `crates-io`
47814781
required by package `bar v0.1.0 ([..]/foo)`
47824782
",
47834783
)

tests/testsuite/cargo_features.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn feature_required_dependency() {
105105
[UPDATING] [..]
106106
[DOWNLOADING] [..]
107107
[DOWNLOADED] bar v1.0.0 [..]
108-
error: failed to download replaced source registry `https://github.com/rust-lang/crates.io-index`
108+
error: failed to download replaced source registry `crates-io`
109109
110110
Caused by:
111111
failed to parse manifest at `[..]/bar-1.0.0/Cargo.toml`
@@ -136,7 +136,7 @@ Caused by:
136136
unable to get packages from source
137137
138138
Caused by:
139-
failed to download replaced source registry `https://github.com/rust-lang/crates.io-index`
139+
failed to download replaced source registry `crates-io`
140140
141141
Caused by:
142142
failed to parse manifest at `[..]/bar-1.0.0/Cargo.toml`

tests/testsuite/cross_publish.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ fn simple_cross_package() {
99
if cross_compile::disabled() {
1010
return;
1111
}
12-
1312
let p = project()
1413
.file(
1514
"Cargo.toml",
@@ -42,10 +41,11 @@ fn simple_cross_package() {
4241
p.cargo("package --target")
4342
.arg(&target)
4443
.with_stderr(
45-
" Packaging foo v0.0.0 ([CWD])
46-
Verifying foo v0.0.0 ([CWD])
47-
Compiling foo v0.0.0 ([CWD]/target/package/foo-0.0.0)
48-
Finished dev [unoptimized + debuginfo] target(s) in [..]
44+
"\
45+
[PACKAGING] foo v0.0.0 ([CWD])
46+
[VERIFYING] foo v0.0.0 ([CWD])
47+
[COMPILING] foo v0.0.0 ([CWD]/target/package/foo-0.0.0)
48+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
4949
",
5050
)
5151
.run();
@@ -100,15 +100,15 @@ fn publish_with_target() {
100100
p.cargo("publish --token sekrit")
101101
.arg("--target")
102102
.arg(&target)
103-
.with_stderr(&format!(
104-
" Updating `{registry}` index
105-
Packaging foo v0.0.0 ([CWD])
106-
Verifying foo v0.0.0 ([CWD])
107-
Compiling foo v0.0.0 ([CWD]/target/package/foo-0.0.0)
108-
Finished dev [unoptimized + debuginfo] target(s) in [..]
109-
Uploading foo v0.0.0 ([CWD])
103+
.with_stderr(
104+
"\
105+
[UPDATING] `dummy-registry` index
106+
[PACKAGING] foo v0.0.0 ([CWD])
107+
[VERIFYING] foo v0.0.0 ([CWD])
108+
[COMPILING] foo v0.0.0 ([CWD]/target/package/foo-0.0.0)
109+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
110+
[UPLOADING] foo v0.0.0 ([CWD])
110111
",
111-
registry = registry::registry_path().to_str().unwrap()
112-
))
112+
)
113113
.run();
114114
}

tests/testsuite/directory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ Caused by:
194194
no matching package found
195195
searched package name: `baz`
196196
perhaps you meant: bar or foo
197-
location searched: registry `https://github.com/rust-lang/crates.io-index`
197+
location searched: registry `crates-io`
198198
required by package `bar v0.1.0`
199199
",
200200
)

tests/testsuite/features_namespaced.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn dependency_gate_ignored() {
7070
"\
7171
[UPDATING] [..]
7272
[ERROR] no matching package named `bar` found
73-
location searched: registry `https://github.com/rust-lang/crates.io-index`
73+
location searched: registry `crates-io`
7474
required by package `foo v0.1.0 ([..]/foo)`
7575
",
7676
)

0 commit comments

Comments
 (0)