Skip to content

Commit

Permalink
test(msrv): Show current parse behavior with X
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Apr 17, 2024
1 parent 852a316 commit af9288f
Showing 1 changed file with 102 additions and 0 deletions.
102 changes: 102 additions & 0 deletions tests/testsuite/rust_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,108 @@ fn rust_version_bad_pre_release() {
.run();
}

#[cargo_test]
#[should_panic]
fn rust_version_x_wildcard() {
project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
edition = "2015"
authors = []
rust-version = "x"
[[bin]]
name = "foo"
"#,
)
.file("src/main.rs", "fn main() {}")
.build()
.cargo("check")
.with_status(101)
.with_stderr(
"\
[ERROR] unexpected version requirement, expected a version like \"1.32\"
--> Cargo.toml:7:28
|
7 | rust-version = \"^1.43\"
| ^^^^^^^
|
",
)
.run();
}

#[cargo_test]
#[should_panic]
fn rust_version_minor_x_wildcard() {
project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
edition = "2015"
authors = []
rust-version = "1.x"
[[bin]]
name = "foo"
"#,
)
.file("src/main.rs", "fn main() {}")
.build()
.cargo("check")
.with_status(101)
.with_stderr(
"\
[ERROR] unexpected version requirement, expected a version like \"1.32\"
--> Cargo.toml:7:28
|
7 | rust-version = \"1.x\"
| ^^^^^
|
",
)
.run();
}

#[cargo_test]
#[should_panic]
fn rust_version_patch_x_wildcard() {
project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
edition = "2015"
authors = []
rust-version = "1.30.x"
[[bin]]
name = "foo"
"#,
)
.file("src/main.rs", "fn main() {}")
.build()
.cargo("check")
.with_status(101)
.with_stderr(
"\
[ERROR] unexpected version requirement, expected a version like \"1.32\"
--> Cargo.toml:7:28
|
7 | rust-version = \"1.30.x\"
| ^^^^^^^^
|
",
)
.run();
}

#[cargo_test]
fn rust_version_bad_nonsense() {
project()
Expand Down

0 comments on commit af9288f

Please sign in to comment.