aboutsummaryrefslogtreecommitdiff
path: root/spec/doc_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/doc_spec.lua')
-rw-r--r--spec/doc_spec.lua71
1 files changed, 71 insertions, 0 deletions
diff --git a/spec/doc_spec.lua b/spec/doc_spec.lua
new file mode 100644
index 00000000..a04d3c14
--- /dev/null
+++ b/spec/doc_spec.lua
@@ -0,0 +1,71 @@
1local test_env = require("test/test_environment")
2local run = test_env.run
3local testing_paths = test_env.testing_paths
4
5test_env.unload_luarocks()
6
7local extra_rocks = {
8 "/luarepl-0.4-1.src.rock",
9 "/c3-1.0-1.src.rock"
10}
11
12describe("LuaRocks doc tests #blackbox #b_doc", function()
13
14 before_each(function()
15 test_env.setup_specs(extra_rocks)
16 end)
17
18 describe("LuaRocks doc basic tests", function()
19 it("LuaRocks doc with no flags/arguments", function()
20 assert.is_false(run.luarocks_bool("doc"))
21 end)
22 it("LuaRocks doc with invalid argument", function()
23 assert.is_false(run.luarocks_bool("doc invalid"))
24 end)
25 it("LuaRocks doc with no homepage", function()
26 assert.is_true(run.luarocks_bool("install c3"))
27 assert.is_false(run.luarocks_bool("doc c3 --home"))
28 end)
29 it("LuaRocks doc with no home page and no doc folder", function()
30 assert.is_true(run.luarocks_bool("install c3"))
31 test_env.remove_dir(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/c3/1.0-1/doc")
32 assert.is_false(run.luarocks_bool("doc c3"))
33 end)
34 it("LuaRocks doc with no doc folder opening descript.homepage", function()
35 assert.is_true(run.luarocks_bool("install luarepl"))
36 test_env.remove_dir(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luarepl/0.4-1/doc")
37 local output = run.luarocks("doc luarepl")
38 assert.is.truthy(output:find("Local documentation directory not found"))
39 end)
40 end)
41
42 describe("LuaRocks doc tests with flags", function()
43 it("LuaRocks doc of installed luarepl", function()
44 assert.is_true(run.luarocks_bool("install luarepl"))
45 assert.is_true(run.luarocks_bool("doc luarepl"))
46 end)
47
48 it("LuaRocks doc of luacov and access its home page", function()
49 assert.is_true(run.luarocks_bool("install luacov"))
50 assert.is_true(run.luarocks_bool("doc luacov --home"))
51 end)
52
53 it("LuaRocks doc of luacov and list doc folder", function()
54 assert.is_true(run.luarocks_bool("install luacov"))
55 local output = assert.is.truthy(run.luarocks("doc luacov --list"))
56 assert.is.truthy(output:find("/lib/luarocks/rocks/luacov/0.11.0--1/doc/"))
57 end)
58
59 it("LuaRocks doc of luacov local", function()
60 assert.is_true(run.luarocks_bool("install luacov"))
61 assert.is_true(run.luarocks_bool("doc luacov --local"))
62 end)
63
64 it("LuaRocks doc of luacov porcelain", function()
65 assert.is_true(run.luarocks_bool("install luacov"))
66 assert.is_true(run.luarocks_bool("doc luacov --porcelain"))
67 end)
68 end)
69end)
70
71