@@ -84,63 +84,6 @@ use external_crate2::bar::A;",
84
84
) ;
85
85
}
86
86
87
- #[ test]
88
- fn insert_not_group_empty ( ) {
89
- cov_mark:: check!( insert_empty_file) ;
90
- check_with_config (
91
- "use external_crate2::bar::A" ,
92
- r"" ,
93
- r"use external_crate2::bar::A;
94
-
95
- " ,
96
- & InsertUseConfig {
97
- granularity : ImportGranularity :: Item ,
98
- enforce_granularity : true ,
99
- prefix_kind : PrefixKind :: Plain ,
100
- group : false ,
101
- skip_glob_imports : true ,
102
- } ,
103
- ) ;
104
- }
105
-
106
- #[ test]
107
- fn insert_not_group_empty_module ( ) {
108
- cov_mark:: check!( insert_empty_module) ;
109
- check_with_config (
110
- "foo::bar" ,
111
- r"mod x {$0}" ,
112
- r"mod x {
113
- use foo::bar;
114
- }" ,
115
- & InsertUseConfig {
116
- granularity : ImportGranularity :: Item ,
117
- enforce_granularity : true ,
118
- prefix_kind : PrefixKind :: Plain ,
119
- group : false ,
120
- skip_glob_imports : true ,
121
- } ,
122
- ) ;
123
- }
124
-
125
- #[ test]
126
- fn insert_no_group_after_inner_attr ( ) {
127
- cov_mark:: check!( insert_empty_inner_attr) ;
128
- check_with_config (
129
- "foo::bar" ,
130
- r"#![allow(unused_imports)]" ,
131
- r"#![allow(unused_imports)]
132
-
133
- use foo::bar;" ,
134
- & InsertUseConfig {
135
- granularity : ImportGranularity :: Item ,
136
- enforce_granularity : true ,
137
- prefix_kind : PrefixKind :: Plain ,
138
- group : false ,
139
- skip_glob_imports : true ,
140
- } ,
141
- )
142
- }
143
-
144
87
#[ test]
145
88
fn insert_existing ( ) {
146
89
check_crate ( "std::fs" , "use std::fs;" , "use std::fs;" )
@@ -359,45 +302,108 @@ fn main() {}",
359
302
360
303
#[ test]
361
304
fn insert_empty_file ( ) {
362
- cov_mark:: check!( insert_empty_file) ;
363
- // empty files will get two trailing newlines
364
- // this is due to the test case insert_no_imports above
365
- check_crate (
366
- "foo::bar" ,
367
- "" ,
368
- r"use foo::bar;
305
+ {
306
+ // Default configuration
307
+ cov_mark:: check!( insert_empty_file) ;
308
+ // empty files will get two trailing newlines
309
+ // this is due to the test case insert_no_imports above
310
+ check_crate (
311
+ "foo::bar" ,
312
+ "" ,
313
+ r"use foo::bar;
369
314
370
315
" ,
371
- )
316
+ ) ;
317
+ }
318
+ {
319
+ // "not group" configuration
320
+ cov_mark:: check!( insert_empty_file) ;
321
+ check_with_config (
322
+ "use external_crate2::bar::A" ,
323
+ r"" ,
324
+ r"use external_crate2::bar::A;
325
+
326
+ " ,
327
+ & InsertUseConfig {
328
+ granularity : ImportGranularity :: Item ,
329
+ enforce_granularity : true ,
330
+ prefix_kind : PrefixKind :: Plain ,
331
+ group : false ,
332
+ skip_glob_imports : true ,
333
+ } ,
334
+ ) ;
335
+ }
372
336
}
373
337
374
338
#[ test]
375
339
fn insert_empty_module ( ) {
376
- cov_mark:: check!( insert_empty_module) ;
377
- check (
378
- "foo::bar" ,
379
- r"
340
+ {
341
+ // Default configuration
342
+ cov_mark:: check!( insert_empty_module) ;
343
+ check (
344
+ "foo::bar" ,
345
+ r"
380
346
mod x {$0}
381
347
" ,
382
- r"
348
+ r"
383
349
mod x {
384
350
use foo::bar;
385
351
}
386
352
" ,
387
- ImportGranularity :: Item ,
388
- )
353
+ ImportGranularity :: Item ,
354
+ ) ;
355
+ }
356
+ {
357
+ // "not group" configuration
358
+ cov_mark:: check!( insert_empty_module) ;
359
+ check_with_config (
360
+ "foo::bar" ,
361
+ r"mod x {$0}" ,
362
+ r"mod x {
363
+ use foo::bar;
364
+ }" ,
365
+ & InsertUseConfig {
366
+ granularity : ImportGranularity :: Item ,
367
+ enforce_granularity : true ,
368
+ prefix_kind : PrefixKind :: Plain ,
369
+ group : false ,
370
+ skip_glob_imports : true ,
371
+ } ,
372
+ ) ;
373
+ }
389
374
}
390
375
391
376
#[ test]
392
377
fn insert_after_inner_attr ( ) {
393
- cov_mark:: check!( insert_empty_inner_attr) ;
394
- check_crate (
395
- "foo::bar" ,
396
- r"#![allow(unused_imports)]" ,
397
- r"#![allow(unused_imports)]
378
+ {
379
+ // Default configuration
380
+ cov_mark:: check!( insert_empty_inner_attr) ;
381
+ check_crate (
382
+ "foo::bar" ,
383
+ r"#![allow(unused_imports)]" ,
384
+ r"#![allow(unused_imports)]
398
385
399
386
use foo::bar;" ,
400
- )
387
+ ) ;
388
+ }
389
+ {
390
+ // "not group" configuration
391
+ cov_mark:: check!( insert_empty_inner_attr) ;
392
+ check_with_config (
393
+ "foo::bar" ,
394
+ r"#![allow(unused_imports)]" ,
395
+ r"#![allow(unused_imports)]
396
+
397
+ use foo::bar;" ,
398
+ & InsertUseConfig {
399
+ granularity : ImportGranularity :: Item ,
400
+ enforce_granularity : true ,
401
+ prefix_kind : PrefixKind :: Plain ,
402
+ group : false ,
403
+ skip_glob_imports : true ,
404
+ } ,
405
+ ) ;
406
+ }
401
407
}
402
408
403
409
#[ test]
0 commit comments