@@ -114,8 +114,7 @@ pub fn try_merge_trees(
114114 let lhs_tl = lhs. use_tree_list ( ) ?;
115115 let rhs_tl = rhs. use_tree_list ( ) ?;
116116
117- // if we are only allowed to merge the last level check if the paths are only one level deep
118- // FIXME: This shouldn't work yet i think
117+ // if we are only allowed to merge the last level check if the split off paths are only one level deep
119118 if merge_behaviour == MergeBehaviour :: Last && use_tree_list_is_nested ( & lhs_tl)
120119 || use_tree_list_is_nested ( & rhs_tl)
121120 {
@@ -463,14 +462,69 @@ use std::io;",
463462 }
464463
465464 #[ test]
466- fn merges_groups2 ( ) {
465+ fn merges_groups_full ( ) {
467466 check_full (
468467 "std::io" ,
469468 r"use std::fmt::{Result, Display};" ,
470469 r"use std::{fmt::{Result, Display}, io};" ,
471470 )
472471 }
473472
473+ #[ test]
474+ fn merges_groups_long_full ( ) {
475+ check_full (
476+ "std::foo::bar::Baz" ,
477+ r"use std::foo::bar::Qux;" ,
478+ r"use std::foo::bar::{Baz, Qux};" ,
479+ )
480+ }
481+
482+ #[ test]
483+ fn merges_groups_long_last ( ) {
484+ check_last (
485+ "std::foo::bar::Baz" ,
486+ r"use std::foo::bar::Qux;" ,
487+ r"use std::foo::bar::{Baz, Qux};" ,
488+ )
489+ }
490+
491+ #[ test]
492+ fn merges_groups_long_full_list ( ) {
493+ check_full (
494+ "std::foo::bar::Baz" ,
495+ r"use std::foo::bar::{Qux, Quux};" ,
496+ r"use std::foo::bar::{Baz, Quux, Qux};" ,
497+ )
498+ }
499+
500+ #[ test]
501+ fn merges_groups_long_last_list ( ) {
502+ check_last (
503+ "std::foo::bar::Baz" ,
504+ r"use std::foo::bar::{Qux, Quux};" ,
505+ r"use std::foo::bar::{Baz, Quux, Qux};" ,
506+ )
507+ }
508+
509+ #[ test]
510+ fn merges_groups_long_full_nested ( ) {
511+ check_full (
512+ "std::foo::bar::Baz" ,
513+ r"use std::foo::bar::{Qux, quux::{Fez, Fizz}};" ,
514+ r"use std::foo::bar::{Baz, quux::{Fez, Fizz}, Qux};" ,
515+ )
516+ }
517+
518+ #[ test]
519+ fn merges_groups_long_last_nested ( ) {
520+ check_last (
521+ "std::foo::bar::Baz" ,
522+ r"use std::foo::bar::{Qux, quux::{Fez, Fizz}};" ,
523+ r"use std::foo::bar::Baz;
524+ use std::foo::bar::{quux::{Fez, Fizz}, Qux};" ,
525+ )
526+ }
527+
474528 #[ test]
475529 fn skip_merges_groups_pub ( ) {
476530 check_full (
@@ -481,6 +535,17 @@ use std::io;",
481535 )
482536 }
483537
538+ // should this be a thing?
539+ #[ test]
540+ fn split_merge ( ) {
541+ check_last (
542+ "std::fmt::Result" ,
543+ r"use std::{fmt, io};" ,
544+ r"use std::fmt::Result;
545+ use std::io;" ,
546+ )
547+ }
548+
484549 #[ test]
485550 fn merges_groups_self ( ) {
486551 check_full ( "std::fmt::Debug" , r"use std::fmt;" , r"use std::fmt::{self, Debug};" )
0 commit comments