Skip to content

Commit 07ff9ee

Browse files
committed
Use mark to check that paths that are too long will not be merged
1 parent 74186d3 commit 07ff9ee

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

crates/assists/src/utils/insert_use.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use syntax::{
1010
};
1111

1212
use crate::assist_context::AssistContext;
13+
use test_utils::mark;
1314

1415
/// Determines the containing syntax node in which to insert a `use` statement affecting `position`.
1516
pub(crate) fn find_insert_use_container(
@@ -126,6 +127,7 @@ pub fn try_merge_trees(
126127
if merge_behaviour == MergeBehaviour::Last
127128
&& (use_tree_list_is_nested(&lhs_tl) || use_tree_list_is_nested(&rhs_tl))
128129
{
130+
mark::hit!(test_last_merge_too_long);
129131
return None;
130132
}
131133

@@ -586,6 +588,17 @@ use std::io;",
586588
)
587589
}
588590

591+
#[test]
592+
fn merge_last_too_long() {
593+
mark::check!(test_last_merge_too_long);
594+
check_last(
595+
"foo::bar",
596+
r"use foo::bar::baz::Qux;",
597+
r"use foo::bar::baz::Qux;
598+
use foo::bar;",
599+
);
600+
}
601+
589602
fn check(
590603
path: &str,
591604
ra_fixture_before: &str,

0 commit comments

Comments
 (0)