all repos

gopher.nvim @ 6a3924cee5a9f36d316f8e4a90c3020438d3513f

Minimalistic plugin for Go development

gopher.nvim/spec/integration/json2go_test.lua(view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
local t = require "spec.testutils"
local child, T, json2go = t.setup "json2go"

json2go["should convert interativly"] = function()
  local rs = t.setup_test("json2go/interativly", child, { 2, 0 })
  child.cmd "GoJson"
  child.type_keys [[{"json": true}]]
  child.type_keys "<Esc>"
  child.cmd "wq" -- quit prompt
  child.cmd "write" -- the fixture file

  t.eq(t.readfile(rs.tmp), rs.fixtures.output)
  t.cleanup(rs)
end

json2go["should convert argument"] = function()
  local rs = t.setup_test("json2go/manual", child, { 2, 0 })
  child.cmd [[GoJson {"user": {"name": "user-ovic"}}]]
  child.cmd "write"

  t.eq(t.readfile(rs.tmp), rs.fixtures.output)
  t.cleanup(rs)
end

return T