refactor: treesitter utils (#91)
* refactor(ts_utils): i dont know why event it was here * fix: typos * fix(struct_tags)!: remove statement that i used for debug * refactor(ts_util): start from scratch * refactor(struct_tags): use new ts_util * fixup! refactor(struct_tags): use new ts_util * test(struct_tags): add support for multiple structs * fix(gotests): use new api * fix(impl): refactor some logic, use new api * docs(ts): add an explanation * refactor(_utils.ts): all public methods are just adapters * fix(comment): now it works * fixup! refactor(_utils.ts): all public methods are just adapters * fixup! fixup! refactor(_utils.ts): all public methods are just adapters * test(comment): e2e * tests(comment): fix * refactor(utils.ts): fix, docs * test(comment): fix tests again * fix(tests/comments): well, now i fell stupid * refactor(ts): add assert just to be sure that all elements are in the result * fix(ts): type annotations * fix(ts): pass bufnr to vim.treesitter.get_node * chore(ci): disable nightly * chore(ci): reorganize
This commit is contained in:
parent
f171953e43
commit
e9f2eef5e7
31 changed files with 346 additions and 409 deletions
|
|
@ -5,23 +5,50 @@ local T = MiniTest.new_set {
|
|||
hooks = {
|
||||
post_once = child.stop,
|
||||
pre_case = function()
|
||||
MiniTest.skip "This module should be fixed first"
|
||||
child.restart { "-u", t.mininit_path }
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
local function do_the_test(fixture, pos)
|
||||
local tmp = t.tmpfile()
|
||||
local fixtures = t.get_fixtures("comment/" .. fixture)
|
||||
t.writefile(tmp, fixtures.input)
|
||||
|
||||
child.cmd("silent edit " .. tmp)
|
||||
child.fn.setpos(".", { child.fn.bufnr "%", unpack(pos) })
|
||||
child.cmd "GoCmt"
|
||||
child.cmd "write"
|
||||
|
||||
t.eq(t.readfile(tmp), fixtures.output)
|
||||
|
||||
-- without it all other(not even from this module) tests are falling
|
||||
t.deletefile(tmp)
|
||||
end
|
||||
|
||||
T["comment"] = MiniTest.new_set {}
|
||||
T["comment"]["should add comment to package"] = function()
|
||||
do_the_test("package", { 1, 1 })
|
||||
end
|
||||
|
||||
T["comment"]["should add comment to package"] = function() end
|
||||
T["comment"]["should add comment to struct"] = function()
|
||||
do_the_test("struct", { 4, 1 })
|
||||
end
|
||||
|
||||
T["comment"]["should add comment to struct"] = function() end
|
||||
T["comment"]["should add comment to function"] = function()
|
||||
do_the_test("func", { 3, 1 })
|
||||
end
|
||||
|
||||
T["comment"]["should add comment to function"] = function() end
|
||||
T["comment"]["should add comment to method"] = function()
|
||||
do_the_test("method", { 5, 1 })
|
||||
end
|
||||
|
||||
T["comment"]["should add comment to method"] = function() end
|
||||
T["comment"]["should add comment to interface"] = function()
|
||||
do_the_test("interface", { 3, 6 })
|
||||
end
|
||||
|
||||
T["comment"]["should add comment to interface"] = function() end
|
||||
|
||||
T["comment"]["otherwise should add // above cursor"] = function() end
|
||||
T["comment"]["otherwise should add // above cursor"] = function()
|
||||
do_the_test("empty", { 1, 1 })
|
||||
end
|
||||
|
||||
return T
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue