test: add tests for norg treesitter backend

This commit is contained in:
Steven Arcangeli 2022-06-14 08:57:14 -07:00
parent 59382fe4ba
commit 8ecf3cf6e3
4 changed files with 51 additions and 6 deletions

View file

@ -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",

View file

@ -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",

View 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)

View file

@ -0,0 +1,3 @@
* Top header
** Level 2 header
*** Level 3 header