test(struct_tags): add support for multiple structs
This commit is contained in:
parent
59169df030
commit
59a0e961c4
4 changed files with 49 additions and 1 deletions
18
spec/fixtures/tags/many_input.go
vendored
Normal file
18
spec/fixtures/tags/many_input.go
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package main
|
||||
|
||||
type (
|
||||
TestOne struct {
|
||||
Asdf string
|
||||
ID int
|
||||
}
|
||||
|
||||
TestTwo struct {
|
||||
Fesa int
|
||||
A bool
|
||||
}
|
||||
|
||||
TestThree struct {
|
||||
Asufj int
|
||||
Fs string
|
||||
}
|
||||
)
|
||||
18
spec/fixtures/tags/many_output.go
vendored
Normal file
18
spec/fixtures/tags/many_output.go
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package main
|
||||
|
||||
type (
|
||||
TestOne struct {
|
||||
Asdf string
|
||||
ID int
|
||||
}
|
||||
|
||||
TestTwo struct {
|
||||
Fesa int `testing:"fesa"`
|
||||
A bool `testing:"a"`
|
||||
}
|
||||
|
||||
TestThree struct {
|
||||
Asufj int
|
||||
Fs string
|
||||
}
|
||||
)
|
||||
|
|
@ -34,4 +34,16 @@ T["struct_tags"]["works remove"] = function()
|
|||
t.eq(t.readfile(tmp), fixtures.output)
|
||||
end
|
||||
|
||||
T["struct_tags"]["works many structs"] = function()
|
||||
local tmp = t.tmpfile()
|
||||
local fixtures = t.get_fixtures "tags/many"
|
||||
t.writefile(tmp, fixtures.input)
|
||||
|
||||
child.cmd("silent edit " .. tmp)
|
||||
child.fn.setpos(".", { child.fn.bufnr "%", 10, 3, 0 })
|
||||
child.cmd "GoTagAdd testing"
|
||||
|
||||
t.eq(t.readfile(tmp), fixtures.output)
|
||||
end
|
||||
|
||||
return T
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue