File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -195,10 +195,39 @@ fn finds_author_user() {
195
195
cargo_process ( "new foo" ) . env ( "USER" , "foo" ) . run ( ) ;
196
196
197
197
let toml = paths:: root ( ) . join ( "foo/Cargo.toml" ) ;
198
+ println ! ( "{:?}" , toml) ;
198
199
let contents = fs:: read_to_string ( & toml) . unwrap ( ) ;
199
200
assert ! ( contents. contains( r#"authors = ["foo"]"# ) ) ;
200
201
}
201
202
203
+ #[ cargo_test]
204
+ fn author_without_user_or_email ( ) {
205
+ create_empty_gitconfig ( ) ;
206
+ cargo_process ( "new foo" )
207
+ . env_remove ( "USER" )
208
+ . env_remove ( "USERNAME" )
209
+ . env_remove ( "NAME" )
210
+ . env_remove ( "EMAIL" )
211
+ . run ( ) ;
212
+
213
+ let toml = paths:: root ( ) . join ( "foo/Cargo.toml" ) ;
214
+ let contents = fs:: read_to_string ( & toml) . unwrap ( ) ;
215
+ assert ! ( contents. contains( r#"authors = []"# ) ) ;
216
+ }
217
+
218
+ #[ cargo_test]
219
+ fn finds_author_email_only ( ) {
220
+ create_empty_gitconfig ( ) ;
221
+ cargo_process ( "new foo" )
222
+ . env ( "EMAIL" , "baz" )
223
+ . run ( ) ;
224
+
225
+ let toml = paths:: root ( ) . join ( "foo/Cargo.toml" ) ;
226
+ println ! ( "{:?}" , toml) ;
227
+ let contents = fs:: read_to_string ( & toml) . unwrap ( ) ;
228
+ assert ! ( contents. contains( r#"authors = ["<baz>"]"# ) ) ;
229
+ }
230
+
202
231
#[ cargo_test]
203
232
fn finds_author_user_escaped ( ) {
204
233
create_empty_gitconfig ( ) ;
You can’t perform that action at this time.
0 commit comments