Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/tests/test/commands.rs')
-rw-r--r--helix-term/tests/test/commands.rs60
1 files changed, 60 insertions, 0 deletions
diff --git a/helix-term/tests/test/commands.rs b/helix-term/tests/test/commands.rs
index 6b904aa3..1c5c6196 100644
--- a/helix-term/tests/test/commands.rs
+++ b/helix-term/tests/test/commands.rs
@@ -664,3 +664,63 @@ async fn test_read_file() -> anyhow::Result<()> {
Ok(())
}
+
+#[tokio::test(flavor = "multi_thread")]
+async fn surround_delete() -> anyhow::Result<()> {
+ // Test `surround_delete` when head < anchor
+ test(("(#[| ]#)", "mdm", "#[| ]#")).await?;
+ test(("(#[| ]#)", "md(", "#[| ]#")).await?;
+
+ Ok(())
+}
+
+#[tokio::test(flavor = "multi_thread")]
+async fn surround_replace_ts() -> anyhow::Result<()> {
+ const INPUT: &str = r#"\
+fn foo() {
+ if let Some(_) = None {
+ todo!("f#[|o]#o)");
+ }
+}
+"#;
+ test((
+ INPUT,
+ ":lang rust<ret>mrm'",
+ r#"\
+fn foo() {
+ if let Some(_) = None {
+ todo!('f#[|o]#o)');
+ }
+}
+"#,
+ ))
+ .await?;
+
+ test((
+ INPUT,
+ ":lang rust<ret>3mrm[",
+ r#"\
+fn foo() {
+ if let Some(_) = None [
+ todo!("f#[|o]#o)");
+ ]
+}
+"#,
+ ))
+ .await?;
+
+ test((
+ INPUT,
+ ":lang rust<ret>2mrm{",
+ r#"\
+fn foo() {
+ if let Some(_) = None {
+ todo!{"f#[|o]#o)"};
+ }
+}
+"#,
+ ))
+ .await?;
+
+ Ok(())
+}