all repos

gopher.nvim @ 80d06594259db519cfd047407d30a9871f0fe936

Minimalistic plugin for Go development

gopher.nvim/spec/gopher_config_spec.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
describe("gopher.config", function()
  it("can be required", function()
    require "gopher.config"
  end)

  it(".setup() when gets empty table not edit config", function()
    local c = require "gopher.config"
    c.setup {}

    assert.are.same(c.config.commands.go, "go")
    assert.are.same(c.config.commands.gomodifytags, "gomodifytags")
    assert.are.same(c.config.commands.gotests, "gotests")
    assert.are.same(c.config.commands.impl, "impl")
  end)

  it(".setup() when get one custom value sets that", function()
    local c = require "gopher.config"
    c.setup { commands = {
      go = "custom_go",
    } }

    assert.are.same(c.config.commands.go, "custom_go")
  end)

  it(".setup() when get all custom values sets it", function()
    local c = require "gopher.config"
    c.setup {
      commands = {
        go = "go1.18",
        gomodifytags = "user-gomodifytags",
        gotests = "gotests",
        impl = "goimpl",
      },
    }

    assert.are.same(c.config.commands.go, "go1.18")
    assert.are.same(c.config.commands.gomodifytags, "user-gomodifytags")
    assert.are.same(c.config.commands.gotests, "gotests")
    assert.are.same(c.config.commands.impl, "goimpl")
  end)
end)