feat(comment): add comment on a struct field
This commit is contained in:
parent
3cd45c45a3
commit
9bffa2c212
9 changed files with 100 additions and 7 deletions
18
spec/fixtures/comment/many_structs_fields_input.go
vendored
Normal file
18
spec/fixtures/comment/many_structs_fields_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
|
||||
}
|
||||
)
|
||||
19
spec/fixtures/comment/many_structs_fields_output.go
vendored
Normal file
19
spec/fixtures/comment/many_structs_fields_output.go
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package main
|
||||
|
||||
type (
|
||||
TestOne struct {
|
||||
Asdf string
|
||||
ID int
|
||||
}
|
||||
|
||||
TestTwo struct {
|
||||
// Fesa
|
||||
Fesa int
|
||||
A bool
|
||||
}
|
||||
|
||||
TestThree struct {
|
||||
Asufj int
|
||||
Fs string
|
||||
}
|
||||
)
|
||||
7
spec/fixtures/comment/struct_fields_input.go
vendored
Normal file
7
spec/fixtures/comment/struct_fields_input.go
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
package main
|
||||
|
||||
type CommentStruct struct {
|
||||
Name string
|
||||
Address string
|
||||
Aliases []string
|
||||
}
|
||||
8
spec/fixtures/comment/struct_fields_output.go
vendored
Normal file
8
spec/fixtures/comment/struct_fields_output.go
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
package main
|
||||
|
||||
type CommentStruct struct {
|
||||
Name string
|
||||
// Address
|
||||
Address string
|
||||
Aliases []string
|
||||
}
|
||||
8
spec/fixtures/comment/var_struct_fields_input.go
vendored
Normal file
8
spec/fixtures/comment/var_struct_fields_input.go
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
package main
|
||||
|
||||
func main() {
|
||||
var s struct {
|
||||
API string
|
||||
Key string
|
||||
}
|
||||
}
|
||||
9
spec/fixtures/comment/var_struct_fields_output.go
vendored
Normal file
9
spec/fixtures/comment/var_struct_fields_output.go
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
package main
|
||||
|
||||
func main() {
|
||||
var s struct {
|
||||
API string
|
||||
// Key
|
||||
Key string
|
||||
}
|
||||
}
|
||||
|
|
@ -18,6 +18,18 @@ comment["should add comment to struct"] = function()
|
|||
do_the_test("struct", { 4, 1 })
|
||||
end
|
||||
|
||||
comment["should add a comment on struct field"] = function()
|
||||
do_the_test("struct_fields", { 5, 8 })
|
||||
end
|
||||
|
||||
comment["should add a comment on var struct field"] = function()
|
||||
do_the_test("var_struct_fields", { 6, 4 })
|
||||
end
|
||||
|
||||
comment["should add a comment on one field of many structs"] = function()
|
||||
do_the_test("many_structs_fields", { 10, 4 })
|
||||
end
|
||||
|
||||
comment["should add comment to function"] = function()
|
||||
do_the_test("func", { 3, 1 })
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue