mirror of https://github.com/helix-editor/helix
backfill expand/shrink tests
parent
2fbe7fc5b5
commit
f6e1a2f599
|
@ -948,3 +948,115 @@ async fn match_bracket() -> anyhow::Result<()> {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn expand_shrink_selection() -> anyhow::Result<()> {
|
||||
let tests = vec![
|
||||
// single range
|
||||
(
|
||||
indoc! {r##"
|
||||
Some(#[thing|]#)
|
||||
"##},
|
||||
"<A-o><A-o>",
|
||||
indoc! {r##"
|
||||
#[Some(thing)|]#
|
||||
"##},
|
||||
),
|
||||
// multi range
|
||||
(
|
||||
indoc! {r##"
|
||||
Some(#[thing|]#)
|
||||
Some(#(other_thing|)#)
|
||||
"##},
|
||||
"<A-o>",
|
||||
indoc! {r##"
|
||||
Some#[(thing)|]#
|
||||
Some#((other_thing)|)#
|
||||
"##},
|
||||
),
|
||||
// multi range collision merges
|
||||
(
|
||||
indoc! {r##"
|
||||
(
|
||||
Some(#[thing|]#),
|
||||
Some(#(other_thing|)#),
|
||||
)
|
||||
"##},
|
||||
"<A-o><A-o><A-o>",
|
||||
indoc! {r##"
|
||||
#[(
|
||||
Some(thing),
|
||||
Some(other_thing),
|
||||
)|]#
|
||||
"##},
|
||||
),
|
||||
// multi range collision merges, then shrinks back to original
|
||||
(
|
||||
indoc! {r##"
|
||||
(
|
||||
Some(#[thing|]#),
|
||||
Some(#(other_thing|)#),
|
||||
)
|
||||
"##},
|
||||
"<A-o><A-o><A-o><A-i>",
|
||||
indoc! {r##"
|
||||
(
|
||||
#[Some(thing)|]#,
|
||||
#(Some(other_thing)|)#,
|
||||
)
|
||||
"##},
|
||||
),
|
||||
(
|
||||
indoc! {r##"
|
||||
(
|
||||
Some(#[thing|]#),
|
||||
Some(#(other_thing|)#),
|
||||
)
|
||||
"##},
|
||||
"<A-o><A-o><A-o><A-i><A-i>",
|
||||
indoc! {r##"
|
||||
(
|
||||
Some#[(thing)|]#,
|
||||
Some#((other_thing)|)#,
|
||||
)
|
||||
"##},
|
||||
),
|
||||
(
|
||||
indoc! {r##"
|
||||
(
|
||||
Some(#[thing|]#),
|
||||
Some(#(other_thing|)#),
|
||||
)
|
||||
"##},
|
||||
"<A-o><A-o><A-o><A-i><A-i><A-i>",
|
||||
indoc! {r##"
|
||||
(
|
||||
Some(#[thing|]#),
|
||||
Some(#(other_thing|)#),
|
||||
)
|
||||
"##},
|
||||
),
|
||||
// shrink with no expansion history defaults to first child
|
||||
(
|
||||
indoc! {r##"
|
||||
(
|
||||
#[Some(thing)|]#,
|
||||
Some(other_thing),
|
||||
)
|
||||
"##},
|
||||
"<A-i>",
|
||||
indoc! {r##"
|
||||
(
|
||||
#[Some|]#(thing),
|
||||
Some(other_thing),
|
||||
)
|
||||
"##},
|
||||
),
|
||||
];
|
||||
|
||||
for test in tests {
|
||||
test_with_config(AppBuilder::new().with_file("foo.rs", None), test).await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue