@@ -116,15 +116,25 @@ fn existing() {
116
116
fn invalid_characters ( ) {
117
117
cargo_process ( "new foo.rs" )
118
118
. with_status ( 101 )
119
- . with_stderr ( "[ERROR] invalid character `.` in crate name: `foo.rs`, [..]" )
119
+ . with_stderr (
120
+ "\
121
+ [ERROR] invalid character `.` in crate name: `foo.rs`, [..]
122
+ If you need a crate name to not match the directory name, consider using --name flag.
123
+ " ,
124
+ )
120
125
. run ( ) ;
121
126
}
122
127
123
128
#[ cargo_test]
124
129
fn reserved_name ( ) {
125
130
cargo_process ( "new test" )
126
131
. with_status ( 101 )
127
- . with_stderr ( "[ERROR] the name `test` cannot be used as a crate name, it conflicts [..]" )
132
+ . with_stderr (
133
+ "\
134
+ [ERROR] the name `test` cannot be used as a crate name, it conflicts [..]
135
+ If you need a crate name to not match the directory name, consider using --name flag.
136
+ " ,
137
+ )
128
138
. run ( ) ;
129
139
}
130
140
@@ -133,7 +143,10 @@ fn reserved_binary_name() {
133
143
cargo_process ( "new --bin incremental" )
134
144
. with_status ( 101 )
135
145
. with_stderr (
136
- "[ERROR] the name `incremental` cannot be used as a crate name, it conflicts [..]" ,
146
+ "\
147
+ [ERROR] the name `incremental` cannot be used as a crate name, it conflicts [..]
148
+ If you need a crate name to not match the directory name, consider using --name flag.
149
+ " ,
137
150
)
138
151
. run ( ) ;
139
152
@@ -153,7 +166,12 @@ it conflicts with cargo's build directory names
153
166
fn keyword_name ( ) {
154
167
cargo_process ( "new pub" )
155
168
. with_status ( 101 )
156
- . with_stderr ( "[ERROR] the name `pub` cannot be used as a crate name, it is a Rust keyword" )
169
+ . with_stderr (
170
+ "\
171
+ [ERROR] the name `pub` cannot be used as a crate name, it is a Rust keyword
172
+ If you need a crate name to not match the directory name, consider using --name flag.
173
+ " ,
174
+ )
157
175
. run ( ) ;
158
176
}
159
177
@@ -522,7 +540,12 @@ fn restricted_windows_name() {
522
540
cargo_process ( "new nul" )
523
541
. env ( "USER" , "foo" )
524
542
. with_status ( 101 )
525
- . with_stderr ( "[ERROR] cannot use name `nul`, it is a reserved Windows filename" )
543
+ . with_stderr (
544
+ "\
545
+ [ERROR] cannot use name `nul`, it is a reserved Windows filename
546
+ If you need a crate name to not match the directory name, consider using --name flag.
547
+ " ,
548
+ )
526
549
. run ( ) ;
527
550
} else {
528
551
cargo_process ( "new nul" )
@@ -559,17 +582,23 @@ fn non_ascii_name_invalid() {
559
582
. env ( "USER" , "foo" )
560
583
. with_status ( 101 )
561
584
. with_stderr (
562
- "[ERROR] invalid character `Ⓐ` in crate name: `ⒶⒷⒸ`, \
563
- the first character must be a Unicode XID start character (most letters or `_`)",
585
+ "\
586
+ [ERROR] invalid character `Ⓐ` in crate name: `ⒶⒷⒸ`, \
587
+ the first character must be a Unicode XID start character (most letters or `_`)
588
+ If you need a crate name to not match the directory name, consider using --name flag.
589
+ " ,
564
590
)
565
591
. run ( ) ;
566
592
567
593
cargo_process ( "new a¼" )
568
594
. env ( "USER" , "foo" )
569
595
. with_status ( 101 )
570
596
. with_stderr (
571
- "[ERROR] invalid character `¼` in crate name: `a¼`, \
572
- characters must be Unicode XID characters (numbers, `-`, `_`, or most letters)",
597
+ "\
598
+ [ERROR] invalid character `¼` in crate name: `a¼`, \
599
+ characters must be Unicode XID characters (numbers, `-`, `_`, or most letters)
600
+ If you need a crate name to not match the directory name, consider using --name flag.
601
+ " ,
573
602
)
574
603
. run ( ) ;
575
604
}
0 commit comments