aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db/src/helpers/insert_use/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_db/src/helpers/insert_use/tests.rs')
-rw-r--r--crates/ide_db/src/helpers/insert_use/tests.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/ide_db/src/helpers/insert_use/tests.rs b/crates/ide_db/src/helpers/insert_use/tests.rs
index a3464d606..048c213e2 100644
--- a/crates/ide_db/src/helpers/insert_use/tests.rs
+++ b/crates/ide_db/src/helpers/insert_use/tests.rs
@@ -5,6 +5,7 @@ use test_utils::assert_eq_text;
5 5
6#[test] 6#[test]
7fn insert_not_group() { 7fn insert_not_group() {
8 cov_mark::check!(insert_no_grouping_last);
8 check( 9 check(
9 "use external_crate2::bar::A", 10 "use external_crate2::bar::A",
10 r" 11 r"
@@ -27,6 +28,21 @@ use external_crate2::bar::A;",
27} 28}
28 29
29#[test] 30#[test]
31fn insert_not_group_empty() {
32 cov_mark::check!(insert_no_grouping_last2);
33 check(
34 "use external_crate2::bar::A",
35 r"",
36 r"use external_crate2::bar::A;
37
38",
39 None,
40 false,
41 false,
42 );
43}
44
45#[test]
30fn insert_existing() { 46fn insert_existing() {
31 check_full("std::fs", "use std::fs;", "use std::fs;") 47 check_full("std::fs", "use std::fs;", "use std::fs;")
32} 48}
@@ -65,6 +81,7 @@ fn insert_start_indent() {
65 81
66#[test] 82#[test]
67fn insert_middle() { 83fn insert_middle() {
84 cov_mark::check!(insert_group);
68 check_none( 85 check_none(
69 "std::bar::EE", 86 "std::bar::EE",
70 r" 87 r"
@@ -101,6 +118,7 @@ fn insert_middle_indent() {
101 118
102#[test] 119#[test]
103fn insert_end() { 120fn insert_end() {
121 cov_mark::check!(insert_group_last);
104 check_none( 122 check_none(
105 "std::bar::ZZ", 123 "std::bar::ZZ",
106 r" 124 r"
@@ -199,6 +217,7 @@ fn insert_first_matching_group() {
199 217
200#[test] 218#[test]
201fn insert_missing_group_std() { 219fn insert_missing_group_std() {
220 cov_mark::check!(insert_group_new_group);
202 check_none( 221 check_none(
203 "std::fmt", 222 "std::fmt",
204 r" 223 r"
@@ -214,6 +233,7 @@ fn insert_missing_group_std() {
214 233
215#[test] 234#[test]
216fn insert_missing_group_self() { 235fn insert_missing_group_self() {
236 cov_mark::check!(insert_group_no_group);
217 check_none( 237 check_none(
218 "self::fmt", 238 "self::fmt",
219 r" 239 r"
@@ -240,6 +260,7 @@ fn main() {}",
240 260
241#[test] 261#[test]
242fn insert_empty_file() { 262fn insert_empty_file() {
263 cov_mark::check!(insert_group_empty_file);
243 // empty files will get two trailing newlines 264 // empty files will get two trailing newlines
244 // this is due to the test case insert_no_imports above 265 // this is due to the test case insert_no_imports above
245 check_full( 266 check_full(
@@ -253,6 +274,7 @@ fn insert_empty_file() {
253 274
254#[test] 275#[test]
255fn insert_empty_module() { 276fn insert_empty_module() {
277 cov_mark::check!(insert_group_empty_module);
256 check( 278 check(
257 "foo::bar", 279 "foo::bar",
258 "mod x {}", 280 "mod x {}",
@@ -267,6 +289,7 @@ fn insert_empty_module() {
267 289
268#[test] 290#[test]
269fn insert_after_inner_attr() { 291fn insert_after_inner_attr() {
292 cov_mark::check!(insert_group_empty_inner_attr);
270 check_full( 293 check_full(
271 "foo::bar", 294 "foo::bar",
272 r"#![allow(unused_imports)]", 295 r"#![allow(unused_imports)]",