feat(comment): add comment on a variable
This commit is contained in:
parent
9bffa2c212
commit
094afb2c21
7 changed files with 45 additions and 0 deletions
5
spec/fixtures/comment/svar_input.go
vendored
Normal file
5
spec/fixtures/comment/svar_input.go
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
package main
|
||||
|
||||
func varTest() {
|
||||
s := "something"
|
||||
}
|
||||
6
spec/fixtures/comment/svar_output.go
vendored
Normal file
6
spec/fixtures/comment/svar_output.go
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
package main
|
||||
|
||||
func varTest() {
|
||||
// s
|
||||
s := "something"
|
||||
}
|
||||
5
spec/fixtures/comment/var_input.go
vendored
Normal file
5
spec/fixtures/comment/var_input.go
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
package main
|
||||
|
||||
func test() {
|
||||
var imAVar string
|
||||
}
|
||||
6
spec/fixtures/comment/var_output.go
vendored
Normal file
6
spec/fixtures/comment/var_output.go
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
package main
|
||||
|
||||
func test() {
|
||||
// imAVar
|
||||
var imAVar string
|
||||
}
|
||||
|
|
@ -50,6 +50,14 @@ comment["should add a comment on interface with many method"] = function()
|
|||
do_the_test("interface_many_method", { 5, 2 })
|
||||
end
|
||||
|
||||
comment["should add a comment on a var"] = function()
|
||||
do_the_test("var", { 4, 2 })
|
||||
end
|
||||
|
||||
comment["should add a comment on a short declared var"] = function()
|
||||
do_the_test("svar", { 4, 8 })
|
||||
end
|
||||
|
||||
comment["otherwise should add // above cursor"] = function()
|
||||
do_the_test("empty", { 1, 1 })
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue