File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -543,6 +543,46 @@ args: []
543
543
. run ( ) ;
544
544
}
545
545
546
+ #[ cargo_test]
547
+ fn test_name_has_leading_number ( ) {
548
+ let script = ECHO_SCRIPT ;
549
+ let p = cargo_test_support:: project ( )
550
+ . file ( "42answer.rs" , script)
551
+ . build ( ) ;
552
+
553
+ p. cargo ( "-Zscript -v 42answer.rs" )
554
+ . masquerade_as_nightly_cargo ( & [ "script" ] )
555
+ . with_status ( 101 )
556
+ . with_stderr (
557
+ r#"[WARNING] `package.edition` is unspecifiead, defaulting to `2021`
558
+ [ERROR] failed to parse manifest at `[ROOT]/foo/42answer.rs`
559
+
560
+ Caused by:
561
+ invalid character `-` in package name: `-42answer`, the first character must be a Unicode XID start character (most letters or `_`)
562
+ "# ,
563
+ )
564
+ . run ( ) ;
565
+ }
566
+
567
+ #[ cargo_test]
568
+ fn test_name_is_number ( ) {
569
+ let script = ECHO_SCRIPT ;
570
+ let p = cargo_test_support:: project ( ) . file ( "42.rs" , script) . build ( ) ;
571
+
572
+ p. cargo ( "-Zscript -v 42.rs" )
573
+ . masquerade_as_nightly_cargo ( & [ "script" ] )
574
+ . with_status ( 101 )
575
+ . with_stderr (
576
+ r#"[WARNING] `package.edition` is unspecifiead, defaulting to `2021`
577
+ [ERROR] failed to parse manifest at `[ROOT]/foo/42.rs`
578
+
579
+ Caused by:
580
+ invalid character `-` in package name: `-42`, the first character must be a Unicode XID start character (most letters or `_`)
581
+ "# ,
582
+ )
583
+ . run ( ) ;
584
+ }
585
+
546
586
#[ cargo_test]
547
587
fn script_like_dir ( ) {
548
588
let p = cargo_test_support:: project ( )
You can’t perform that action at this time.
0 commit comments