[mirror] Make your go dev experience better github.com/olexsmir/gopher.nvim
neovim golang
at main 1.0 kB view raw
1local t = require "spec.testutils" 2local child, T, impl = t.setup "impl" 3 4impl["should do impl with 'w io.Writer'"] = function() 5 local rs = t.setup_test("impl/writer", child, { 3, 0 }) 6 child.cmd "GoImpl w io.Writer" 7 child.cmd "write" 8 9 -- NOTE: since "impl" won't implement interface if it's already implemented i went with this hack 10 local rhs = rs.fixtures.output:gsub("Test2", "Test") 11 t.eq(t.readfile(rs.tmp), rhs) 12 t.cleanup(rs) 13end 14 15impl["should work with full input, 'r Read io.Reader'"] = function() 16 local rs = t.setup_test("impl/reader", child) 17 child.cmd "GoImpl r Read io.Reader" 18 child.cmd "write" 19 20 local rhs = rs.fixtures.output:gsub("Read2", "Read") 21 t.eq(t.readfile(rs.tmp), rhs) 22 t.cleanup(rs) 23end 24 25impl["should work with minimal input 'io.Closer'"] = function() 26 local rs = t.setup_test("impl/closer", child, { 3, 6 }) 27 child.cmd "GoImpl io.Closer" 28 child.cmd "write" 29 30 local rhs = rs.fixtures.output:gsub("Test2", "Test") 31 t.eq(t.readfile(rs.tmp), rhs) 32 t.cleanup(rs) 33end 34 35return T