File: expand_rockspec_spec.lua

package info (click to toggle)
luacheck 0.17.1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 968 kB
  • ctags: 731
  • sloc: python: 35; makefile: 18
file content (30 lines) | stat: -rw-r--r-- 949 bytes parent folder | download
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
local expand_rockspec = require "luacheck.expand_rockspec"

describe("expand_rockspec", function()
   it("returns sorted array of lua files related to a rock", function()
      assert.same({
         "bar.lua",
         "baz.lua",
         "bin.lua",
         "foo.lua"
      }, expand_rockspec("spec/folder/rockspec"))
   end)

   it("returns nil, \"I/O\" for non-existent paths", function()
      local ok, err = expand_rockspec("spec/folder/non-existent")
      assert.is_nil(ok)
      assert.equal("I/O", err)
   end)

   it("returns nil, \"syntax\" for rockspecs with syntax errors", function()
      local ok, err = expand_rockspec("spec/folder/bad_config")
      assert.is_nil(ok)
      assert.equal("syntax", err)
   end)

   it("returns nil, \"runtime\" for rockspecs with run-time errors", function()
      local ok, err = expand_rockspec("spec/folder/bad_rockspec")
      assert.is_nil(ok)
      assert.equal("runtime", err)
   end)
end)