mirror of https://github.com/helix-editor/helix
Add unit tests for paste_all_selections_(before|after).
parent
e9975c1939
commit
3458b7b037
|
@ -4,6 +4,7 @@ use super::*;
|
||||||
|
|
||||||
mod insert;
|
mod insert;
|
||||||
mod movement;
|
mod movement;
|
||||||
|
mod paste_all_selections;
|
||||||
mod write;
|
mod write;
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
use helix_core::hashmap;
|
||||||
|
use helix_term::keymap;
|
||||||
|
use helix_view::document::Mode;
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn paste_all_selections() -> anyhow::Result<()> {
|
||||||
|
let mut config = Config::default();
|
||||||
|
config.keys.insert(
|
||||||
|
Mode::Normal,
|
||||||
|
keymap!({"Normal Mode"
|
||||||
|
"A-P" => paste_all_selections_before,
|
||||||
|
"A-p" => paste_all_selections_after,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Test paste_all_selections_before
|
||||||
|
// Selection direction matches paste target selections.
|
||||||
|
test_with_config(
|
||||||
|
AppBuilder::new().with_config(config.clone()),
|
||||||
|
(
|
||||||
|
indoc! {"\
|
||||||
|
#(|one)#_cat
|
||||||
|
#(|two)#_dog
|
||||||
|
#[|three]#_cow
|
||||||
|
"},
|
||||||
|
"y<A-P>",
|
||||||
|
indoc! {"\
|
||||||
|
#(|one)##(|two)##(|three)#one_cat
|
||||||
|
#(|one)##(|two)##(|three)#two_dog
|
||||||
|
#(|one)##(|two)##[|three]#three_cow
|
||||||
|
"},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
// Test paste_all_selections_after
|
||||||
|
// Primary selection is last selection pasted for previous primary.
|
||||||
|
test_with_config(
|
||||||
|
AppBuilder::new().with_config(config.clone()),
|
||||||
|
(
|
||||||
|
indoc! {"\
|
||||||
|
#(one|)#_cat
|
||||||
|
#[two|]#_dog
|
||||||
|
#(three|)#_cow
|
||||||
|
"},
|
||||||
|
"y<A-p>",
|
||||||
|
indoc! {"\
|
||||||
|
one#(one|)##(two|)##(three|)#_cat
|
||||||
|
two#(one|)##(two|)##[three|]#_dog
|
||||||
|
three#(one|)##(two|)##(three|)#_cow
|
||||||
|
"},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
Loading…
Reference in New Issue