Skip to content

Commit

Permalink
test(profile): Verify spec version parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Sep 1, 2023
1 parent a4ad934 commit 9b5e8e4
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions tests/testsuite/profile_overrides.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,72 @@ found package specs: bar, [email protected]",
.run();
}

#[cargo_test]
fn profile_override_spec_with_version() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
[dependencies]
bar = { path = "bar" }
[profile.dev.package."bar:0.5.0"]
codegen-units = 2
"#,
)
.file("src/lib.rs", "")
.file("bar/Cargo.toml", &basic_lib_manifest("bar"))
.file("bar/src/lib.rs", "")
.build();

p.cargo("check -v")
.with_stderr_contains("[RUNNING] `rustc [..]bar/src/lib.rs [..] -C codegen-units=2 [..]")
.run();
}

#[cargo_test]
fn profile_override_spec_with_partial_version() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
[dependencies]
bar = { path = "bar" }
[profile.dev.package."bar:0.5"]
codegen-units = 2
"#,
)
.file("src/lib.rs", "")
.file("bar/Cargo.toml", &basic_lib_manifest("bar"))
.file("bar/src/lib.rs", "")
.build();

p.cargo("check -v")
.with_status(101)
.with_stderr_contains(
"\
error: failed to parse manifest at `[CWD]/Cargo.toml`
Caused by:
TOML parse error at line 9, column 34
|
9 | [profile.dev.package.\"bar:0.5\"]
| ^^^^^^^^^
cannot parse '0.5' as a SemVer version
",
)
.run();
}

#[cargo_test]
fn profile_override_spec() {
let p = project()
Expand Down

0 comments on commit 9b5e8e4

Please sign in to comment.