aboutsummaryrefslogtreecommitdiff
path: root/spec/unpack_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unpack_spec.lua')
-rw-r--r--spec/unpack_spec.lua58
1 files changed, 58 insertions, 0 deletions
diff --git a/spec/unpack_spec.lua b/spec/unpack_spec.lua
new file mode 100644
index 00000000..76e9e5a8
--- /dev/null
+++ b/spec/unpack_spec.lua
@@ -0,0 +1,58 @@
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 "/cprint-0.1-2.src.rock",
9 "/cprint-0.1-2.rockspec"
10}
11
12describe("LuaRocks unpack tests #blackbox #b_unpack", function()
13
14 before_each(function()
15 test_env.setup_specs(extra_rocks)
16 end)
17
18 describe("LuaRocks unpack basic fail tests", function()
19 it("LuaRocks unpack with no flags/arguments", function()
20 assert.is_false(run.luarocks_bool("unpack"))
21 end)
22 it("LuaRocks unpack with invalid rockspec", function()
23 assert.is_false(run.luarocks_bool("unpack invalid.rockspec"))
24 end)
25 it("LuaRocks unpack with invalid patch", function()
26 assert.is_false(run.luarocks_bool("unpack " .. testing_paths.testing_dir .. "/testfiles/invalid_patch-0.1-1.rockspec"))
27 end)
28 end)
29
30 describe("LuaRocks unpack more complex tests", function()
31 it("LuaRocks unpack download", function()
32 assert.is_true(run.luarocks_bool("unpack cprint"))
33 test_env.remove_dir("cprint-0.1-2")
34 end)
35 it("LuaRocks unpack src", function()
36 assert.is_true(run.luarocks_bool("download --source cprint"))
37 assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.src.rock"))
38 os.remove("cprint-0.1-2.src.rock")
39 test_env.remove_dir("cprint-0.1-2")
40 end)
41 it("LuaRocks unpack src", function()
42 assert.is_true(run.luarocks_bool("download --rockspec cprint"))
43 assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.rockspec"))
44 os.remove("cprint-0.1-2.rockspec")
45 os.remove("lua-cprint")
46 test_env.remove_dir("cprint-0.1-2")
47 end)
48 it("LuaRocks unpack binary", function()
49 assert.is_true(run.luarocks_bool("build cprint"))
50 assert.is_true(run.luarocks_bool("pack cprint"))
51 assert.is_true(run.luarocks_bool("unpack cprint-0.1-2." .. test_env.platform .. ".rock"))
52 test_env.remove_dir("cprint-0.1-2")
53 os.remove("cprint-0.1-2." .. test_env.platform .. ".rock")
54 end)
55 end)
56end)
57
58