aboutsummaryrefslogtreecommitdiff
path: root/spec/show_spec.lua
blob: d07fdc31da573285065e75027e1f66e22881d72a (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
local test_env = require("test/test_environment")
local run = test_env.run

test_env.unload_luarocks()

describe("LuaRocks show tests #blackbox #b_show", function()
   
   before_each(function()
      test_env.setup_specs()
   end)

   it("LuaRocks show with no flags/arguments", function()
         assert.is_false(run.luarocks_bool("show"))
   end)
   
   describe("LuaRocks show basic tests with flags", function()
      it("LuaRocks show invalid", function()
         assert.is_false(run.luarocks_bool("show invalid"))
      end)
      
      it("LuaRocks show luacov", function()
         local output = run.luarocks("show luacov")
         assert.is.truthy(output:match("LuaCov"))
      end)

      it("LuaRocks show luacov with uppercase name", function()
         local output = run.luarocks("show LuaCov")
         assert.is.truthy(output:match("LuaCov"))
      end)
      
      it("LuaRocks show modules of luacov", function()
         local output = run.luarocks("show --modules luacov")
         assert.is.truthy(output:match("luacovluacov.defaultsluacov.reporterluacov.reporter.defaultluacov.runnerluacov.statsluacov.tick"))
      end)
      
      it("LuaRocks show dependencies of luacov", function()
         local output = run.luarocks("show --deps luacov")
      end)
      
      it("LuaRocks show rockspec of luacov", function()
         local output = run.luarocks("show --rockspec luacov")
         assert.is.truthy(output:match("luacov--0.11.0--1.rockspec"))
      end)
      
      it("LuaRocks show mversion of luacov", function()
         local output = run.luarocks("show --mversion luacov")
         assert.is.truthy(output:match("0.11.0--1"))
      end)
      
      it("LuaRocks show rock tree of luacov", function()
         local output = run.luarocks("show --rock-tree luacov")
      end)
      
      it("LuaRocks show rock directory of luacov", function()
         local output = run.luarocks("show --rock-dir luacov")
      end)
   end)

   it("LuaRocks show old version of luacov", function()
      run.luarocks("install luacov 0.11.0")
      run.luarocks_bool("show luacov 0.11.0")
   end)
end)