Skip to content

Commit 0cc079f

Browse files
authored
Merge test functions using the same coverage marks to avoid parallelism
1 parent c039810 commit 0cc079f

File tree

1 file changed

+84
-78
lines changed
  • crates/ide_db/src/imports/insert_use

1 file changed

+84
-78
lines changed

crates/ide_db/src/imports/insert_use/tests.rs

Lines changed: 84 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -84,63 +84,6 @@ use external_crate2::bar::A;",
8484
);
8585
}
8686

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-
14487
#[test]
14588
fn insert_existing() {
14689
check_crate("std::fs", "use std::fs;", "use std::fs;")
@@ -359,45 +302,108 @@ fn main() {}",
359302

360303
#[test]
361304
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;
369314
370315
",
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+
}
372336
}
373337

374338
#[test]
375339
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"
380346
mod x {$0}
381347
",
382-
r"
348+
r"
383349
mod x {
384350
use foo::bar;
385351
}
386352
",
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+
}
389374
}
390375

391376
#[test]
392377
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)]
398385
399386
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+
}
401407
}
402408

403409
#[test]

0 commit comments

Comments
 (0)