Skip to content

Commit 578ab7c

Browse files
committed
test(script): Show line numbers are off
1 parent 67dc504 commit 578ab7c

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/testsuite/script/cargo.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,42 @@ fn requires_z_flag() {
182182
.run();
183183
}
184184

185+
#[cargo_test(nightly, reason = "-Zscript is unstable")]
186+
fn manifest_parse_error() {
187+
// Exagerate the newlines to make it more obvious if the error's line number is off
188+
let script = r#"#!/usr/bin/env cargo
189+
190+
191+
192+
193+
194+
---
195+
[dependencies]
196+
bar = 3
197+
---
198+
199+
fn main() {
200+
println!("Hello world!");
201+
}"#;
202+
let p = cargo_test_support::project()
203+
.file("script.rs", script)
204+
.build();
205+
206+
p.cargo("-Zscript -v script.rs")
207+
.masquerade_as_nightly_cargo(&["script"])
208+
.with_status(101)
209+
.with_stdout_data(str![""])
210+
.with_stderr_data(str![[r#"
211+
[ERROR] invalid type: integer `3`, expected a version string like "0.9.8" or a detailed dependency like { version = "0.9.8" }
212+
--> script.rs:2:7
213+
|
214+
2 | bar = 3
215+
| ^
216+
217+
"#]])
218+
.run();
219+
}
220+
185221
#[cargo_test(nightly, reason = "-Zscript is unstable")]
186222
fn clean_output_with_edition() {
187223
let script = r#"#!/usr/bin/env cargo

0 commit comments

Comments
 (0)