revert changes to golden file

pull/163/head
ray-x 2 years ago
parent 8021f2a484
commit eaec8c45f2

@ -52,6 +52,9 @@ local run = function(opts)
ifname = optarg["i"]
end
if optarg["s"] ~= nil then
ifname = ""
end
local fpath = utils.rel_path(true) -- rel/path/only
log(fpath, mockgen_cmd)
local sname = vfn.expand("%:t") -- name.go only
@ -72,6 +75,9 @@ local run = function(opts)
local pkg = require("go.package").pkg_from_path(nil, bufnr)
if pkg ~= nil and type(pkg) == "table" and pkg[1] then
table.insert(mockgen_cmd, pkg[1])
else
utils.notify("no package found, using .")
table.insert(mockgen_cmd, '.')
end
table.insert(mockgen_cmd, ifname)
end

@ -3,53 +3,46 @@
package main
import (
"fmt"
"math"
"reflect"
"fmt"
"math"
)
type Geometry interface {
Area() float64
perim() float64
Area() float64
perim() float64
}
type rect struct {
width, height float64
width, height float64
}
type circle struct {
radius float64
radius float64
}
func (r rect) Area() float64 {
return r.width * r.height
return r.width * r.height
}
func (r rect) perim() float64 {
return 2*r.width + 2*r.height
return 2*r.width + 2*r.height
}
func (c circle) Area() float64 {
return math.Pi * c.radius * c.radius
return math.Pi * c.radius * c.radius
}
func (c circle) perim() float64 {
return 2 * math.Pi * c.radius
return 2 * math.Pi * c.radius
}
func measure(g Geometry) {
fmt.Println(g)
fmt.Println(g.Area())
fmt.Println(g.perim())
fmt.Println(g)
fmt.Println(g.Area())
fmt.Println(g.perim())
}
func main() {
r := rect{width: 3, height: 4}
c := circle{radius: 5}
var b Geometry = rect{}
fmt.Println(reflect.TypeOf(b).PkgPath())
r := rect{width: 3, height: 4}
c := circle{radius: 5}
measure(r)
measure(c)
measure(r)
measure(c)
}

@ -16,7 +16,6 @@ describe("should run mockgen", function()
it("should run mockgen", function()
--
local path = cur_dir .. "/lua/tests/fixtures/ts/interfaces.go" -- %:p:h ? %:p
local got = "pkg/mocks/mock_interface.go"
local cmd = " silent exe 'e " .. path .. "'"
vim.cmd(cmd)
vim.cmd("cd lua/tests/fixtures/ts")
@ -27,7 +26,7 @@ describe("should run mockgen", function()
vim.bo.filetype = "go"
local gomockgen = require("go.mockgen")
local cmd = gomockgen.run({ args = { "-s" } })
cmd = gomockgen.run({ args = { "-s" } })
-- vim.wait(400, function() end)
local expected_cmd = {

Loading…
Cancel
Save