Skip to content

Commit 08df53b

Browse files
committed
refactor(tests): Be explicit about publish stderr
1 parent 5e5b532 commit 08df53b

File tree

1 file changed

+111
-3
lines changed

1 file changed

+111
-3
lines changed

tests/testsuite/publish.rs

Lines changed: 111 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,14 @@ fn simple_with_index() {
209209
.arg(registry.token())
210210
.arg("--index")
211211
.arg(registry.index_url().as_str())
212+
.with_stderr(
213+
"\
214+
[..]
215+
[..]
216+
[..]
217+
[..]
218+
[UPLOADING] foo v0.0.1 ([CWD])",
219+
)
212220
.run();
213221

214222
validate_upload_foo();
@@ -325,6 +333,7 @@ The registry `crates-io` is not listed in the `publish` value in Cargo.toml.
325333
#[cargo_test]
326334
fn dont_publish_dirty() {
327335
let registry = registry::init();
336+
328337
let p = project().file("bar", "").build();
329338

330339
let _ = git::repo(&paths::root().join("foo"))
@@ -388,6 +397,15 @@ fn publish_clean() {
388397

389398
p.cargo("publish")
390399
.replace_crates_io(registry.index_url())
400+
.with_stderr(
401+
"\
402+
[..]
403+
[..]
404+
[VERIFYING] foo v0.0.1 ([CWD])
405+
[..]
406+
[..]
407+
[UPLOADING] foo v0.0.1 ([CWD])",
408+
)
391409
.run();
392410

393411
validate_upload_foo_clean();
@@ -420,6 +438,15 @@ fn publish_in_sub_repo() {
420438
p.cargo("publish")
421439
.replace_crates_io(registry.index_url())
422440
.cwd("bar")
441+
.with_stderr(
442+
"\
443+
[..]
444+
[..]
445+
[VERIFYING] foo v0.0.1 ([CWD])
446+
[..]
447+
[..]
448+
[UPLOADING] foo v0.0.1 ([CWD])",
449+
)
423450
.run();
424451

425452
validate_upload_foo_clean();
@@ -452,6 +479,15 @@ fn publish_when_ignored() {
452479

453480
p.cargo("publish")
454481
.replace_crates_io(registry.index_url())
482+
.with_stderr(
483+
"\
484+
[..]
485+
[..]
486+
[VERIFYING] foo v0.0.1 ([CWD])
487+
[..]
488+
[..]
489+
[UPLOADING] foo v0.0.1 ([CWD])",
490+
)
455491
.run();
456492

457493
publish::validate_upload(
@@ -494,6 +530,15 @@ fn ignore_when_crate_ignored() {
494530
p.cargo("publish")
495531
.replace_crates_io(registry.index_url())
496532
.cwd("bar")
533+
.with_stderr(
534+
"\
535+
[..]
536+
[..]
537+
[VERIFYING] foo v0.0.1 ([CWD])
538+
[..]
539+
[..]
540+
[UPLOADING] foo v0.0.1 ([CWD])",
541+
)
497542
.run();
498543

499544
publish::validate_upload(
@@ -669,7 +714,17 @@ fn publish_allowed_registry() {
669714
.file("src/main.rs", "fn main() {}")
670715
.build();
671716

672-
p.cargo("publish --registry alternative").run();
717+
p.cargo("publish --registry alternative")
718+
.with_stderr(
719+
"\
720+
[..]
721+
[..]
722+
[VERIFYING] foo v0.0.1 ([CWD])
723+
[..]
724+
[..]
725+
[UPLOADING] foo v0.0.1 ([CWD])",
726+
)
727+
.run();
673728

674729
publish::validate_alt_upload(
675730
CLEAN_FOO_JSON,
@@ -709,7 +764,18 @@ fn publish_implicitly_to_only_allowed_registry() {
709764
.file("src/main.rs", "fn main() {}")
710765
.build();
711766

712-
p.cargo("publish").run();
767+
p.cargo("publish")
768+
.with_stderr(
769+
"\
770+
[NOTE] Found `alternative` as only allowed registry. Publishing to it automatically.
771+
[UPDATING] `alternative` index
772+
[..]
773+
[VERIFYING] foo v0.0.1 ([CWD])
774+
[..]
775+
[..]
776+
[UPLOADING] foo v0.0.1 ([CWD])",
777+
)
778+
.run();
713779

714780
publish::validate_alt_upload(
715781
CLEAN_FOO_JSON,
@@ -820,6 +886,17 @@ The registry `alternative` is not listed in the `publish` value in Cargo.toml.
820886

821887
p.cargo("publish")
822888
.replace_crates_io(registry.index_url())
889+
.with_stderr(
890+
"\
891+
[UPDATING] [..]
892+
[WARNING] [..]
893+
[..]
894+
[PACKAGING] [..]
895+
[VERIFYING] foo v0.0.1 ([CWD])
896+
[..]
897+
[..]
898+
[UPLOADING] foo v0.0.1 ([CWD])",
899+
)
823900
.run();
824901
}
825902

@@ -995,6 +1072,18 @@ fn publish_with_patch() {
9951072

9961073
p.cargo("publish")
9971074
.replace_crates_io(registry.index_url())
1075+
.with_stderr(
1076+
"\
1077+
[..]
1078+
[..]
1079+
[..]
1080+
[..]
1081+
[VERIFYING] foo v0.0.1 ([CWD])
1082+
[..]
1083+
[..]
1084+
[..]
1085+
[UPLOADING] foo v0.0.1 ([CWD])",
1086+
)
9981087
.run();
9991088

10001089
publish::validate_upload(
@@ -1179,6 +1268,14 @@ fn publish_git_with_version() {
11791268
p.cargo("run").with_stdout("2").run();
11801269
p.cargo("publish --no-verify")
11811270
.replace_crates_io(registry.index_url())
1271+
.with_stderr(
1272+
"\
1273+
[..]
1274+
[..]
1275+
[..]
1276+
[..]
1277+
[UPLOADING] foo v0.1.0 ([CWD])",
1278+
)
11821279
.run();
11831280

11841281
publish::validate_upload_with_contents(
@@ -2117,7 +2214,7 @@ fn http_api_not_noop() {
21172214
.file(
21182215
"Cargo.toml",
21192216
r#"
2120-
[project]
2217+
[package]
21212218
name = "foo"
21222219
version = "0.0.1"
21232220
authors = []
@@ -2130,6 +2227,17 @@ fn http_api_not_noop() {
21302227

21312228
p.cargo("publish")
21322229
.replace_crates_io(registry.index_url())
2230+
.with_stderr(
2231+
"\
2232+
[..]
2233+
[..]
2234+
[..]
2235+
[..]
2236+
[VERIFYING] foo v0.0.1 ([CWD])
2237+
[..]
2238+
[..]
2239+
[UPLOADING] foo v0.0.1 ([CWD])",
2240+
)
21332241
.run();
21342242

21352243
let p = project()

0 commit comments

Comments
 (0)