Use mark to check that paths that are too long will not be merged
This commit is contained in:
parent
74186d3ae7
commit
07ff9eeca8
1 changed files with 13 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ use syntax::{
|
|||
};
|
||||
|
||||
use crate::assist_context::AssistContext;
|
||||
use test_utils::mark;
|
||||
|
||||
/// Determines the containing syntax node in which to insert a `use` statement affecting `position`.
|
||||
pub(crate) fn find_insert_use_container(
|
||||
|
|
@ -126,6 +127,7 @@ pub fn try_merge_trees(
|
|||
if merge_behaviour == MergeBehaviour::Last
|
||||
&& (use_tree_list_is_nested(&lhs_tl) || use_tree_list_is_nested(&rhs_tl))
|
||||
{
|
||||
mark::hit!(test_last_merge_too_long);
|
||||
return None;
|
||||
}
|
||||
|
||||
|
|
@ -586,6 +588,17 @@ use std::io;",
|
|||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn merge_last_too_long() {
|
||||
mark::check!(test_last_merge_too_long);
|
||||
check_last(
|
||||
"foo::bar",
|
||||
r"use foo::bar::baz::Qux;",
|
||||
r"use foo::bar::baz::Qux;
|
||||
use foo::bar;",
|
||||
);
|
||||
}
|
||||
|
||||
fn check(
|
||||
path: &str,
|
||||
ra_fixture_before: &str,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue