-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: migrate search, source_replacement and standard_lib to snapbox #14151
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
//! Tests for `[source]` table (source replacement). | ||
|
||
#![allow(deprecated)] | ||
|
||
use std::fs; | ||
|
||
use cargo_test_support::registry::{Package, RegistryBuilder, TestRegistry}; | ||
use cargo_test_support::{cargo_process, paths, project, t}; | ||
use cargo_test_support::{cargo_process, paths, project, str, t}; | ||
|
||
fn setup_replacement(config: &str) -> TestRegistry { | ||
let crates_io = RegistryBuilder::new() | ||
|
@@ -52,7 +50,10 @@ fn crates_io_token_not_sent_to_replacement() { | |
|
||
p.cargo("publish --no-verify --registry crates-io") | ||
.replace_crates_io(crates_io.index_url()) | ||
.with_stderr_contains("[UPDATING] crates.io index") | ||
.with_stderr_data(str![[r#" | ||
[UPDATING] crates.io index | ||
... | ||
"#]]) | ||
.run(); | ||
} | ||
|
||
|
@@ -69,22 +70,20 @@ fn token_sent_to_correct_registry() { | |
|
||
cargo_process("yank [email protected] --registry crates-io") | ||
.replace_crates_io(crates_io.index_url()) | ||
.with_stderr( | ||
"\ | ||
.with_stderr_data(str![[r#" | ||
[UPDATING] crates.io index | ||
[YANK] [email protected] | ||
", | ||
) | ||
|
||
"#]]) | ||
.run(); | ||
|
||
cargo_process("yank [email protected] --registry alternative") | ||
.replace_crates_io(crates_io.index_url()) | ||
.with_stderr( | ||
"\ | ||
.with_stderr_data(str![[r#" | ||
[UPDATING] `alternative` index | ||
[YANK] [email protected] | ||
", | ||
) | ||
|
||
"#]]) | ||
.run(); | ||
} | ||
|
||
|
@@ -107,12 +106,11 @@ fn ambiguous_registry() { | |
cargo_process("yank [email protected]") | ||
.replace_crates_io(crates_io.index_url()) | ||
.with_status(101) | ||
.with_stderr( | ||
"\ | ||
error: crates-io is replaced with remote registry alternative; | ||
.with_stderr_data(str![[r#" | ||
[ERROR] crates-io is replaced with remote registry alternative; | ||
include `--registry alternative` or `--registry crates-io` | ||
", | ||
) | ||
|
||
"#]]) | ||
.run(); | ||
} | ||
|
||
|
@@ -132,12 +130,11 @@ fn yank_with_default_crates_io() { | |
|
||
cargo_process("yank [email protected]") | ||
.replace_crates_io(crates_io.index_url()) | ||
.with_stderr( | ||
"\ | ||
.with_stderr_data(str![[r#" | ||
[UPDATING] crates.io index | ||
[YANK] [email protected] | ||
", | ||
) | ||
|
||
"#]]) | ||
.run(); | ||
} | ||
|
||
|
@@ -157,12 +154,11 @@ fn yank_with_default_alternative() { | |
|
||
cargo_process("yank [email protected]") | ||
.replace_crates_io(crates_io.index_url()) | ||
.with_stderr( | ||
"\ | ||
.with_stderr_data(str![[r#" | ||
[UPDATING] `alternative` index | ||
[YANK] [email protected] | ||
", | ||
) | ||
|
||
"#]]) | ||
.run(); | ||
} | ||
|
||
|
@@ -209,27 +205,26 @@ fn publish_with_replacement() { | |
// for the verification step. | ||
p.cargo("publish --registry crates-io") | ||
.replace_crates_io(crates_io.index_url()) | ||
.with_stderr( | ||
"\ | ||
.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 ([..]) | ||
[PACKAGED] [..] | ||
[VERIFYING] foo v0.0.1 ([..]) | ||
[PACKAGING] foo v0.0.1 ([ROOT]/foo) | ||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) | ||
[VERIFYING] foo v0.0.1 ([ROOT]/foo) | ||
[UPDATING] `alternative` index | ||
[DOWNLOADING] crates ... | ||
[DOWNLOADED] bar v1.0.0 (registry `alternative`) | ||
[COMPILING] bar v1.0.0 | ||
[COMPILING] foo v0.0.1 ([..]foo-0.0.1) | ||
[FINISHED] `dev` profile [..] | ||
[UPLOADING] foo v0.0.1 ([..]) | ||
[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 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(); | ||
} | ||
|
||
|
@@ -246,10 +241,10 @@ fn undefined_default() { | |
cargo_process("yank [email protected]") | ||
.replace_crates_io(crates_io.index_url()) | ||
.with_status(101) | ||
.with_stderr( | ||
"[ERROR] registry index was not found in any configuration: `undefined` | ||
", | ||
) | ||
.with_stderr_data(str![[r#" | ||
[ERROR] registry index was not found in any configuration: `undefined` | ||
|
||
"#]]) | ||
.run(); | ||
} | ||
|
||
|
@@ -286,16 +281,15 @@ fn source_replacement_with_registry_url() { | |
|
||
p.cargo("check") | ||
.replace_crates_io(crates_io.index_url()) | ||
.with_stderr( | ||
"\ | ||
.with_stderr_data(str![[r#" | ||
[UPDATING] `using-registry-url` index | ||
[LOCKING] 2 packages to latest compatible versions | ||
[DOWNLOADING] crates ... | ||
[DOWNLOADED] bar v0.0.1 (registry `using-registry-url`) | ||
[CHECKING] bar v0.0.1 | ||
[CHECKING] foo v0.0.1 ([CWD]) | ||
[FINISHED] `dev` profile [..] | ||
", | ||
) | ||
[CHECKING] foo v0.0.1 ([ROOT]/foo) | ||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s | ||
|
||
"#]]) | ||
.run(); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with_stdout_does_not_contain
is being used in this function.