Teach run-test-at-point four more languages - #2136
Merged
Merged
Conversation
Ruby, Rust, Elixir and Java join Python, Go and JS/TS. Three of them needed something beyond a name and a file: Ruby's two frameworks share a major mode, so the rule matches both an RSpec example and a Minitest method and the project type decides which runner to spell. Java is addressed as Class#method, and since Java makes the public class match its file the class comes from the file name; the project type picks between Maven's and Gradle's selector syntax. ExUnit has no name filter at all, so Elixir tests are addressed by line. Rust needs the #[test] attribute to distinguish a test from an ordinary function, which means walking back over the attributes stacked above it - so the fake-treesit test harness grew node-prev-sibling.
The other treesit functions are declared for the benefit of an Emacs built without tree-sitter; this one was not, so the 28.2 build failed to byte-compile while a local 30.2 compiled it happily.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ruby, Rust, Elixir and Java join the Python, Go and JS/TS rules the feature
shipped with.
Three of them needed more than the
(name, file)the rule contract hands to acommand function, and the ways round that are the interesting part:
both an
itblock and atest_-prefixed method, and the project typedecides whether to spell
rspec -eorruby -Itest -n.Class#method. Java requires the public class tobe named after its file, so the class comes from the file name; the project
type again picks between Maven's and Gradle's selector syntax.
so Elixir tests are addressed as
FILE:LINE. The command function runs in thebuffer with point still on the test, so the line is there for the taking.
#[test]attribute to tell a test from an ordinaryfunction, which means walking back over however many attributes are stacked
above it -
#[ignore]on top of#[test]still counts. The fake-treesit testharness grew
treesit-node-prev-siblingfor this.All the specs use the existing fake-node harness, so they run without
tree-sitter or any grammar installed.
One thing the specs caught: I'd written the expected commands with shell
quoting (
-e 'adds it'), butshell-quote-argumentescapes (-e adds\ it).The expectations go through
shell-quote-argumentnow, which also keeps themhonest on a platform that quotes differently.
package-lint gains more "needs Emacs 29.1" notes for the treesit calls - the
same ones the existing rules already produce, and that step is report-only.
relint, the hard gate, stays clean.