Skip to content

Commit af9288f

Browse files
committed
test(msrv): Show current parse behavior with X
1 parent 852a316 commit af9288f

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed

tests/testsuite/rust_version.rs

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,108 @@ fn rust_version_bad_pre_release() {
124124
.run();
125125
}
126126

127+
#[cargo_test]
128+
#[should_panic]
129+
fn rust_version_x_wildcard() {
130+
project()
131+
.file(
132+
"Cargo.toml",
133+
r#"
134+
[package]
135+
name = "foo"
136+
version = "0.0.1"
137+
edition = "2015"
138+
authors = []
139+
rust-version = "x"
140+
[[bin]]
141+
name = "foo"
142+
"#,
143+
)
144+
.file("src/main.rs", "fn main() {}")
145+
.build()
146+
.cargo("check")
147+
.with_status(101)
148+
.with_stderr(
149+
"\
150+
[ERROR] unexpected version requirement, expected a version like \"1.32\"
151+
--> Cargo.toml:7:28
152+
|
153+
7 | rust-version = \"^1.43\"
154+
| ^^^^^^^
155+
|
156+
",
157+
)
158+
.run();
159+
}
160+
161+
#[cargo_test]
162+
#[should_panic]
163+
fn rust_version_minor_x_wildcard() {
164+
project()
165+
.file(
166+
"Cargo.toml",
167+
r#"
168+
[package]
169+
name = "foo"
170+
version = "0.0.1"
171+
edition = "2015"
172+
authors = []
173+
rust-version = "1.x"
174+
[[bin]]
175+
name = "foo"
176+
"#,
177+
)
178+
.file("src/main.rs", "fn main() {}")
179+
.build()
180+
.cargo("check")
181+
.with_status(101)
182+
.with_stderr(
183+
"\
184+
[ERROR] unexpected version requirement, expected a version like \"1.32\"
185+
--> Cargo.toml:7:28
186+
|
187+
7 | rust-version = \"1.x\"
188+
| ^^^^^
189+
|
190+
",
191+
)
192+
.run();
193+
}
194+
195+
#[cargo_test]
196+
#[should_panic]
197+
fn rust_version_patch_x_wildcard() {
198+
project()
199+
.file(
200+
"Cargo.toml",
201+
r#"
202+
[package]
203+
name = "foo"
204+
version = "0.0.1"
205+
edition = "2015"
206+
authors = []
207+
rust-version = "1.30.x"
208+
[[bin]]
209+
name = "foo"
210+
"#,
211+
)
212+
.file("src/main.rs", "fn main() {}")
213+
.build()
214+
.cargo("check")
215+
.with_status(101)
216+
.with_stderr(
217+
"\
218+
[ERROR] unexpected version requirement, expected a version like \"1.32\"
219+
--> Cargo.toml:7:28
220+
|
221+
7 | rust-version = \"1.30.x\"
222+
| ^^^^^^^^
223+
|
224+
",
225+
)
226+
.run();
227+
}
228+
127229
#[cargo_test]
128230
fn rust_version_bad_nonsense() {
129231
project()

0 commit comments

Comments
 (0)