Skip to content

test: add missing context tests for existing queries#568

Merged
lewis6991 merged 3 commits intonvim-treesitter:masterfrom
PeterCardenas:add-context-tests
Apr 4, 2025
Merged

test: add missing context tests for existing queries#568
lewis6991 merged 3 commits intonvim-treesitter:masterfrom
PeterCardenas:add-context-tests

Conversation

@PeterCardenas
Copy link
Copy Markdown
Contributor

With #567, it is revealed that many queries are missing their respective context test files. With this, I wanted to go through the clean up of adding a context test for each existing query (with the exception of php_only and ocaml_interface). I also moved what seems to me are snapshot tests into their own directory to remove confusion between the purposes of the files and snapshot test failures. Through this exercise, I found that the tests are lacking in a couple of areas that I'll clean up in future PRs:

  • injected languages are not currently tested with this method. what i imagine i'll do here is check the parser tree and get the children languages to index the test files by relevant injected languages.
  • when no treesitter parsers are installed, many context tests are skipped the first time the suite is run. i'll see what i can do with the treesitter api here.
  • multiline contexts sometimes require only one line to be marked with {{CONTEXT}}. it would make much more sense for me to mark all of the relevant lines. it would also be more immediately apparent for the person introducing the query if the multiline query is accepting too much (which is currently the problem with some languages)

@lewis6991 lewis6991 force-pushed the add-context-tests branch from 8eab691 to b9151de Compare April 4, 2025 09:56
@lewis6991 lewis6991 merged commit a25c56c into nvim-treesitter:master Apr 4, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants