-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
225 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
use super::*; | ||
|
||
#[tokio::test(flavor = "multi_thread")] | ||
async fn select_all_siblings() -> anyhow::Result<()> { | ||
let tests = vec![ | ||
// basic tests | ||
( | ||
helpers::platform_line(indoc! {r##" | ||
let foo = bar(#[a|]#, b, c); | ||
"##}), | ||
"<A-a>", | ||
helpers::platform_line(indoc! {r##" | ||
let foo = bar(#[a|]#, #(b|)#, #(c|)#); | ||
"##}), | ||
), | ||
( | ||
helpers::platform_line(indoc! {r##" | ||
let a = [ | ||
#[1|]#, | ||
2, | ||
3, | ||
4, | ||
5, | ||
]; | ||
"##}), | ||
"<A-a>", | ||
helpers::platform_line(indoc! {r##" | ||
let a = [ | ||
#[1|]#, | ||
#(2|)#, | ||
#(3|)#, | ||
#(4|)#, | ||
#(5|)#, | ||
]; | ||
"##}), | ||
), | ||
// direction is preserved | ||
( | ||
helpers::platform_line(indoc! {r##" | ||
let a = [ | ||
#[|1]#, | ||
2, | ||
3, | ||
4, | ||
5, | ||
]; | ||
"##}), | ||
"<A-a>", | ||
helpers::platform_line(indoc! {r##" | ||
let a = [ | ||
#[|1]#, | ||
#(|2)#, | ||
#(|3)#, | ||
#(|4)#, | ||
#(|5)#, | ||
]; | ||
"##}), | ||
), | ||
// can't pick any more siblings - selection stays the same | ||
( | ||
helpers::platform_line(indoc! {r##" | ||
let a = [ | ||
#[1|]#, | ||
#(2|)#, | ||
#(3|)#, | ||
#(4|)#, | ||
#(5|)#, | ||
]; | ||
"##}), | ||
"<A-a>", | ||
helpers::platform_line(indoc! {r##" | ||
let a = [ | ||
#[1|]#, | ||
#(2|)#, | ||
#(3|)#, | ||
#(4|)#, | ||
#(5|)#, | ||
]; | ||
"##}), | ||
), | ||
// each cursor does the sibling select independently | ||
( | ||
helpers::platform_line(indoc! {r##" | ||
let a = [ | ||
#[1|]#, | ||
2, | ||
3, | ||
4, | ||
5, | ||
]; | ||
let b = [ | ||
#("one"|)#, | ||
"two", | ||
"three", | ||
"four", | ||
"five", | ||
]; | ||
"##}), | ||
"<A-a>", | ||
helpers::platform_line(indoc! {r##" | ||
let a = [ | ||
#[1|]#, | ||
#(2|)#, | ||
#(3|)#, | ||
#(4|)#, | ||
#(5|)#, | ||
]; | ||
let b = [ | ||
#("one"|)#, | ||
#("two"|)#, | ||
#("three"|)#, | ||
#("four"|)#, | ||
#("five"|)#, | ||
]; | ||
"##}), | ||
), | ||
// conflicting sibling selections get normalized. Here, the primary | ||
// selection would choose every list item, but because the secondary | ||
// range covers more than one item, the descendent is the entire list, | ||
// which means the sibling is the assignment. The list item ranges just | ||
// get normalized out since the list itself becomes selected. | ||
( | ||
helpers::platform_line(indoc! {r##" | ||
let a = [ | ||
#[1|]#, | ||
2, | ||
#(3, | ||
4|)#, | ||
5, | ||
]; | ||
"##}), | ||
"<A-a>", | ||
helpers::platform_line(indoc! {r##" | ||
let #(a|)# = #[[ | ||
1, | ||
2, | ||
3, | ||
4, | ||
5, | ||
]|]#; | ||
"##}), | ||
), | ||
]; | ||
|
||
for test in tests { | ||
test_with_config(AppBuilder::new().with_file("foo.rs", None), test).await?; | ||
} | ||
|
||
Ok(()) | ||
} |