Skip to content

Commit

Permalink
Experimental support for treesit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adimit committed Mar 21, 2023
1 parent 8c54012 commit 350903a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
6 changes: 6 additions & 0 deletions features/step-definitions/expand-region-steps.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
(lambda ()
(setq expand-region-smart-cursor t)))

(And "^rust-ts-mode is enabled$"
(lambda ()
(setq treesit-extra-load-path
(list "features/support/treesit"))
(rust-ts-mode)))

(When "^I expand the region$"
(lambda ()
(cl-flet ((message (&rest args) nil))
Expand Down
Binary file added features/support/treesit/libtree-sitter-rust.so
Binary file not shown.
15 changes: 9 additions & 6 deletions features/treesit-er-expansions.feature
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
@Treesit
Feature: treesit expansions
Background:
Given there is no region selected
And I turn on rust-ts-mode
And rust-ts-mode is enabled

Scenario: Successively expand the region
When I insert "fn some_func(arg: String) -> String { arg.to_lowercase() }"
And I place the cursor before "to_lowercase"
When I insert "fn foo() -> Option<()> {\n let foo = Some(1)?;\n None\n}"
And I place the cursor before "Some"
And I press "C-@"
Then the region should be "to_lowercase"
Then the region should be "Some"
And I press "C-@"
Then the region should be "arg.to_lowercase()"
Then the region should be "Some(1)"
And I press "C-@"
Then the region should be "{ arg.to_lowercase() }"
Then the region should be "Some(1)?"
And I press "C-@"
Then the region should be "let foo = Some(1)?;"

0 comments on commit 350903a

Please sign in to comment.