Add test for aggressive update

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
This commit is contained in:
hi-rustin 2022-08-16 20:57:42 +08:00
parent f95deaafeb
commit a58489dfbb

View File

@ -428,6 +428,41 @@ fn update_precise_without_package() {
.run();
}
#[cargo_test]
fn update_aggressive_without_package() {
Package::new("serde", "0.2.0").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("serde", "0.2.1").publish();
p.cargo("update --aggressive")
.with_stderr(
"\
[WARNING] aggressive is only supported with \"--package <SPEC>\", this will become a hard error in a future release.
[UPDATING] `[..]` index
[UPDATING] serde v0.2.0 -> v0.2.1
",
)
.run();
}
// cargo update should respect its arguments even without a lockfile.
// See issue "Running cargo update without a Cargo.lock ignores arguments"
// at <https://github.com/rust-lang/cargo/issues/6872>.