mirror of
https://github.com/stevearc/aerial.nvim
synced 2024-09-16 14:34:08 +02:00
test: add tests for norg treesitter backend
This commit is contained in:
parent
59382fe4ba
commit
8ecf3cf6e3
4 changed files with 51 additions and 6 deletions
|
@ -68,12 +68,12 @@ return {
|
|||
atx_heading = "Interface",
|
||||
},
|
||||
norg = {
|
||||
heading1 = "Interface",
|
||||
heading2 = "Interface",
|
||||
heading3 = "Interface",
|
||||
heading4 = "Interface",
|
||||
heading5 = "Interface",
|
||||
heading6 = "Interface",
|
||||
heading1 = "Interface",
|
||||
heading2 = "Interface",
|
||||
heading3 = "Interface",
|
||||
heading4 = "Interface",
|
||||
heading5 = "Interface",
|
||||
heading6 = "Interface",
|
||||
},
|
||||
org = {
|
||||
section = "Interface",
|
||||
|
|
|
@ -8,6 +8,8 @@ vim.bo.swapfile = false
|
|||
vim.cmd([[autocmd BufRead,BufNewFile *.jl setfiletype julia]])
|
||||
-- Neovim below 0.7 doesn't have org filetype detection
|
||||
vim.cmd([[autocmd BufRead,BufNewFile *.org setfiletype org]])
|
||||
-- Neovim doesn't have built-in norg filetype detection
|
||||
vim.cmd([[autocmd BufRead,BufNewFile *.norg setfiletype norg]])
|
||||
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = "all",
|
||||
|
|
40
tests/treesitter/norg_spec.lua
Normal file
40
tests/treesitter/norg_spec.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
local util = require("tests.test_util")
|
||||
|
||||
describe("treesitter neorg", function()
|
||||
it("parses all symbols correctly", function()
|
||||
util.test_file_symbols("treesitter", "./tests/treesitter/norg_test.norg", {
|
||||
{
|
||||
kind = "Interface",
|
||||
name = "Top header",
|
||||
level = 0,
|
||||
lnum = 1,
|
||||
col = 0,
|
||||
end_lnum = 3,
|
||||
end_col = 20,
|
||||
children = {
|
||||
{
|
||||
kind = "Interface",
|
||||
name = "Level 2 header",
|
||||
level = 1,
|
||||
lnum = 2,
|
||||
col = 1,
|
||||
end_lnum = 3,
|
||||
end_col = 20,
|
||||
children = {
|
||||
{
|
||||
kind = "Interface",
|
||||
name = "Level 3 header",
|
||||
level = 2,
|
||||
lnum = 3,
|
||||
col = 2,
|
||||
end_lnum = 3,
|
||||
end_col = 20,
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
end)
|
||||
end)
|
||||
|
3
tests/treesitter/norg_test.norg
Normal file
3
tests/treesitter/norg_test.norg
Normal file
|
@ -0,0 +1,3 @@
|
|||
* Top header
|
||||
** Level 2 header
|
||||
*** Level 3 header
|
Loading…
Reference in a new issue