Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update c queries and test #363

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ on:
jobs:
build:
strategy:
fail-fast: true
fail-fast: false
matrix:
neovim_branch: ['v0.8.2', 'v0.9.1']
neovim_branch: ['v0.9.5']
runs-on: ubuntu-latest
env:
NEOVIM_BRANCH: ${{ matrix.neovim_branch }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.DEFAULT_GOAL := test

NEOVIM_BRANCH := v0.9.1
NEOVIM_BRANCH := v0.9.5

FILTER=.*

Expand Down
4 changes: 4 additions & 0 deletions queries/c/context.scm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
consequence: (_ (_) @context.end)
) @context

(else_clause
(_ (_) @context.end)
) @context

(while_statement
body: (_ (_) @context.end)
) @context
Expand Down
43 changes: 43 additions & 0 deletions test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,48 @@ int main(int arg1,
// comment
}

} else if (arg1 == 4) {
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment

} else {
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment
// comment

}
}
28 changes: 22 additions & 6 deletions test/ts_context_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ describe('ts_context', function()
cmd [[let $XDG_CACHE_HOME='scratch/cache']]
cmd [[set packpath=]]
cmd('syntax enable')

exec_lua[[
require'nvim-treesitter.configs'.setup {
highlight = { enable = true }
}
]]
end)

it('load the plugin', function()
Expand Down Expand Up @@ -191,6 +185,7 @@ describe('ts_context', function()
|
]]}

-- func -> if -> for -> do while
feed'40<C-e>'
screen:expect{grid=[[
{7:int}{2: main(}{7:int}{2: arg1, }|
Expand All @@ -210,6 +205,27 @@ describe('ts_context', function()
{8:// comment} |
|
]]}

-- func -> if / else if / else
feed'41<C-e>'
screen:expect{grid=[[
{7:int}{2: main(}{7:int}{2: arg1, }|
{2: }{1:if}{2: (arg1 == }{10:4}{2: }|
{2: && arg2 == arg3) }{13:{}{2: }|
{2: }{13:}}{2: }{1:else}{2: }{1:if}{2: (arg1 == }{10:4}{2:) }{13:{}{2: }|
{2: }{13:}}{2: }{1:else}{2: }{13:{}{2: }|
^ {8:// comment} |
{8:// comment} |
{8:// comment} |
{8:// comment} |
{8:// comment} |
{8:// comment} |
{8:// comment} |
{8:// comment} |
{8:// comment} |
{8:// comment} |
|
]]}
end)

it('cpp', function()
Expand Down