File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff 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" ) ]
186222fn clean_output_with_edition ( ) {
187223 let script = r#"#!/usr/bin/env cargo
You can’t perform that action at this time.
0 commit comments