Skip to content

Commit 6644828

Browse files
committed
add test
1 parent 48a79c9 commit 6644828

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

src/cargo/core/registry.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ enum Kind {
116116
/// directive that we found in a lockfile, if present.
117117
pub struct LockedPatchDependency {
118118
/// The original `Dependency` directive, except "locked" so it's version
119-
/// requirement is `=foo` and its `SourceId` has a "precise" listed.
119+
/// requirement is Locked to `foo` and its `SourceId` has a "precise" listed.
120120
pub dependency: Dependency,
121121
/// The `PackageId` that was previously found in a lock file which
122122
/// `dependency` matches.

tests/testsuite/registry.rs

+51
Original file line numberDiff line numberDiff line change
@@ -3597,6 +3597,57 @@ fn differ_only_by_metadata() {
35973597
[CHECKING] baz v0.0.1+b
35983598
[CHECKING] foo v0.0.1 ([CWD])
35993599
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
3600+
",
3601+
)
3602+
.run();
3603+
3604+
Package::new("baz", "0.0.1+d").publish();
3605+
3606+
p.cargo("clean").run();
3607+
p.cargo("check")
3608+
.with_stderr_contains("[CHECKING] baz v0.0.1+b")
3609+
.run();
3610+
}
3611+
3612+
#[cargo_test]
3613+
fn differ_only_by_metadata_with_lockfile() {
3614+
let p = project()
3615+
.file(
3616+
"Cargo.toml",
3617+
r#"
3618+
[package]
3619+
name = "foo"
3620+
version = "0.0.1"
3621+
authors = []
3622+
3623+
[dependencies]
3624+
baz = "=0.0.1"
3625+
"#,
3626+
)
3627+
.file("src/main.rs", "fn main() {}")
3628+
.build();
3629+
3630+
Package::new("baz", "0.0.1+a").publish();
3631+
Package::new("baz", "0.0.1+b").publish();
3632+
Package::new("baz", "0.0.1+c").publish();
3633+
3634+
p.cargo("update --package baz --precise 0.0.1+b")
3635+
.with_stderr(
3636+
"\
3637+
[UPDATING] [..] index
3638+
[..] baz v0.0.1+c -> v0.0.1+b
3639+
",
3640+
)
3641+
.run();
3642+
3643+
p.cargo("check")
3644+
.with_stderr(
3645+
"\
3646+
[DOWNLOADING] crates ...
3647+
[DOWNLOADED] [..] v0.0.1+b (registry `dummy-registry`)
3648+
[CHECKING] baz v0.0.1+b
3649+
[CHECKING] foo v0.0.1 ([CWD])
3650+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
36003651
",
36013652
)
36023653
.run();

0 commit comments

Comments
 (0)