Skip to content

Commit

Permalink
fixup(test): update parser install & tests
Browse files Browse the repository at this point in the history
  • Loading branch information
luckasRanarison committed Aug 2, 2024
1 parent 619e587 commit a044296
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install parsers
run: |
nvim --headless -u tests/init.lua -c "TSInstallSync html css tsx astro php twig svelte vue htmldjango heex elixir" -c "q"
nvim --headless -u tests/init.lua -c "luafile tests/parsers.lua"
- name: Run Tests
run: |
Expand Down
5 changes: 5 additions & 0 deletions queries/templ/class.scm
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
; inherits: html

(attribute
name: (attribute_name) @attribute (#eq? @attribute "class")
value: (expression
(_) @tailwind))
16 changes: 16 additions & 0 deletions tests/parsers.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
local parsers = {
"tsx",
"astro",
"php",
"twig",
"svelte",
"vue",
"htmldjango",
"heex",
"elixir",
"javascript",
"templ",
}

vim.cmd.TSInstallSync(parsers)
vim.cmd.q()
7 changes: 7 additions & 0 deletions tests/queries/templ/test.templ
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

templ Hello(classname string) {
<div class="container">
<span class={ classname }>Hello World</span>
</div>
}
9 changes: 9 additions & 0 deletions tests/queries/templ_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require("tests.queries.runner").test({
name = "templ",
provider = "treesitter",
file = "tests/queries/templ/test.templ",
ranges = {
{ 3, 14, 3, 23 },
{ 4, 18, 4, 27 },
},
})

0 comments on commit a044296

Please sign in to comment.