aboutsummaryrefslogtreecommitdiff
path: root/helix-term/tests
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/tests')
-rw-r--r--helix-term/tests/test/movement.rs57
1 files changed, 57 insertions, 0 deletions
diff --git a/helix-term/tests/test/movement.rs b/helix-term/tests/test/movement.rs
index 4ebaae85..1c25032c 100644
--- a/helix-term/tests/test/movement.rs
+++ b/helix-term/tests/test/movement.rs
@@ -635,3 +635,60 @@ async fn test_surround_delete() -> anyhow::Result<()> {
Ok(())
}
+
+#[tokio::test(flavor = "multi_thread")]
+async fn tree_sitter_motions_work_across_injections() -> anyhow::Result<()> {
+ test_with_config(
+ AppBuilder::new().with_file("foo.html", None),
+ (
+ "<script>let #[|x]# = 1;</script>",
+ "<A-o>",
+ "<script>let #[|x = 1]#;</script>",
+ ),
+ )
+ .await?;
+
+ // When the full injected layer is selected, expand_selection jumps to
+ // a more shallow layer.
+ test_with_config(
+ AppBuilder::new().with_file("foo.html", None),
+ (
+ "<script>#[|let x = 1;]#</script>",
+ "<A-o>",
+ "#[|<script>let x = 1;</script>]#",
+ ),
+ )
+ .await?;
+
+ test_with_config(
+ AppBuilder::new().with_file("foo.html", None),
+ (
+ "<script>let #[|x = 1]#;</script>",
+ "<A-i>",
+ "<script>let #[|x]# = 1;</script>",
+ ),
+ )
+ .await?;
+
+ test_with_config(
+ AppBuilder::new().with_file("foo.html", None),
+ (
+ "<script>let #[|x]# = 1;</script>",
+ "<A-n>",
+ "<script>let x #[|=]# 1;</script>",
+ ),
+ )
+ .await?;
+
+ test_with_config(
+ AppBuilder::new().with_file("foo.html", None),
+ (
+ "<script>let #[|x]# = 1;</script>",
+ "<A-p>",
+ "<script>#[|let]# x = 1;</script>",
+ ),
+ )
+ .await?;
+
+ Ok(())
+}