Skip to content
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 rename_deps, replace, required_features and run to snapbox #14127

Merged
merged 4 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 24 additions & 27 deletions tests/testsuite/rename_deps.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
//! Tests for renaming dependencies.

#![allow(deprecated)]

use cargo_test_support::git;
use cargo_test_support::paths;
use cargo_test_support::registry::{self, Package};
use cargo_test_support::{basic_manifest, project};
use cargo_test_support::{basic_manifest, project, str};

#[cargo_test]
fn rename_dependency() {
Expand Down Expand Up @@ -191,15 +189,14 @@ fn rename_twice() {

p.cargo("build -v")
.with_status(101)
.with_stderr(
"\
[UPDATING] `[..]` index
.with_stderr_data(str![[r#"
[UPDATING] `dummy-registry` index
[LOCKING] 2 packages to latest compatible versions
[DOWNLOADING] crates ...
[DOWNLOADED] foo v0.1.0 (registry [..])
error: the crate `test v0.1.0 ([CWD])` depends on crate `foo v0.1.0` multiple times with different names
",
)
[DOWNLOADED] foo v0.1.0 (registry `dummy-registry`)
[ERROR] the crate `test v0.1.0 ([ROOT]/foo)` depends on crate `foo v0.1.0` multiple times with different names

"#]])
.run();
}

Expand Down Expand Up @@ -242,7 +239,14 @@ fn rename_affects_fingerprint() {

p.cargo("build -v")
.with_status(101)
.with_stderr_contains("[..]can't find crate for `foo`")
.with_stderr_data(str![[r#"
[FRESH] foo v0.1.0
[DIRTY] test v0.1.0 ([ROOT]/foo): name of dependency changed (foo => bar)
[COMPILING] test v0.1.0 ([ROOT]/foo)
[RUNNING] `rustc [..]`
error[E0463]: can't find crate for `foo`
...
"#]])
.run();
}

Expand Down Expand Up @@ -274,18 +278,12 @@ fn can_run_doc_tests() {
)
.build();

foo.cargo("test -v")
.with_stderr_contains(
"\
foo.cargo("test -v").with_stderr_data(str![[r#"
...
[DOCTEST] foo
[RUNNING] `rustdoc [..]--test [..]src/lib.rs \
[..] \
--extern bar=[CWD]/target/debug/deps/libbar-[..].rlib \
--extern baz=[CWD]/target/debug/deps/libbar-[..].rlib \
[..]`
",
)
.run();
[RUNNING] `rustdoc [..]--test src/lib.rs [..] --extern bar=[ROOT]/foo/target/debug/deps/libbar-[HASH].rlib --extern baz=[ROOT]/foo/target/debug/deps/libbar-[HASH].rlib [..]`

"#]]).run();
}

#[cargo_test]
Expand Down Expand Up @@ -373,14 +371,13 @@ fn features_not_working() {

p.cargo("build -v")
.with_status(101)
.with_stderr(
"\
error: failed to parse manifest at `[..]`
.with_stderr_data(str![[r#"
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`

Caused by:
feature `default` includes `p1` which is neither a dependency nor another feature
",
)

"#]])
.run();
}

Expand Down
Loading