test(struct_tags): add remove test
This commit is contained in:
parent
effd7e4b3d
commit
7a8fd2e273
2 changed files with 19 additions and 7 deletions
12
spec/fixtures/tags/remove_output.go
vendored
12
spec/fixtures/tags/remove_output.go
vendored
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue