feat(struct_tags): add range support
This commit is contained in:
parent
ca1d4fda88
commit
46725147f7
7 changed files with 132 additions and 23 deletions
14
spec/fixtures/tags/add_range_input.go
vendored
Normal file
14
spec/fixtures/tags/add_range_input.go
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package main
|
||||
|
||||
type Test struct {
|
||||
ID int
|
||||
Name string
|
||||
Num int64
|
||||
Cost int
|
||||
Thingy []string
|
||||
Testing int
|
||||
Another struct {
|
||||
First int
|
||||
Second string
|
||||
}
|
||||
}
|
||||
14
spec/fixtures/tags/add_range_output.go
vendored
Normal file
14
spec/fixtures/tags/add_range_output.go
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package main
|
||||
|
||||
type Test struct {
|
||||
ID int
|
||||
Name string `gopher:"name"`
|
||||
Num int64 `gopher:"num"`
|
||||
Cost int `gopher:"cost"`
|
||||
Thingy []string
|
||||
Testing int
|
||||
Another struct {
|
||||
First int
|
||||
Second string
|
||||
}
|
||||
}
|
||||
14
spec/fixtures/tags/remove_range_input.go
vendored
Normal file
14
spec/fixtures/tags/remove_range_input.go
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package main
|
||||
|
||||
type Test struct {
|
||||
ID int `asdf:"id"`
|
||||
Name string `asdf:"name"`
|
||||
Num int64 `asdf:"num"`
|
||||
Cost int `asdf:"cost"`
|
||||
Thingy []string `asdf:"thingy"`
|
||||
Testing int `asdf:"testing"`
|
||||
Another struct {
|
||||
First int `asdf:"first"`
|
||||
Second string `asdf:"second"`
|
||||
} `asdf:"another"`
|
||||
}
|
||||
14
spec/fixtures/tags/remove_range_output.go
vendored
Normal file
14
spec/fixtures/tags/remove_range_output.go
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package main
|
||||
|
||||
type Test struct {
|
||||
ID int `asdf:"id"`
|
||||
Name string `asdf:"name"`
|
||||
Num int64
|
||||
Cost int
|
||||
Thingy []string
|
||||
Testing int `asdf:"testing"`
|
||||
Another struct {
|
||||
First int `asdf:"first"`
|
||||
Second string `asdf:"second"`
|
||||
} `asdf:"another"`
|
||||
}
|
||||
|
|
@ -78,4 +78,22 @@ struct_tags["should add tags on short declr var"] = function()
|
|||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
struct_tags["should add tag with range"] = function()
|
||||
local rs = t.setup_test("tags/add_range", child, { 5, 1 })
|
||||
child.cmd ".,+2GoTagAdd gopher"
|
||||
child.cmd "write"
|
||||
|
||||
t.eq(t.readfile(rs.tmp), rs.fixtures.output)
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
struct_tags["should remove tag with range"] = function()
|
||||
local rs = t.setup_test("tags/remove_range", child, { 6, 1 })
|
||||
child.cmd ".,+2GoTagRm asdf"
|
||||
child.cmd "write"
|
||||
|
||||
t.eq(t.readfile(rs.tmp), rs.fixtures.output)
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
return T
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue