test(struct_tags): add remove test

This commit is contained in:
Oleksandr Smirnov 2025-02-17 19:59:00 +02:00
parent effd7e4b3d
commit 7a8fd2e273
No known key found for this signature in database
2 changed files with 19 additions and 7 deletions

View file

@ -1,11 +1,11 @@
package main package main
type Test struct { type Test struct {
ID int ID int
Name string Name string
Num int64 Num int64
Another struct { Another struct {
First int First int
Second string Second string
} }
} }

View file

@ -10,7 +10,7 @@ local T = MiniTest.new_set {
}, },
} }
T["struct_tags"] = MiniTest.new_set {} T["struct_tags"] = MiniTest.new_set {}
T["struct_tags"][".add"] = function() T["struct_tags"]["add"] = function()
local tmp = t.tmpfile() local tmp = t.tmpfile()
local fixtures = t.fixtures.read "tags/add" local fixtures = t.fixtures.read "tags/add"
t.fixtures.write(tmp, fixtures.input) t.fixtures.write(tmp, fixtures.input)
@ -22,4 +22,16 @@ T["struct_tags"][".add"] = function()
t.eq(t.readfile(tmp), fixtures.output) t.eq(t.readfile(tmp), fixtures.output)
end end
T["struct_tags"]["remove"] = function()
local tmp = t.tmpfile()
local fixtures = t.fixtures.read "tags/remove"
t.fixtures.write(tmp, fixtures.input)
child.cmd("silent edit " .. tmp)
child.fn.setpos(".", { child.fn.bufnr "%", 4, 6, 0 })
child.cmd "GoTagRm json"
t.eq(t.readfile(tmp), fixtures.output)
end
return T return T