diff options
author | Lukas Tobias Wirth <lukastw97@gmail.com> | 2021-05-18 18:49:15 +0100 |
---|---|---|
committer | Lukas Tobias Wirth <lukastw97@gmail.com> | 2021-05-18 18:53:20 +0100 |
commit | 64f7072c255bd97a58b8344d0beeae281b8f7e13 (patch) | |
tree | a0e0b102c4880ff5c6b9c58a266479b513186acb /crates/ide_db/src/helpers/insert_use | |
parent | e3d0d89d7e3e253234271008df9324ec1faf1746 (diff) |
MergeBehavior -> ImportGranularity
Diffstat (limited to 'crates/ide_db/src/helpers/insert_use')
-rw-r--r-- | crates/ide_db/src/helpers/insert_use/tests.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ide_db/src/helpers/insert_use/tests.rs b/crates/ide_db/src/helpers/insert_use/tests.rs index 248227d29..f99857a89 100644 --- a/crates/ide_db/src/helpers/insert_use/tests.rs +++ b/crates/ide_db/src/helpers/insert_use/tests.rs | |||
@@ -21,7 +21,7 @@ use crate::bar::A; | |||
21 | use self::bar::A; | 21 | use self::bar::A; |
22 | use super::bar::A; | 22 | use super::bar::A; |
23 | use external_crate2::bar::A;", | 23 | use external_crate2::bar::A;", |
24 | None, | 24 | ImportGranularity::Item, |
25 | false, | 25 | false, |
26 | false, | 26 | false, |
27 | ); | 27 | ); |
@@ -36,7 +36,7 @@ fn insert_not_group_empty() { | |||
36 | r"use external_crate2::bar::A; | 36 | r"use external_crate2::bar::A; |
37 | 37 | ||
38 | ", | 38 | ", |
39 | None, | 39 | ImportGranularity::Item, |
40 | false, | 40 | false, |
41 | false, | 41 | false, |
42 | ); | 42 | ); |
@@ -281,7 +281,7 @@ fn insert_empty_module() { | |||
281 | r"{ | 281 | r"{ |
282 | use foo::bar; | 282 | use foo::bar; |
283 | }", | 283 | }", |
284 | None, | 284 | ImportGranularity::Item, |
285 | true, | 285 | true, |
286 | true, | 286 | true, |
287 | ) | 287 | ) |
@@ -635,7 +635,7 @@ fn check( | |||
635 | path: &str, | 635 | path: &str, |
636 | ra_fixture_before: &str, | 636 | ra_fixture_before: &str, |
637 | ra_fixture_after: &str, | 637 | ra_fixture_after: &str, |
638 | mb: Option<MergeBehavior>, | 638 | granularity: ImportGranularity, |
639 | module: bool, | 639 | module: bool, |
640 | group: bool, | 640 | group: bool, |
641 | ) { | 641 | ) { |
@@ -651,21 +651,21 @@ fn check( | |||
651 | .find_map(ast::Path::cast) | 651 | .find_map(ast::Path::cast) |
652 | .unwrap(); | 652 | .unwrap(); |
653 | 653 | ||
654 | insert_use(&file, path, InsertUseConfig { merge: mb, prefix_kind: PrefixKind::Plain, group }); | 654 | insert_use(&file, path, InsertUseConfig { granularity, prefix_kind: PrefixKind::Plain, group }); |
655 | let result = file.as_syntax_node().to_string(); | 655 | let result = file.as_syntax_node().to_string(); |
656 | assert_eq_text!(ra_fixture_after, &result); | 656 | assert_eq_text!(ra_fixture_after, &result); |
657 | } | 657 | } |
658 | 658 | ||
659 | fn check_crate(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) { | 659 | fn check_crate(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) { |
660 | check(path, ra_fixture_before, ra_fixture_after, Some(MergeBehavior::Crate), false, true) | 660 | check(path, ra_fixture_before, ra_fixture_after, ImportGranularity::Crate, false, true) |
661 | } | 661 | } |
662 | 662 | ||
663 | fn check_module(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) { | 663 | fn check_module(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) { |
664 | check(path, ra_fixture_before, ra_fixture_after, Some(MergeBehavior::Module), false, true) | 664 | check(path, ra_fixture_before, ra_fixture_after, ImportGranularity::Module, false, true) |
665 | } | 665 | } |
666 | 666 | ||
667 | fn check_none(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) { | 667 | fn check_none(path: &str, ra_fixture_before: &str, ra_fixture_after: &str) { |
668 | check(path, ra_fixture_before, ra_fixture_after, None, false, true) | 668 | check(path, ra_fixture_before, ra_fixture_after, ImportGranularity::Item, false, true) |
669 | } | 669 | } |
670 | 670 | ||
671 | fn check_merge_only_fail(ra_fixture0: &str, ra_fixture1: &str, mb: MergeBehavior) { | 671 | fn check_merge_only_fail(ra_fixture0: &str, ra_fixture1: &str, mb: MergeBehavior) { |