summaryrefslogtreecommitdiff
path: root/tests/unit/parsers_spec.lua
blob: d40578b87be1052988a8650bef8a426e1c57e0cf (plain)
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
42
43
44
45
46
local stub = require "luassert.stub"
local parsers = require "nvim-treesitter.parsers"

describe("maintained_parsers", function()
  before_each(function()
    stub(vim.fn, "executable")
  end)

  after_each(function()
    vim.fn.executable:clear()
  end)

  it("does not return experimental parsers", function()
    local old_list = parsers.list
    parsers.list = {
      c = {
        install_info = {
          url = "https://github.com/tree-sitter/tree-sitter-c",
          files = { "src/parser.c" },
        },
        maintainers = { "@vigoux" },
      },
      d = {
        install_info = {
          url = "https://github.com/CyberShadow/tree-sitter-d",
          files = { "src/parser.c", "src/scanner.cc" },
          requires_generate_from_grammar = true,
        },
        maintainers = { "@nawordar" },
        experimental = true,
      },
      haskell = {
        install_info = {
          url = "https://github.com/tree-sitter/tree-sitter-haskell",
          files = { "src/parser.c", "src/scanner.cc" },
        },
      },
    }

    local expected = { "c" }

    assert.same(parsers.maintained_parsers(), expected)

    parsers.list = old_list
  end)
end)