test(impl): add test
This commit is contained in:
parent
7a8fd2e273
commit
1203550399
3 changed files with 25 additions and 0 deletions
3
spec/fixtures/impl/impl_input.go
vendored
Normal file
3
spec/fixtures/impl/impl_input.go
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
package main
|
||||
|
||||
type Tester struct{}
|
||||
8
spec/fixtures/impl/impl_output.go
vendored
Normal file
8
spec/fixtures/impl/impl_output.go
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
package main
|
||||
|
||||
type Tester2 struct{}
|
||||
|
||||
func (w *Tester2) Write(p []byte) (n int, err error) {
|
||||
panic("not implemented") // TODO: Implement
|
||||
}
|
||||
|
||||
|
|
@ -10,5 +10,19 @@ local T = MiniTest.new_set {
|
|||
},
|
||||
}
|
||||
T["impl"] = MiniTest.new_set {}
|
||||
T["impl"]["works"] = function()
|
||||
local tmp = t.tmpfile()
|
||||
local fixtures = t.fixtures.read "impl/impl"
|
||||
t.fixtures.write(tmp, fixtures.input)
|
||||
|
||||
child.cmd("silent edit " .. tmp)
|
||||
child.fn.setpos(".", { child.fn.bufnr "%", 3, 6, 0 })
|
||||
child.cmd "GoImpl w io.Writer"
|
||||
child.cmd "write"
|
||||
|
||||
-- since "impl" won't implement interface if it's already implemented i went with this hack
|
||||
local rhs = fixtures.output:gsub("Tester2", "Tester")
|
||||
t.eq(t.readfile(tmp), rhs)
|
||||
end
|
||||
|
||||
return T
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue