~neovim-ppa/neovim-ppa/neovim-deps

« back to all changes in this revision

Viewing changes to src/luarocks/spec/path_spec.lua

  • Committer: marvim
  • Date: 2019-11-20 19:31:13 UTC
  • Revision ID: git-v1:05e23393a43f6bf89e88d314ff4fc374062fcb30
deps src: Automatic update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
local test_env = require("test/test_environment")
 
1
local test_env = require("spec.util.test_env")
2
2
local run = test_env.run
3
3
 
4
4
test_env.unload_luarocks()
5
5
 
6
 
describe("LuaRocks path tests #blackbox #b_path", function()
 
6
describe("LuaRocks path tests #integration", function()
7
7
   before_each(function()
8
8
      test_env.setup_specs()
9
9
   end)
10
10
 
 
11
   it("LuaRocks path", function()
 
12
      local output = run.luarocks("path")
 
13
      assert.match("LUA_PATH=", output)
 
14
      assert.match("LUA_CPATH=", output)
 
15
   end)
 
16
 
 
17
   if _VERSION:match("[23]") then
 
18
      local v = _VERSION:gsub("Lua (%d+)%.(%d+)", "%1_%2")
 
19
   
 
20
      it("LuaRocks path with LUA_PATH_"..v, function()
 
21
         local output = run.luarocks("path", {
 
22
            ["LUA_PATH_"..v] = package.path,
 
23
         })
 
24
         assert.match("LUA_PATH_"..v.."=", output)
 
25
      end)
 
26
 
 
27
      it("LuaRocks path with LUA_CPATH_"..v, function()
 
28
         local output = run.luarocks("path", {
 
29
            ["LUA_CPATH_"..v] = package.cpath,
 
30
         })
 
31
         assert.match("LUA_CPATH_"..v.."=", output)
 
32
      end)
 
33
 
 
34
      it("LuaRocks path with LUA_PATH_"..v.." and LUA_CPATH_"..v, function()
 
35
         local output = run.luarocks("path", {
 
36
            ["LUA_PATH_"..v]  = package.path,
 
37
            ["LUA_CPATH_"..v] = package.cpath,
 
38
         })
 
39
         assert.match("LUA_PATH_"..v.."=", output)
 
40
         assert.match("LUA_CPATH_"..v.."=", output)
 
41
      end)
 
42
 
 
43
   end
 
44
 
11
45
   it("LuaRocks path bin", function()
12
46
      assert.is_true(run.luarocks_bool("path --bin"))
13
47
   end)
23
57
   it("LuaRocks path with tree", function()
24
58
      assert.is_true(run.luarocks_bool("path --tree=lua_modules"))
25
59
   end)
 
60
   
 
61
   it("LuaRocks path with project-tree", function()
 
62
      local path1 = "/share/lua/5%." .. test_env.lua_version:sub(3, 3) .. "/%?%.lua"
 
63
      local path2 = "/share/lua/5%." .. test_env.lua_version:sub(3, 3) .. "/%?/init%.lua"
 
64
      
 
65
      local path = run.luarocks("path --project-tree=foo")
 
66
      assert.truthy(path:find("foo" .. path1))
 
67
      assert.truthy(path:find("foo" .. path2))
 
68
      
 
69
      path = run.luarocks("path --project-tree=foo --tree=bar")
 
70
      assert.falsy(path:find("foo" .. path1))
 
71
      assert.falsy(path:find("foo" .. path2))
 
72
      assert.truthy(path:find("bar" .. path1))
 
73
      assert.truthy(path:find("bar" .. path2))
 
74
   end)
26
75
end)