From 798108d04718fbd405cee8a59b8e9d3af0c7b728 Mon Sep 17 00:00:00 2001 From: eth3lbert Date: Mon, 24 Jun 2024 05:14:52 +0800 Subject: [PATCH] test: migrate publish to snapbox --- tests/testsuite/publish.rs | 1073 +++++++++++++++++------------------- 1 file changed, 521 insertions(+), 552 deletions(-) diff --git a/tests/testsuite/publish.rs b/tests/testsuite/publish.rs index b198e4850..08756997b 100644 --- a/tests/testsuite/publish.rs +++ b/tests/testsuite/publish.rs @@ -1,11 +1,9 @@ //! Tests for the `cargo publish` command. -#![allow(deprecated)] - use cargo_test_support::git::{self, repo}; use cargo_test_support::paths; use cargo_test_support::registry::{self, Package, RegistryBuilder, Response}; -use cargo_test_support::{basic_manifest, project, publish}; +use cargo_test_support::{basic_manifest, project, publish, str}; use std::fs; use std::sync::{Arc, Mutex}; @@ -112,20 +110,19 @@ fn simple() { p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] crates.io index -[WARNING] manifest has no documentation, [..] -See [..] -[PACKAGING] foo v0.0.1 ([CWD]) -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] foo v0.0.1 ([CWD]) +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `crates-io` [NOTE] waiting for `foo v0.0.1` to be available at registry `crates-io`. You may press ctrl-c to skip waiting; the crate should be available shortly. [PUBLISHED] foo v0.0.1 at registry `crates-io` -", - ) + +"#]]) .run(); validate_upload_foo(); @@ -157,20 +154,19 @@ fn simple_publish_with_http() { .build(); p.cargo("publish --no-verify --token sekrit --registry dummy-registry") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index -[WARNING] manifest has no documentation, [..] -See [..] -[PACKAGING] foo v0.0.1 ([CWD]) -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] foo v0.0.1 ([CWD]) +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `dummy-registry` [NOTE] waiting for `foo v0.0.1` to be available at registry `dummy-registry`. You may press ctrl-c to skip waiting; the crate should be available shortly. [PUBLISHED] foo v0.0.1 at registry `dummy-registry` -", - ) + +"#]]) .run(); } @@ -201,20 +197,19 @@ fn simple_publish_with_asymmetric() { p.cargo("publish --no-verify -Zasymmetric-token --registry dummy-registry") .masquerade_as_nightly_cargo(&["asymmetric-token"]) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index -[WARNING] manifest has no documentation, [..] -See [..] -[PACKAGING] foo v0.0.1 ([CWD]) -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] foo v0.0.1 ([CWD]) +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `dummy-registry` [NOTE] waiting for `foo v0.0.1` to be available at registry `dummy-registry`. You may press ctrl-c to skip waiting; the crate should be available shortly. [PUBLISHED] foo v0.0.1 at registry `dummy-registry` -", - ) + +"#]]) .run(); } @@ -246,30 +241,31 @@ fn old_token_location() { p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr_contains( - "[ERROR] no token found, \ - please run `cargo login`", - ) + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[ERROR] no token found, please run `cargo login` +or use environment variable CARGO_REGISTRY_TOKEN + +"#]]) .run(); fs::write(&credentials, format!(r#"token = "{}""#, registry.token())).unwrap(); p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] crates.io index -[WARNING] manifest has no documentation, [..] -See [..] -[PACKAGING] foo v0.0.1 ([CWD]) -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] foo v0.0.1 ([CWD]) +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `crates-io` -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.0.1 [..] -", - ) +[NOTE] waiting for `foo v0.0.1` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] foo v0.0.1 at registry `crates-io` + +"#]]) .run(); // Skip `validate_upload_foo` as we just cared we got far enough for verify the token behavior. @@ -302,20 +298,19 @@ fn simple_with_index() { .arg(registry.token()) .arg("--index") .arg(registry.index_url().as_str()) - .with_stderr( - "\ -[..] -[..] -[..] -[..] -[..] -[UPLOADING] foo v0.0.1 ([CWD]) + .with_stderr_data(str![[r#" +[UPDATING] `[ROOT]/registry` index +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `[ROOT]/registry` -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.0.1 [..] -", - ) +[NOTE] waiting for `foo v0.0.1` to be available at registry `[ROOT]/registry`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] foo v0.0.1 at registry `[ROOT]/registry` + +"#]]) .run(); // Skip `validate_upload_foo` as we just cared we got far enough for verify the VCS behavior. @@ -349,15 +344,14 @@ fn git_deps() { p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr( - "\ -[UPDATING] [..] index + .with_stderr_data(str![[r#" +[UPDATING] crates.io index [ERROR] all dependencies must have a version specified when publishing. dependency `foo` does not specify a version Note: The published dependency will use the version from crates.io, the `git` specification will be removed from the dependency declaration. -", - ) + +"#]]) .run(); } @@ -390,15 +384,14 @@ fn path_dependency_no_version() { p.cargo("publish") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr( - "\ -[UPDATING] [..] index + .with_stderr_data(str![[r#" +[UPDATING] crates.io index [ERROR] all dependencies must have a version specified when publishing. dependency `bar` does not specify a version Note: The published dependency will use the version from crates.io, the `path` specification will be removed from the dependency declaration. -", - ) + +"#]]) .run(); } @@ -427,12 +420,11 @@ fn unpublishable_crate() { p.cargo("publish --index") .arg(registry.index_url().as_str()) .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [ERROR] `foo` cannot be published. `package.publish` must be set to `true` or a non-empty list in Cargo.toml to publish. -", - ) + +"#]]) .run(); } @@ -465,17 +457,15 @@ fn dont_publish_dirty() { p.cargo("publish") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] crates.io index -error: 1 files in the working directory contain changes that were not yet \ -committed into git: +[ERROR] 1 files in the working directory contain changes that were not yet committed into git: bar to proceed despite this and include the uncommitted changes, pass the `--allow-dirty` flag -", - ) + +"#]]) .run(); } @@ -507,21 +497,20 @@ fn publish_clean() { p.cargo("publish") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ -[..] -[..] -[PACKAGED] [..] -[VERIFYING] foo v0.0.1 ([CWD]) -[..] -[..] -[UPLOADING] foo v0.0.1 ([CWD]) + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 5 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[VERIFYING] foo v0.0.1 ([ROOT]/foo) +[COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `crates-io` -[NOTE] waiting [..] +[NOTE] waiting for `foo v0.0.1` to be available at registry `crates-io`. You may press ctrl-c to skip waiting; the crate should be available shortly. -[PUBLISHED] foo v0.0.1 [..] -", - ) +[PUBLISHED] foo v0.0.1 at registry `crates-io` + +"#]]) .run(); // Skip `validate_upload_foo_clean` as we just cared we got far enough for verify the VCS behavior. @@ -557,21 +546,20 @@ fn publish_in_sub_repo() { p.cargo("publish") .replace_crates_io(registry.index_url()) .cwd("bar") - .with_stderr( - "\ -[..] -[..] -[PACKAGED] [..] -[VERIFYING] foo v0.0.1 ([CWD]) -[..] -[..] -[UPLOADING] foo v0.0.1 ([CWD]) + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[PACKAGING] foo v0.0.1 ([ROOT]/foo/bar) +[PACKAGED] 5 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[VERIFYING] foo v0.0.1 ([ROOT]/foo/bar) +[COMPILING] foo v0.0.1 ([ROOT]/foo/bar/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[UPLOADING] foo v0.0.1 ([ROOT]/foo/bar) [UPLOADED] foo v0.0.1 to registry `crates-io` -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.0.1 [..] -", - ) +[NOTE] waiting for `foo v0.0.1` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] foo v0.0.1 at registry `crates-io` + +"#]]) .run(); // Skip `validate_upload_foo_clean` as we just cared we got far enough for verify the VCS behavior. @@ -607,21 +595,20 @@ fn publish_when_ignored() { p.cargo("publish") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ -[..] -[..] -[PACKAGED] [..] -[VERIFYING] foo v0.0.1 ([CWD]) -[..] -[..] -[UPLOADING] foo v0.0.1 ([CWD]) + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 6 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[VERIFYING] foo v0.0.1 ([ROOT]/foo) +[COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `crates-io` -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.0.1 [..] -", - ) +[NOTE] waiting for `foo v0.0.1` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] foo v0.0.1 at registry `crates-io` + +"#]]) .run(); // Skip `validate_upload` as we just cared we got far enough for verify the VCS behavior. @@ -656,21 +643,20 @@ fn ignore_when_crate_ignored() { p.cargo("publish") .replace_crates_io(registry.index_url()) .cwd("bar") - .with_stderr( - "\ -[..] -[..] -[PACKAGED] [..] -[VERIFYING] foo v0.0.1 ([CWD]) -[..] -[..] -[UPLOADING] foo v0.0.1 ([CWD]) + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[PACKAGING] foo v0.0.1 ([ROOT]/foo/bar) +[PACKAGED] 5 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[VERIFYING] foo v0.0.1 ([ROOT]/foo/bar) +[COMPILING] foo v0.0.1 ([ROOT]/foo/bar/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[UPLOADING] foo v0.0.1 ([ROOT]/foo/bar) [UPLOADED] foo v0.0.1 to registry `crates-io` -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.0.1 [..] -", - ) +[NOTE] waiting for `foo v0.0.1` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] foo v0.0.1 at registry `crates-io` + +"#]]) .run(); // Skip `validate_upload` as we just cared we got far enough for verify the VCS behavior. @@ -704,10 +690,11 @@ fn new_crate_rejected() { p.cargo("publish") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr_contains( - "[ERROR] 3 files in the working directory contain \ - changes that were not yet committed into git:", - ) + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[ERROR] 3 files in the working directory contain changes that were not yet committed into git: +... +"#]]) .run(); } @@ -734,20 +721,19 @@ fn dry_run() { p.cargo("publish --dry-run --index") .arg(registry.index_url().as_str()) - .with_stderr( - "\ -[UPDATING] `[..]` index -[WARNING] manifest has no documentation, [..] -See [..] -[PACKAGING] foo v0.0.1 ([CWD]) -[PACKAGED] [..] files, [..] ([..] compressed) -[VERIFYING] foo v0.0.1 ([CWD]) -[COMPILING] foo v0.0.1 [..] -[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..] -[UPLOADING] foo v0.0.1 ([CWD]) + .with_stderr_data(str![[r#" +[UPDATING] `[ROOT]/registry` index +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[VERIFYING] foo v0.0.1 ([ROOT]/foo) +[COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [WARNING] aborting upload due to dry run -", - ) + +"#]]) .run(); // Ensure the API request wasn't actually made @@ -780,12 +766,11 @@ fn registry_not_in_publish_list() { .arg("--registry") .arg("alternative") .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [ERROR] `foo` cannot be published. The registry `alternative` is not listed in the `package.publish` value in Cargo.toml. -", - ) + +"#]]) .run(); } @@ -810,12 +795,11 @@ fn publish_empty_list() { p.cargo("publish --registry alternative") .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [ERROR] `foo` cannot be published. `package.publish` must be set to `true` or a non-empty list in Cargo.toml to publish. -", - ) + +"#]]) .run(); } @@ -850,21 +834,20 @@ fn publish_allowed_registry() { .build(); p.cargo("publish --registry alternative") - .with_stderr( - "\ -[..] -[..] -[PACKAGED] [..] -[VERIFYING] foo v0.0.1 ([CWD]) -[..] -[..] -[UPLOADING] foo v0.0.1 ([CWD]) + .with_stderr_data(str![[r#" +[UPDATING] `alternative` index +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 5 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[VERIFYING] foo v0.0.1 ([ROOT]/foo) +[COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `alternative` [NOTE] waiting for `foo v0.0.1` to be available at registry `alternative`. -You may press ctrl-c [..] +You may press ctrl-c to skip waiting; the crate should be available shortly. [PUBLISHED] foo v0.0.1 at registry `alternative` -", - ) + +"#]]) .run(); publish::validate_alt_upload( @@ -911,22 +894,21 @@ fn publish_implicitly_to_only_allowed_registry() { .build(); p.cargo("publish") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [NOTE] found `alternative` as only allowed registry. Publishing to it automatically. [UPDATING] `alternative` index -[..] -[PACKAGED] [..] -[VERIFYING] foo v0.0.1 ([CWD]) -[..] -[..] -[UPLOADING] foo v0.0.1 ([CWD]) +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 5 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[VERIFYING] foo v0.0.1 ([ROOT]/foo) +[COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `alternative` -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.0.1 [..] -", - ) +[NOTE] waiting for `foo v0.0.1` to be available at registry `alternative`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] foo v0.0.1 at registry `alternative` + +"#]]) .run(); publish::validate_alt_upload( @@ -976,12 +958,11 @@ fn publish_failed_with_index_and_only_allowed_registry() { .arg("--index") .arg(registry.index_url().as_str()) .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [NOTE] found `alternative` as only allowed registry. Publishing to it automatically. [ERROR] command-line argument --index requires --token to be specified -", - ) + +"#]]) .run(); } @@ -1011,12 +992,11 @@ fn publish_fail_with_no_registry_specified() { p.cargo("publish") .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [ERROR] `foo` cannot be published. The registry `crates-io` is not listed in the `package.publish` value in Cargo.toml. -", - ) + +"#]]) .run(); } @@ -1041,12 +1021,11 @@ fn block_publish_no_registry() { p.cargo("publish --registry alternative") .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [ERROR] `foo` cannot be published. `package.publish` must be set to `true` or a non-empty list in Cargo.toml to publish. -", - ) + +"#]]) .run(); } @@ -1075,33 +1054,31 @@ fn publish_with_crates_io_explicit() { p.cargo("publish --registry alternative") .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [ERROR] `foo` cannot be published. The registry `alternative` is not listed in the `package.publish` value in Cargo.toml. -", - ) + +"#]]) .run(); p.cargo("publish") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ -[UPDATING] [..] -[WARNING] [..] -[..] -[PACKAGING] [..] -[PACKAGED] [..] -[VERIFYING] foo v0.0.1 ([CWD]) -[..] -[..] -[UPLOADING] foo v0.0.1 ([CWD]) + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[VERIFYING] foo v0.0.1 ([ROOT]/foo) +[COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `crates-io` -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.0.1 [..] -", - ) +[NOTE] waiting for `foo v0.0.1` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] foo v0.0.1 at registry `crates-io` + +"#]]) .run(); } @@ -1137,23 +1114,22 @@ fn publish_with_select_features() { p.cargo("publish --features required") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ -[..] -[..] -[..] -[..] -[PACKAGED] [..] -[VERIFYING] foo v0.0.1 ([CWD]) -[..] -[..] -[UPLOADING] foo v0.0.1 ([CWD]) + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[VERIFYING] foo v0.0.1 ([ROOT]/foo) +[COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `crates-io` -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.0.1 [..] -", - ) +[NOTE] waiting for `foo v0.0.1` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] foo v0.0.1 at registry `crates-io` + +"#]]) .run(); } @@ -1189,23 +1165,22 @@ fn publish_with_all_features() { p.cargo("publish --all-features") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ -[..] -[..] -[..] -[..] -[PACKAGED] [..] -[VERIFYING] foo v0.0.1 ([CWD]) -[..] -[..] -[UPLOADING] foo v0.0.1 ([CWD]) + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[VERIFYING] foo v0.0.1 ([ROOT]/foo) +[COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `crates-io` -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.0.1 [..] -", - ) +[NOTE] waiting for `foo v0.0.1` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] foo v0.0.1 at registry `crates-io` + +"#]]) .run(); } @@ -1242,7 +1217,11 @@ fn publish_with_no_default_features() { p.cargo("publish --no-default-features") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr_contains("error: This crate requires `required` feature!") + .with_stderr_data(str![[r#" +... +[ERROR] This crate requires `required` feature! +... +"#]]) .run(); } @@ -1286,7 +1265,11 @@ fn publish_with_patch() { p.cargo("publish") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr_contains("[..]newfunc[..]") + .with_stderr_data(str![[r#" +... +error[E0425]: cannot find function `newfunc` in crate `bar` +... +"#]]) .run(); // Remove the usage of new functionality and try again. @@ -1294,25 +1277,24 @@ fn publish_with_patch() { p.cargo("publish") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ -[..] -[..] -[..] -[..] + .with_stderr_data(str![[r#" [UPDATING] crates.io index -[PACKAGED] [..] -[VERIFYING] foo v0.0.1 ([CWD]) -[..] -[..] -[..] -[UPLOADING] foo v0.0.1 ([CWD]) +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[UPDATING] crates.io index +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[VERIFYING] foo v0.0.1 ([ROOT]/foo) +[COMPILING] bar v1.0.0 +[COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `crates-io` -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.0.1 [..] -", - ) +[NOTE] waiting for `foo v0.0.1` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] foo v0.0.1 at registry `crates-io` + +"#]]) .run(); publish::validate_upload( @@ -1353,6 +1335,7 @@ You may press ctrl-c [..] ); } +#[allow(deprecated)] #[cargo_test] fn publish_checks_for_token_before_verify() { let registry = registry::RegistryBuilder::new() @@ -1379,27 +1362,31 @@ fn publish_checks_for_token_before_verify() { p.cargo("publish") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr_contains("[ERROR] no token found, please run `cargo login`") + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[ERROR] no token found, please run `cargo login` +or use environment variable CARGO_REGISTRY_TOKEN + +"#]]) .with_stderr_does_not_contain("[VERIFYING] foo v0.0.1 ([CWD])") .run(); // Assert package verified successfully on dry run p.cargo("publish --dry-run") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ -[..] -[..] -[..] -[..] -[PACKAGED] [..] -[VERIFYING] foo v0.0.1 ([CWD]) -[..] -[..] -[UPLOADING] foo v0.0.1 [..] + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[VERIFYING] foo v0.0.1 ([ROOT]/foo) +[COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [WARNING] aborting upload due to dry run -", - ) + +"#]]) .run(); } @@ -1421,12 +1408,11 @@ fn publish_with_bad_source() { p.cargo("publish") .with_status(101) - .with_stderr( - "\ -[ERROR] crates-io is replaced with non-remote-registry source registry `[..]/foo/registry`; + .with_stderr_data(str![[r#" +[ERROR] crates-io is replaced with non-remote-registry source registry `[ROOT]/foo/registry`; include `--registry crates-io` to use crates.io -", - ) + +"#]]) .run(); p.change_file( @@ -1442,12 +1428,11 @@ include `--registry crates-io` to use crates.io p.cargo("publish") .with_status(101) - .with_stderr( - "\ -[ERROR] crates-io is replaced with non-remote-registry source dir [..]/foo/vendor; + .with_stderr_data(str![[r#" +[ERROR] crates-io is replaced with non-remote-registry source dir [ROOT]/foo/vendor; include `--registry crates-io` to use crates.io -", - ) + +"#]]) .run(); } @@ -1495,25 +1480,29 @@ fn publish_git_with_version() { ) .build(); - p.cargo("run").with_stdout("2").run(); + p.cargo("run") + .with_stdout_data(str![[r#" +2 + +"#]]) + .run(); p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ -[..] -[..] -[..] -[..] -[..] -[..] -[UPLOADING] foo v0.1.0 ([CWD]) + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.1.0 ([ROOT]/foo) +[UPDATING] crates.io index +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.1.0 ([ROOT]/foo) [UPLOADED] foo v0.1.0 to registry `crates-io` -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.1.0 [..] -", - ) +[NOTE] waiting for `foo v0.1.0` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] foo v0.1.0 at registry `crates-io` + +"#]]) .run(); publish::validate_upload_with_contents( @@ -1636,18 +1625,17 @@ fn publish_dev_dep_no_version() { p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ -[UPDATING] [..] -[PACKAGING] foo v0.1.0 [..] -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] foo v0.1.0 [..] -[UPLOADED] foo v0.1.0 [..] -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.1.0 [..] -", - ) + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[PACKAGING] foo v0.1.0 ([ROOT]/foo) +[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.1.0 ([ROOT]/foo) +[UPLOADED] foo v0.1.0 to registry `crates-io` +[NOTE] waiting for `foo v0.1.0` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] foo v0.1.0 at registry `crates-io` + +"#]]) .run(); publish::validate_upload_with_contents( @@ -1806,19 +1794,18 @@ fn publish_with_feature_point_diff_kinds_dep() { p.cargo("publish --no-verify") .env("RUSTFLAGS", "--cfg unix") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ -[UPDATING] [..] -[PACKAGING] foo v0.1.0 [..] -[UPDATING] [..] -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] foo v0.1.0 [..] -[UPLOADED] foo v0.1.0 [..] -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.1.0 [..] -", - ) + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[PACKAGING] foo v0.1.0 ([ROOT]/foo) +[UPDATING] crates.io index +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.1.0 ([ROOT]/foo) +[UPLOADED] foo v0.1.0 to registry `crates-io` +[NOTE] waiting for `foo v0.1.0` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] foo v0.1.0 at registry `crates-io` + +"#]]) .run(); publish::validate_upload_with_contents( @@ -2044,7 +2031,11 @@ fn credentials_ambiguous_filename() { p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr_contains("[..]Unauthorized message from server[..]") + .with_stderr_data(str![[r#" +... + Unauthorized message from server. + +"#]]) .run(); // Favor `credentials` if exists. @@ -2053,21 +2044,20 @@ fn credentials_ambiguous_filename() { p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ -[..] -[WARNING] both `[..]/credentials` and `[..]/credentials.toml` exist. Using `[..]/credentials` -[..] -[..] -[..] -[..] -[UPLOADING] foo v0.0.1 [..] -[UPLOADED] foo v0.0.1 [..] -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.0.1 [..] -", - ) + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[WARNING] both `[ROOT]/home/.cargo/credentials` and `[ROOT]/home/.cargo/credentials.toml` exist. Using `[ROOT]/home/.cargo/credentials` +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) +[UPLOADED] foo v0.0.1 to registry `crates-io` +[NOTE] waiting for `foo v0.0.1` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] foo v0.0.1 at registry `crates-io` + +"#]]) .run(); } @@ -2100,11 +2090,10 @@ fn index_requires_token() { p.cargo("publish --no-verify --index") .arg(registry.index_url().as_str()) .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [ERROR] command-line argument --index requires --token to be specified -", - ) + +"#]]) .run(); } @@ -2130,12 +2119,11 @@ fn cratesio_source_replacement() { p.cargo("publish --no-verify") .with_status(101) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [ERROR] crates-io is replaced with remote registry dummy-registry; include `--registry dummy-registry` or `--registry crates-io` -", - ) + +"#]]) .run(); } @@ -2173,18 +2161,17 @@ fn api_error_json() { p.cargo("publish --no-verify --registry alternative") .with_status(101) - .with_stderr( - "\ -[UPDATING] [..] -[PACKAGING] foo v0.0.1 [..] -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] foo v0.0.1 [..] + .with_stderr_data(str![[r#" +[UPDATING] `alternative` index +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [ERROR] failed to publish to registry at http://127.0.0.1:[..]/ Caused by: the remote server responded with an error (status 403 Forbidden): you must be logged in -", - ) + +"#]]) .run(); } @@ -2222,18 +2209,17 @@ fn api_error_200() { p.cargo("publish --no-verify --registry alternative") .with_status(101) - .with_stderr( - "\ -[UPDATING] [..] -[PACKAGING] foo v0.0.1 [..] -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] foo v0.0.1 [..] + .with_stderr_data(str![[r#" +[UPDATING] `alternative` index +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [ERROR] failed to publish to registry at http://127.0.0.1:[..]/ Caused by: - the remote server responded with an error: max upload size is 123 -", - ) + the remote server responded with an [ERROR] max upload size is 123 + +"#]]) .run(); } @@ -2271,25 +2257,24 @@ fn api_error_code() { p.cargo("publish --no-verify --registry alternative") .with_status(101) - .with_stderr( - "\ -[UPDATING] [..] -[PACKAGING] foo v0.0.1 [..] -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] foo v0.0.1 [..] + .with_stderr_data(str![[r#" +[UPDATING] `alternative` index +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [ERROR] failed to publish to registry at http://127.0.0.1:[..]/ Caused by: failed to get a 200 OK response, got 400 headers: - HTTP/1.1 400 - Content-Length: 7 - Connection: close - + HTTP/1.1 400 + Content-Length: 7 + Connection: close + body: go away -", - ) + +"#]]) .run(); } @@ -2329,18 +2314,17 @@ fn api_curl_error() { // Server returned nothing (no headers, no data) (Empty reply from server) p.cargo("publish --no-verify --registry alternative") .with_status(101) - .with_stderr( - "\ -[UPDATING] [..] -[PACKAGING] foo v0.0.1 [..] -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] foo v0.0.1 [..] + .with_stderr_data(str![[r#" +[UPDATING] `alternative` index +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [ERROR] failed to publish to registry at http://127.0.0.1:[..]/ Caused by: - [52] [..] -", - ) + [52] Server returned nothing (no headers, no data) (Empty reply from server) + +"#]]) .run(); } @@ -2378,21 +2362,20 @@ fn api_other_error() { p.cargo("publish --no-verify --registry alternative") .with_status(101) - .with_stderr( - "\ -[UPDATING] [..] -[PACKAGING] foo v0.0.1 [..] -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] foo v0.0.1 [..] + .with_stderr_data(str![[r#" +[UPDATING] `alternative` index +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [ERROR] failed to publish to registry at http://127.0.0.1:[..]/ Caused by: invalid response body from server Caused by: - invalid utf-8 sequence of [..] -", - ) + invalid utf-8 sequence of 1 bytes from index 0 + +"#]]) .run(); } @@ -2430,20 +2413,19 @@ fn in_package_workspace() { p.cargo("publish -p li --no-verify") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ -[UPDATING] [..] + .with_stderr_data(str![[r#" +[UPDATING] crates.io index [WARNING] manifest has no documentation, homepage or repository. -See [..] -[PACKAGING] li v0.0.1 ([CWD]/li) -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] li v0.0.1 ([CWD]/li) +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] li v0.0.1 ([ROOT]/foo/li) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] li v0.0.1 ([ROOT]/foo/li) [UPLOADED] li v0.0.1 to registry `crates-io` -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] li v0.0.1 [..] -", - ) +[NOTE] waiting for `li v0.0.1` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] li v0.0.1 at registry `crates-io` + +"#]]) .run(); validate_upload_li(); @@ -2498,9 +2480,10 @@ fn with_duplicate_spec_in_members() { p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr( - "error: the `-p` argument must be specified to select a single package to publish", - ) + .with_stderr_data(str![[r#" +[ERROR] the `-p` argument must be specified to select a single package to publish + +"#]]) .run(); } @@ -2538,20 +2521,19 @@ fn in_package_workspace_with_members_with_features_old() { p.cargo("publish -p li --no-verify") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ -[UPDATING] [..] + .with_stderr_data(str![[r#" +[UPDATING] crates.io index [WARNING] manifest has no documentation, homepage or repository. -See [..] -[PACKAGING] li v0.0.1 ([CWD]/li) -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] li v0.0.1 ([CWD]/li) +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] li v0.0.1 ([ROOT]/foo/li) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] li v0.0.1 ([ROOT]/foo/li) [UPLOADED] li v0.0.1 to registry `crates-io` -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] li v0.0.1 [..] -", - ) +[NOTE] waiting for `li v0.0.1` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] li v0.0.1 at registry `crates-io` + +"#]]) .run(); validate_upload_li(); @@ -2588,9 +2570,10 @@ fn in_virtual_workspace() { p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr( - "error: the `-p` argument must be specified in the root of a virtual workspace", - ) + .with_stderr_data(str![[r#" +[ERROR] the `-p` argument must be specified in the root of a virtual workspace + +"#]]) .run(); } @@ -2637,20 +2620,19 @@ fn in_virtual_workspace_with_p() { p.cargo("publish -p li --no-verify") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ -[UPDATING] [..] + .with_stderr_data(str![[r#" +[UPDATING] crates.io index [WARNING] manifest has no documentation, homepage or repository. -See [..] -[PACKAGING] li v0.0.1 ([CWD]/li) -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] li v0.0.1 ([CWD]/li) +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] li v0.0.1 ([ROOT]/foo/li) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] li v0.0.1 ([ROOT]/foo/li) [UPLOADED] li v0.0.1 to registry `crates-io` -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] li v0.0.1 [..] -", - ) +[NOTE] waiting for `li v0.0.1` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] li v0.0.1 at registry `crates-io` + +"#]]) .run(); } @@ -2689,13 +2671,12 @@ fn in_package_workspace_not_found() { p.cargo("publish -p li --no-verify") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr( - "\ -error: package ID specification `li` did not match any packages + .with_stderr_data(str![[r#" +[ERROR] package ID specification `li` did not match any packages -Did you mean `foo`? -", - ) + Did you mean `foo`? + +"#]]) .run(); } @@ -2748,11 +2729,10 @@ fn in_package_workspace_found_multiple() { p.cargo("publish -p li* --no-verify") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr( - "\ -error: the `-p` argument must be specified to select a single package to publish -", - ) + .with_stderr_data(str![[r#" +[ERROR] the `-p` argument must be specified to select a single package to publish + +"#]]) .run(); } @@ -2793,13 +2773,12 @@ fn publish_path_dependency_without_workspace() { p.cargo("publish -p bar --no-verify") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr( - "\ -error: package ID specification `bar` did not match any packages + .with_stderr_data(str![[r#" +[ERROR] package ID specification `bar` did not match any packages -Did you mean `foo`? -", - ) + Did you mean `foo`? + +"#]]) .run(); } @@ -2825,23 +2804,22 @@ fn http_api_not_noop() { p.cargo("publish") .replace_crates_io(registry.index_url()) - .with_stderr( - "\ -[..] -[..] -[..] -[..] -[PACKAGED] [..] -[VERIFYING] foo v0.0.1 ([CWD]) -[..] -[..] -[UPLOADING] foo v0.0.1 ([CWD]) + .with_stderr_data(str![[r#" +[UPDATING] crates.io index +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[VERIFYING] foo v0.0.1 ([ROOT]/foo) +[COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1) +[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `crates-io` -[NOTE] waiting [..] -You may press ctrl-c [..] -[PUBLISHED] foo v0.0.1 [..] -", - ) +[NOTE] waiting for `foo v0.0.1` to be available at registry `crates-io`. +You may press ctrl-c to skip waiting; the crate should be available shortly. +[PUBLISHED] foo v0.0.1 at registry `crates-io` + +"#]]) .run(); let p = project() @@ -2907,20 +2885,19 @@ fn wait_for_first_publish() { p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) .with_status(0) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] crates.io index -[WARNING] manifest has no documentation, [..] -See [..] -[PACKAGING] delay v0.0.1 ([CWD]) -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] delay v0.0.1 ([CWD]) +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] delay v0.0.1 ([ROOT]/foo) +[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] delay v0.0.1 ([ROOT]/foo) [UPLOADED] delay v0.0.1 to registry `crates-io` [NOTE] waiting for `delay v0.0.1` to be available at registry `crates-io`. You may press ctrl-c to skip waiting; the crate should be available shortly. [PUBLISHED] delay v0.0.1 at registry `crates-io` -", - ) + +"#]]) .run(); // Verify the responder has been pinged @@ -3001,20 +2978,19 @@ fn wait_for_first_publish_underscore() { p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) .with_status(0) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] crates.io index -[WARNING] manifest has no documentation, [..] -See [..] -[PACKAGING] delay_with_underscore v0.0.1 ([CWD]) -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] delay_with_underscore v0.0.1 ([CWD]) +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] delay_with_underscore v0.0.1 ([ROOT]/foo) +[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] delay_with_underscore v0.0.1 ([ROOT]/foo) [UPLOADED] delay_with_underscore v0.0.1 to registry `crates-io` [NOTE] waiting for `delay_with_underscore v0.0.1` to be available at registry `crates-io`. You may press ctrl-c to skip waiting; the crate should be available shortly. [PUBLISHED] delay_with_underscore v0.0.1 at registry `crates-io` -", - ) + +"#]]) .run(); // Verify the repsponder has been pinged @@ -3102,20 +3078,19 @@ fn wait_for_subsequent_publish() { p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) .with_status(0) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] crates.io index -[WARNING] manifest has no documentation, [..] -See [..] -[PACKAGING] delay v0.0.2 ([CWD]) -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] delay v0.0.2 ([CWD]) +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] delay v0.0.2 ([ROOT]/foo) +[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] delay v0.0.2 ([ROOT]/foo) [UPLOADED] delay v0.0.2 to registry `crates-io` [NOTE] waiting for `delay v0.0.2` to be available at registry `crates-io`. You may press ctrl-c to skip waiting; the crate should be available shortly. [PUBLISHED] delay v0.0.2 at registry `crates-io` -", - ) + +"#]]) .run(); // Verify the responder has been pinged @@ -3173,16 +3148,15 @@ fn skip_wait_for_publish() { p.cargo("publish --no-verify -Zpublish-timeout") .replace_crates_io(registry.index_url()) .masquerade_as_nightly_cargo(&["publish-timeout"]) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] crates.io index -[WARNING] manifest has no documentation, [..] -See [..] -[PACKAGING] foo v0.0.1 ([CWD]) -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] foo v0.0.1 ([CWD]) -", - ) +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) + +"#]]) .run(); } @@ -3221,21 +3195,20 @@ fn timeout_waiting_for_publish() { .replace_crates_io(registry.index_url()) .masquerade_as_nightly_cargo(&["publish-timeout"]) .with_status(0) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] crates.io index -[WARNING] manifest has no documentation, [..] -See [..] -[PACKAGING] delay v0.0.1 ([CWD]) -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] delay v0.0.1 ([CWD]) +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] delay v0.0.1 ([ROOT]/foo) +[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] delay v0.0.1 ([ROOT]/foo) [UPLOADED] delay v0.0.1 to registry `crates-io` [NOTE] waiting for `delay v0.0.1` to be available at registry `crates-io`. You may press ctrl-c to skip waiting; the crate should be available shortly. -warning: timed out waiting for `delay v0.0.1` to be available in registry `crates-io` +[WARNING] timed out waiting for `delay v0.0.1` to be available in registry `crates-io` [NOTE] the registry may have a backlog that is delaying making the crate available. The crate should be available soon. -", - ) + +"#]]) .run(); } @@ -3271,20 +3244,19 @@ fn wait_for_git_publish() { p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) .with_status(0) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] crates.io index -[WARNING] manifest has no documentation, [..] -See [..] -[PACKAGING] delay v0.0.2 ([CWD]) -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] delay v0.0.2 ([CWD]) +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] delay v0.0.2 ([ROOT]/foo) +[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] delay v0.0.2 ([ROOT]/foo) [UPLOADED] delay v0.0.2 to registry `crates-io` [NOTE] waiting for `delay v0.0.2` to be available at registry `crates-io`. You may press ctrl-c to skip waiting; the crate should be available shortly. [PUBLISHED] delay v0.0.2 at registry `crates-io` -", - ) + +"#]]) .run(); let p = project() @@ -3331,19 +3303,18 @@ fn invalid_token() { p.cargo("publish --no-verify") .replace_crates_io(registry.index_url()) .env("CARGO_REGISTRY_TOKEN", "\x16") - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] crates.io index [PACKAGING] foo v0.0.1 ([ROOT]/foo) -[PACKAGED] 4 files, [..] +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) [UPLOADING] foo v0.0.1 ([ROOT]/foo) -error: failed to publish to registry at http://127.0.0.1:[..]/ +[ERROR] failed to publish to registry at http://127.0.0.1:[..]/ Caused by: token contains invalid characters. Only printable ISO-8859-1 characters are allowed as it is sent in a HTTPS header. -", - ) + +"#]]) .with_status(101) .run(); } @@ -3368,12 +3339,11 @@ fn versionless_package() { p.cargo("publish") .replace_crates_io(registry.index_url()) .with_status(101) - .with_stderr( - "\ -error: `foo` cannot be published. + .with_stderr_data(str![[r#" +[ERROR] `foo` cannot be published. `package.publish` must be set to `true` or a non-empty list in Cargo.toml to publish. -", - ) + +"#]]) .run(); } @@ -3410,20 +3380,19 @@ target-dep = { version = "0.1.0", optional = true } p.cargo("publish --no-verify") .masquerade_as_nightly_cargo(&["edition2024"]) .replace_crates_io(registry.index_url()) - .with_stderr( - "\ + .with_stderr_data(str![[r#" [UPDATING] crates.io index -[WARNING] manifest has no documentation, [..] -See [..] -[PACKAGING] foo v0.0.1 ([CWD]) -[PACKAGED] [..] files, [..] ([..] compressed) -[UPLOADING] foo v0.0.1 ([CWD]) +[WARNING] manifest has no documentation, homepage or repository. +See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info. +[PACKAGING] foo v0.0.1 ([ROOT]/foo) +[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) +[UPLOADING] foo v0.0.1 ([ROOT]/foo) [UPLOADED] foo v0.0.1 to registry `crates-io` [NOTE] waiting for `foo v0.0.1` to be available at registry `crates-io`. You may press ctrl-c to skip waiting; the crate should be available shortly. [PUBLISHED] foo v0.0.1 at registry `crates-io` -", - ) + +"#]]) .run(); validate_upload_foo();