@@ -26,7 +26,6 @@ fn mercurial_available() -> bool {
26
26
#[ cargo_test]
27
27
fn simple_lib ( ) {
28
28
cargo_process ( "init --lib --vcs none --edition 2015" )
29
- . env ( "USER" , "foo" )
30
29
. with_stderr ( "[CREATED] library package" )
31
30
. run ( ) ;
32
31
@@ -42,7 +41,6 @@ fn simple_bin() {
42
41
let path = paths:: root ( ) . join ( "foo" ) ;
43
42
fs:: create_dir ( & path) . unwrap ( ) ;
44
43
cargo_process ( "init --bin --vcs none --edition 2015" )
45
- . env ( "USER" , "foo" )
46
44
. cwd ( & path)
47
45
. with_stderr ( "[CREATED] binary (application) package" )
48
46
. run ( ) ;
@@ -66,9 +64,7 @@ fn simple_git_ignore_exists() {
66
64
)
67
65
. unwrap ( ) ;
68
66
69
- cargo_process ( "init --lib foo --edition 2015" )
70
- . env ( "USER" , "foo" )
71
- . run ( ) ;
67
+ cargo_process ( "init --lib foo --edition 2015" ) . run ( ) ;
72
68
73
69
assert ! ( paths:: root( ) . is_dir( ) ) ;
74
70
assert ! ( paths:: root( ) . join( "foo/Cargo.toml" ) . is_file( ) ) ;
@@ -99,9 +95,7 @@ fn git_ignore_exists_no_conflicting_entries() {
99
95
fs:: create_dir_all ( paths:: root ( ) . join ( "foo" ) ) . unwrap ( ) ;
100
96
fs:: write ( paths:: root ( ) . join ( "foo/.gitignore" ) , "**/some.file" ) . unwrap ( ) ;
101
97
102
- cargo_process ( "init --lib foo --edition 2015" )
103
- . env ( "USER" , "foo" )
104
- . run ( ) ;
98
+ cargo_process ( "init --lib foo --edition 2015" ) . run ( ) ;
105
99
106
100
let fp = paths:: root ( ) . join ( "foo/.gitignore" ) ;
107
101
let contents = fs:: read_to_string ( & fp) . unwrap ( ) ;
@@ -118,7 +112,6 @@ fn git_ignore_exists_no_conflicting_entries() {
118
112
#[ cargo_test]
119
113
fn both_lib_and_bin ( ) {
120
114
cargo_process ( "init --lib --bin" )
121
- . env ( "USER" , "foo" )
122
115
. with_status ( 101 )
123
116
. with_stderr ( "[ERROR] can't specify both lib and binary outputs" )
124
117
. run ( ) ;
@@ -139,15 +132,9 @@ fn bin_already_exists(explicit: bool, rellocation: &str) {
139
132
fs:: write ( & sourcefile_path, content) . unwrap ( ) ;
140
133
141
134
if explicit {
142
- cargo_process ( "init --bin --vcs none" )
143
- . env ( "USER" , "foo" )
144
- . cwd ( & path)
145
- . run ( ) ;
135
+ cargo_process ( "init --bin --vcs none" ) . cwd ( & path) . run ( ) ;
146
136
} else {
147
- cargo_process ( "init --vcs none" )
148
- . env ( "USER" , "foo" )
149
- . cwd ( & path)
150
- . run ( ) ;
137
+ cargo_process ( "init --vcs none" ) . cwd ( & path) . run ( ) ;
151
138
}
152
139
153
140
assert ! ( paths:: root( ) . join( "foo/Cargo.toml" ) . is_file( ) ) ;
@@ -200,7 +187,6 @@ fn confused_by_multiple_lib_files() {
200
187
fs:: write ( path2, r#" fn qqq () { println!("Hello, world 3!"); }"# ) . unwrap ( ) ;
201
188
202
189
cargo_process ( "init --vcs none" )
203
- . env ( "USER" , "foo" )
204
190
. cwd ( & path)
205
191
. with_status ( 101 )
206
192
. with_stderr (
@@ -224,7 +210,6 @@ fn multibin_project_name_clash() {
224
210
fs:: write ( path2, r#"fn main () { println!("Hello, world 3!"); }"# ) . unwrap ( ) ;
225
211
226
212
cargo_process ( "init --lib --vcs none" )
227
- . env ( "USER" , "foo" )
228
213
. cwd ( & path)
229
214
. with_status ( 101 )
230
215
. with_stderr (
@@ -249,10 +234,7 @@ fn lib_already_exists(rellocation: &str) {
249
234
let content = "pub fn qqq() {}" ;
250
235
fs:: write ( & sourcefile_path, content) . unwrap ( ) ;
251
236
252
- cargo_process ( "init --vcs none" )
253
- . env ( "USER" , "foo" )
254
- . cwd ( & path)
255
- . run ( ) ;
237
+ cargo_process ( "init --vcs none" ) . cwd ( & path) . run ( ) ;
256
238
257
239
assert ! ( paths:: root( ) . join( "foo/Cargo.toml" ) . is_file( ) ) ;
258
240
assert ! ( !paths:: root( ) . join( "foo/src/main.rs" ) . is_file( ) ) ;
@@ -274,9 +256,7 @@ fn lib_already_exists_nosrc() {
274
256
275
257
#[ cargo_test]
276
258
fn simple_git ( ) {
277
- cargo_process ( "init --lib --vcs git" )
278
- . env ( "USER" , "foo" )
279
- . run ( ) ;
259
+ cargo_process ( "init --lib --vcs git" ) . run ( ) ;
280
260
281
261
assert ! ( paths:: root( ) . join( "Cargo.toml" ) . is_file( ) ) ;
282
262
assert ! ( paths:: root( ) . join( "src/lib.rs" ) . is_file( ) ) ;
@@ -286,7 +266,7 @@ fn simple_git() {
286
266
287
267
#[ cargo_test]
288
268
fn auto_git ( ) {
289
- cargo_process ( "init --lib" ) . env ( "USER" , "foo" ) . run ( ) ;
269
+ cargo_process ( "init --lib" ) . run ( ) ;
290
270
291
271
assert ! ( paths:: root( ) . join( "Cargo.toml" ) . is_file( ) ) ;
292
272
assert ! ( paths:: root( ) . join( "src/lib.rs" ) . is_file( ) ) ;
@@ -300,7 +280,6 @@ fn invalid_dir_name() {
300
280
fs:: create_dir_all ( & foo) . unwrap ( ) ;
301
281
cargo_process ( "init" )
302
282
. cwd ( foo. clone ( ) )
303
- . env ( "USER" , "foo" )
304
283
. with_status ( 101 )
305
284
. with_stderr (
306
285
"\
@@ -328,7 +307,6 @@ fn reserved_name() {
328
307
fs:: create_dir_all ( & test) . unwrap ( ) ;
329
308
cargo_process ( "init" )
330
309
. cwd ( test. clone ( ) )
331
- . env ( "USER" , "foo" )
332
310
. with_status ( 101 )
333
311
. with_stderr (
334
312
"\
@@ -354,7 +332,7 @@ or change the name in Cargo.toml with:
354
332
fn git_autodetect ( ) {
355
333
fs:: create_dir ( & paths:: root ( ) . join ( ".git" ) ) . unwrap ( ) ;
356
334
357
- cargo_process ( "init --lib" ) . env ( "USER" , "foo" ) . run ( ) ;
335
+ cargo_process ( "init --lib" ) . run ( ) ;
358
336
359
337
assert ! ( paths:: root( ) . join( "Cargo.toml" ) . is_file( ) ) ;
360
338
assert ! ( paths:: root( ) . join( "src/lib.rs" ) . is_file( ) ) ;
@@ -366,7 +344,7 @@ fn git_autodetect() {
366
344
fn mercurial_autodetect ( ) {
367
345
fs:: create_dir ( & paths:: root ( ) . join ( ".hg" ) ) . unwrap ( ) ;
368
346
369
- cargo_process ( "init --lib" ) . env ( "USER" , "foo" ) . run ( ) ;
347
+ cargo_process ( "init --lib" ) . run ( ) ;
370
348
371
349
assert ! ( paths:: root( ) . join( "Cargo.toml" ) . is_file( ) ) ;
372
350
assert ! ( paths:: root( ) . join( "src/lib.rs" ) . is_file( ) ) ;
@@ -380,7 +358,7 @@ fn gitignore_appended_not_replaced() {
380
358
381
359
fs:: write ( & paths:: root ( ) . join ( ".gitignore" ) , "qqqqqq\n " ) . unwrap ( ) ;
382
360
383
- cargo_process ( "init --lib" ) . env ( "USER" , "foo" ) . run ( ) ;
361
+ cargo_process ( "init --lib" ) . run ( ) ;
384
362
385
363
assert ! ( paths:: root( ) . join( "Cargo.toml" ) . is_file( ) ) ;
386
364
assert ! ( paths:: root( ) . join( "src/lib.rs" ) . is_file( ) ) ;
@@ -397,7 +375,7 @@ fn gitignore_added_newline_in_existing() {
397
375
398
376
fs:: write ( & paths:: root ( ) . join ( ".gitignore" ) , "first" ) . unwrap ( ) ;
399
377
400
- cargo_process ( "init --lib" ) . env ( "USER" , "foo" ) . run ( ) ;
378
+ cargo_process ( "init --lib" ) . run ( ) ;
401
379
402
380
assert ! ( paths:: root( ) . join( ".gitignore" ) . is_file( ) ) ;
403
381
@@ -409,7 +387,7 @@ fn gitignore_added_newline_in_existing() {
409
387
fn gitignore_no_newline_in_new ( ) {
410
388
fs:: create_dir ( & paths:: root ( ) . join ( ".git" ) ) . unwrap ( ) ;
411
389
412
- cargo_process ( "init --lib" ) . env ( "USER" , "foo" ) . run ( ) ;
390
+ cargo_process ( "init --lib" ) . run ( ) ;
413
391
414
392
assert ! ( paths:: root( ) . join( ".gitignore" ) . is_file( ) ) ;
415
393
@@ -423,7 +401,7 @@ fn mercurial_added_newline_in_existing() {
423
401
424
402
fs:: write ( & paths:: root ( ) . join ( ".hgignore" ) , "first" ) . unwrap ( ) ;
425
403
426
- cargo_process ( "init --lib" ) . env ( "USER" , "foo" ) . run ( ) ;
404
+ cargo_process ( "init --lib" ) . run ( ) ;
427
405
428
406
assert ! ( paths:: root( ) . join( ".hgignore" ) . is_file( ) ) ;
429
407
@@ -435,7 +413,7 @@ fn mercurial_added_newline_in_existing() {
435
413
fn mercurial_no_newline_in_new ( ) {
436
414
fs:: create_dir ( & paths:: root ( ) . join ( ".hg" ) ) . unwrap ( ) ;
437
415
438
- cargo_process ( "init --lib" ) . env ( "USER" , "foo" ) . run ( ) ;
416
+ cargo_process ( "init --lib" ) . run ( ) ;
439
417
440
418
assert ! ( paths:: root( ) . join( ".hgignore" ) . is_file( ) ) ;
441
419
@@ -445,9 +423,7 @@ fn mercurial_no_newline_in_new() {
445
423
446
424
#[ cargo_test]
447
425
fn terminating_newline_in_new_git_ignore ( ) {
448
- cargo_process ( "init --vcs git --lib" )
449
- . env ( "USER" , "foo" )
450
- . run ( ) ;
426
+ cargo_process ( "init --vcs git --lib" ) . run ( ) ;
451
427
452
428
let content = fs:: read_to_string ( & paths:: root ( ) . join ( ".gitignore" ) ) . unwrap ( ) ;
453
429
@@ -461,9 +437,7 @@ fn terminating_newline_in_new_mercurial_ignore() {
461
437
if !mercurial_available ( ) {
462
438
return ;
463
439
}
464
- cargo_process ( "init --vcs hg --lib" )
465
- . env ( "USER" , "foo" )
466
- . run ( ) ;
440
+ cargo_process ( "init --vcs hg --lib" ) . run ( ) ;
467
441
468
442
let content = fs:: read_to_string ( & paths:: root ( ) . join ( ".hgignore" ) ) . unwrap ( ) ;
469
443
@@ -477,7 +451,7 @@ fn terminating_newline_in_existing_git_ignore() {
477
451
fs:: create_dir ( & paths:: root ( ) . join ( ".git" ) ) . unwrap ( ) ;
478
452
fs:: write ( & paths:: root ( ) . join ( ".gitignore" ) , b"first" ) . unwrap ( ) ;
479
453
480
- cargo_process ( "init --lib" ) . env ( "USER" , "foo" ) . run ( ) ;
454
+ cargo_process ( "init --lib" ) . run ( ) ;
481
455
482
456
let content = fs:: read_to_string ( & paths:: root ( ) . join ( ".gitignore" ) ) . unwrap ( ) ;
483
457
@@ -491,7 +465,7 @@ fn terminating_newline_in_existing_mercurial_ignore() {
491
465
fs:: create_dir ( & paths:: root ( ) . join ( ".hg" ) ) . unwrap ( ) ;
492
466
fs:: write ( & paths:: root ( ) . join ( ".hgignore" ) , b"first" ) . unwrap ( ) ;
493
467
494
- cargo_process ( "init --lib" ) . env ( "USER" , "foo" ) . run ( ) ;
468
+ cargo_process ( "init --lib" ) . run ( ) ;
495
469
496
470
let content = fs:: read_to_string ( & paths:: root ( ) . join ( ".hgignore" ) ) . unwrap ( ) ;
497
471
@@ -504,9 +478,7 @@ fn terminating_newline_in_existing_mercurial_ignore() {
504
478
fn cargo_lock_gitignored_if_lib1 ( ) {
505
479
fs:: create_dir ( & paths:: root ( ) . join ( ".git" ) ) . unwrap ( ) ;
506
480
507
- cargo_process ( "init --lib --vcs git" )
508
- . env ( "USER" , "foo" )
509
- . run ( ) ;
481
+ cargo_process ( "init --lib --vcs git" ) . run ( ) ;
510
482
511
483
assert ! ( paths:: root( ) . join( ".gitignore" ) . is_file( ) ) ;
512
484
@@ -520,7 +492,7 @@ fn cargo_lock_gitignored_if_lib2() {
520
492
521
493
fs:: write ( & paths:: root ( ) . join ( "lib.rs" ) , "" ) . unwrap ( ) ;
522
494
523
- cargo_process ( "init --vcs git" ) . env ( "USER" , "foo" ) . run ( ) ;
495
+ cargo_process ( "init --vcs git" ) . run ( ) ;
524
496
525
497
assert ! ( paths:: root( ) . join( ".gitignore" ) . is_file( ) ) ;
526
498
@@ -532,9 +504,7 @@ fn cargo_lock_gitignored_if_lib2() {
532
504
fn cargo_lock_not_gitignored_if_bin1 ( ) {
533
505
fs:: create_dir ( & paths:: root ( ) . join ( ".git" ) ) . unwrap ( ) ;
534
506
535
- cargo_process ( "init --vcs git --bin" )
536
- . env ( "USER" , "foo" )
537
- . run ( ) ;
507
+ cargo_process ( "init --vcs git --bin" ) . run ( ) ;
538
508
539
509
assert ! ( paths:: root( ) . join( ".gitignore" ) . is_file( ) ) ;
540
510
@@ -548,7 +518,7 @@ fn cargo_lock_not_gitignored_if_bin2() {
548
518
549
519
fs:: write ( & paths:: root ( ) . join ( "main.rs" ) , "" ) . unwrap ( ) ;
550
520
551
- cargo_process ( "init --vcs git" ) . env ( "USER" , "foo" ) . run ( ) ;
521
+ cargo_process ( "init --vcs git" ) . run ( ) ;
552
522
553
523
assert ! ( paths:: root( ) . join( ".gitignore" ) . is_file( ) ) ;
554
524
@@ -558,9 +528,7 @@ fn cargo_lock_not_gitignored_if_bin2() {
558
528
559
529
#[ cargo_test]
560
530
fn with_argument ( ) {
561
- cargo_process ( "init foo --vcs none" )
562
- . env ( "USER" , "foo" )
563
- . run ( ) ;
531
+ cargo_process ( "init foo --vcs none" ) . run ( ) ;
564
532
assert ! ( paths:: root( ) . join( "foo/Cargo.toml" ) . is_file( ) ) ;
565
533
}
566
534
@@ -595,7 +563,6 @@ fn formats_source() {
595
563
fs:: write ( & paths:: root ( ) . join ( "rustfmt.toml" ) , "tab_spaces = 2" ) . unwrap ( ) ;
596
564
597
565
cargo_process ( "init --lib" )
598
- . env ( "USER" , "foo" )
599
566
. with_stderr ( "[CREATED] library package" )
600
567
. run ( ) ;
601
568
@@ -615,7 +582,6 @@ mod tests {
615
582
#[ cargo_test]
616
583
fn ignores_failure_to_format_source ( ) {
617
584
cargo_process ( "init --lib" )
618
- . env ( "USER" , "foo" )
619
585
. env ( "PATH" , "" ) // pretend that `rustfmt` is missing
620
586
. with_stderr ( "[CREATED] library package" )
621
587
. run ( ) ;
0 commit comments