unit tests for treesitter

pull/197/head
ray-x 2 years ago
parent c15bae89ab
commit 3ad93531b5

@ -422,6 +422,7 @@ local function get_all_nodes(bufnr, filter, summary)
if #parents > 1 then
indent = string.rep(' ', #parents - 1) .. ''
end
item.indent = indent
item.text = string.format(' %s %s%-10s\t %s', item.kind, indent, item.node_text, item.full_text)
if #item.text > length then
@ -437,7 +438,6 @@ local function get_all_nodes(bufnr, filter, summary)
if should_unload then
vim.api.nvim_buf_delete(bufnr, { unload = true })
end
lprint(all_nodes)
return all_nodes, length
end

@ -17,6 +17,7 @@ local golden_result = {
},
},
node_text = 'main',
indent = '',
range = {
['end'] = {
character = 12,
@ -38,6 +39,7 @@ local golden_result = {
full_text = 'func interfaceTest()',
kind = '',
lnum = 5,
indent = '',
node_scope = {
['end'] = {
character = 1,
@ -80,6 +82,8 @@ local golden_result = {
line = 4,
},
},
indent = ' ',
node_text = 'r',
range = {
['end'] = {
@ -113,6 +117,7 @@ local golden_result = {
},
},
node_text = 'c',
indent = ' ',
range = {
['end'] = {
character = 2,
@ -134,6 +139,7 @@ local golden_result = {
full_text = 'd := circle{radius: 10}',
kind = '',
lnum = 10,
indent = ' ',
node_scope = {
['end'] = {
character = 1,

Loading…
Cancel
Save