aboutsummaryrefslogtreecommitdiff
path: root/spec/write_rockspec_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--spec/write_rockspec_spec.lua73
1 files changed, 73 insertions, 0 deletions
diff --git a/spec/write_rockspec_spec.lua b/spec/write_rockspec_spec.lua
new file mode 100644
index 00000000..85e345d5
--- /dev/null
+++ b/spec/write_rockspec_spec.lua
@@ -0,0 +1,73 @@
1local test_env = require("test/test_environment")
2local lfs = require("lfs")
3local run = test_env.run
4
5test_env.unload_luarocks()
6
7describe("LuaRocks write_rockspec tests #blackbox #b_write_rockspec", function()
8
9 before_each(function()
10 test_env.setup_specs()
11 end)
12
13 describe("LuaRocks write_rockspec basic tests", function()
14 it("LuaRocks write_rockspec with no flags/arguments", function()
15 assert.is_true(run.luarocks_bool("write_rockspec"))
16 os.remove("luarocks-scm-1.rockspec")
17 end)
18
19 it("LuaRocks write_rockspec with invalid argument", function()
20 assert.is_false(run.luarocks_bool("write_rockspec invalid"))
21 end)
22
23 it("LuaRocks write_rockspec invalid zip", function()
24 assert.is_false(run.luarocks_bool("write_rockspec http://example.com/invalid.zip"))
25 end)
26 end)
27
28 describe("LuaRocks write_rockspec more complex tests", function()
29 it("LuaRocks write_rockspec git luarocks", function()
30 assert.is_true(run.luarocks_bool("write_rockspec git://github.com/keplerproject/luarocks"))
31 assert.is.truthy(lfs.attributes("luarocks-scm-1.rockspec"))
32 assert.is_true(os.remove("luarocks-scm-1.rockspec"))
33 end)
34
35 it("LuaRocks write_rockspec git luarocks --tag=v2.3.0", function()
36 assert.is_true(run.luarocks_bool("write_rockspec git://github.com/keplerproject/luarocks --tag=v2.3.0"))
37 assert.is.truthy(lfs.attributes("luarocks-2.3.0-1.rockspec"))
38 assert.is_true(os.remove("luarocks-2.3.0-1.rockspec"))
39 end)
40
41 it("LuaRocks write_rockspec git luarocks with format flag", function()
42 assert.is_true(run.luarocks_bool("write_rockspec git://github.com/mbalmer/luarocks --rockspec-format=1.1 --lua-version=5.1,5.2"))
43 assert.is.truthy(lfs.attributes("luarocks-scm-1.rockspec"))
44 assert.is_true(os.remove("luarocks-scm-1.rockspec"))
45 end)
46
47 it("LuaRocks write_rockspec git luarocks with full flags", function()
48 assert.is_true(run.luarocks_bool("write_rockspec git://github.com/mbalmer/luarocks --lua-version=5.1,5.2 --license=\"MIT/X11\" "
49 .. " --homepage=\"http://www.luarocks.org\" --summary=\"A package manager for Lua modules\" "))
50 assert.is.truthy(lfs.attributes("luarocks-scm-1.rockspec"))
51 assert.is_true(os.remove("luarocks-scm-1.rockspec"))
52 end)
53
54 it("LuaRocks write_rockspec rockspec via http", function()
55 assert.is_true(run.luarocks_bool("write_rockspec http://luarocks.org/releases/luarocks-2.1.0.tar.gz --lua-version=5.1"))
56 assert.is.truthy(lfs.attributes("luarocks-2.1.0-1.rockspec"))
57 assert.is_true(os.remove("luarocks-2.1.0-1.rockspec"))
58 end)
59
60 it("LuaRocks write_rockspec base dir, luassert.tar.gz via https", function()
61 assert.is_true(run.luarocks_bool("write_rockspec https://github.com/downloads/Olivine-Labs/luassert/luassert-1.2.tar.gz --lua-version=5.1"))
62 assert.is.truthy(lfs.attributes("luassert-1.2-1.rockspec"))
63 assert.is_true(os.remove("luassert-1.2-1.rockspec"))
64 end)
65
66 it("LuaRocks write_rockspec git luafcgi with many flags", function()
67 assert.is_true(run.luarocks_bool("write_rockspec git://github.com/mbalmer/luafcgi --lib=fcgi --license=\"3-clause BSD\" "
68 .. "--lua-version=5.1,5.2"))
69 assert.is.truthy(lfs.attributes("luafcgi-scm-1.rockspec")) -- TODO maybe read it content and find arguments from flags?
70 assert.is_true(os.remove("luafcgi-scm-1.rockspec"))
71 end)
72 end)
73end)