Skip to content

Commit e290ed7

Browse files
committed
test(update): Add a --aggressive --precise error test
1 parent 8d1d20d commit e290ed7

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/testsuite/update.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,42 @@ fn update_aggressive() {
464464
.run();
465465
}
466466

467+
#[cargo_test]
468+
fn update_aggressive_conflicts_with_precise() {
469+
Package::new("log", "0.1.0").publish();
470+
Package::new("serde", "0.2.1").dep("log", "0.1").publish();
471+
472+
let p = project()
473+
.file(
474+
"Cargo.toml",
475+
r#"
476+
[package]
477+
name = "bar"
478+
version = "0.0.1"
479+
authors = []
480+
481+
[dependencies]
482+
serde = "0.2"
483+
"#,
484+
)
485+
.file("src/lib.rs", "")
486+
.build();
487+
488+
p.cargo("check").run();
489+
490+
Package::new("log", "0.1.1").publish();
491+
Package::new("serde", "0.2.2").dep("log", "0.1").publish();
492+
493+
p.cargo("update -p serde:0.2.1 --precise 0.2.2 --aggressive")
494+
.with_status(101)
495+
.with_stderr(
496+
"\
497+
error: cannot specify both aggressive and precise simultaneously
498+
",
499+
)
500+
.run();
501+
}
502+
467503
// cargo update should respect its arguments even without a lockfile.
468504
// See issue "Running cargo update without a Cargo.lock ignores arguments"
469505
// at <https://github.com/rust-lang/cargo/issues/6872>.

0 commit comments

Comments
 (0)