File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
crates/ide-db/src/imports/insert_use Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -993,6 +993,46 @@ use foo::bar::qux;
993
993
) ;
994
994
}
995
995
996
+ #[ test]
997
+ fn insert_with_renamed_import_simple_use ( ) {
998
+ check_with_config (
999
+ "use self::foo::Foo" ,
1000
+ r#"
1001
+ use self::foo::Foo as _;
1002
+ "# ,
1003
+ r#"
1004
+ use self::foo::Foo;
1005
+ "# ,
1006
+ & InsertUseConfig {
1007
+ granularity : ImportGranularity :: Crate ,
1008
+ prefix_kind : hir:: PrefixKind :: BySelf ,
1009
+ enforce_granularity : true ,
1010
+ group : true ,
1011
+ skip_glob_imports : true ,
1012
+ } ,
1013
+ ) ;
1014
+ }
1015
+
1016
+ #[ test]
1017
+ fn insert_with_renamed_import_complex_use ( ) {
1018
+ check_with_config (
1019
+ "use self::foo::Foo;" ,
1020
+ r#"
1021
+ use self::foo::{self, Foo as _, Bar};
1022
+ "# ,
1023
+ r#"
1024
+ use self::foo::{self, Foo, Bar};
1025
+ "# ,
1026
+ & InsertUseConfig {
1027
+ granularity : ImportGranularity :: Crate ,
1028
+ prefix_kind : hir:: PrefixKind :: BySelf ,
1029
+ enforce_granularity : true ,
1030
+ group : true ,
1031
+ skip_glob_imports : true ,
1032
+ } ,
1033
+ ) ;
1034
+ }
1035
+
996
1036
fn check_with_config (
997
1037
path : & str ,
998
1038
ra_fixture_before : & str ,
You can’t perform that action at this time.
0 commit comments