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

Add more tests for aggressive or precise update #11011

Merged
merged 2 commits into from
Aug 22, 2022
Merged
Changes from all 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
74 changes: 73 additions & 1 deletion tests/testsuite/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ fn change_package_version() {

#[cargo_test]
fn update_precise() {
Package::new("log", "0.1.0").publish();
Package::new("serde", "0.1.0").publish();
Package::new("serde", "0.2.1").publish();

Expand Down Expand Up @@ -392,6 +391,42 @@ fn update_precise() {
.run();
}

#[cargo_test]
fn update_precise_do_not_force_update_deps() {
Package::new("log", "0.1.0").publish();
Package::new("serde", "0.2.1").dep("log", "0.1").publish();

let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "bar"
version = "0.0.1"
authors = []

[dependencies]
serde = "0.2"
"#,
)
.file("src/lib.rs", "")
.build();

p.cargo("build").run();

Package::new("log", "0.1.1").publish();
Package::new("serde", "0.2.2").dep("log", "0.1").publish();

p.cargo("update -p serde:0.2.1 --precise 0.2.2")
.with_stderr(
"\
[UPDATING] `[..]` index
[UPDATING] serde v0.2.1 -> v0.2.2
",
)
.run();
}

#[cargo_test]
fn update_precise_without_package() {
Package::new("serde", "0.2.0").publish();
Expand Down Expand Up @@ -428,6 +463,43 @@ fn update_precise_without_package() {
.run();
}

#[cargo_test]
fn update_aggressive() {
Package::new("log", "0.1.0").publish();
Package::new("serde", "0.2.1").dep("log", "0.1").publish();

let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "bar"
version = "0.0.1"
authors = []

[dependencies]
serde = "0.2"
"#,
)
.file("src/lib.rs", "")
.build();

p.cargo("build").run();

Package::new("log", "0.1.1").publish();
Package::new("serde", "0.2.2").dep("log", "0.1").publish();

p.cargo("update -p serde:0.2.1 --aggressive")
.with_stderr(
"\
[UPDATING] `[..]` index
[UPDATING] log v0.1.0 -> v0.1.1
[UPDATING] serde v0.2.1 -> v0.2.2
",
)
.run();
}

#[cargo_test]
fn update_aggressive_without_package() {
Package::new("serde", "0.2.0").publish();
Expand Down