aboutsummaryrefslogtreecommitdiff
path: root/spec/new_version_spec.lua
diff options
context:
space:
mode:
authorrobooo <robo.karasek@gmail.com>2016-07-07 21:58:19 +0200
committerHisham Muhammad <hisham@gobolinux.org>2016-07-07 16:58:19 -0300
commit5af7e0d7c2dcf65e41ae8523f3771e9528be32a7 (patch)
treebcd14624e0566a23da2e708675197d212cecf35d /spec/new_version_spec.lua
parentb5b285a678fe78b80d452cc9eb7565b8bf087b81 (diff)
downloadluarocks-5af7e0d7c2dcf65e41ae8523f3771e9528be32a7.tar.gz
luarocks-5af7e0d7c2dcf65e41ae8523f3771e9528be32a7.tar.bz2
luarocks-5af7e0d7c2dcf65e41ae8523f3771e9528be32a7.zip
New test-suite for LuaRocks (#581)
First version of new test-suite, using Busted framework based on Google Summer of Code project: https://summerofcode.withgoogle.com/projects/#5695811874717696 * Rewritten from Bash to Lua * Tests now check if they did what they were supposed to, beyond only checking success or failure of the `luarocks` command * Support for black-box (launching `luarocks` as an external command) and white-box (testing functions in modules directly) testing
Diffstat (limited to 'spec/new_version_spec.lua')
-rw-r--r--spec/new_version_spec.lua53
1 files changed, 53 insertions, 0 deletions
diff --git a/spec/new_version_spec.lua b/spec/new_version_spec.lua
new file mode 100644
index 00000000..57014226
--- /dev/null
+++ b/spec/new_version_spec.lua
@@ -0,0 +1,53 @@
1local test_env = require("test/test_environment")
2local lfs = require("lfs")
3
4test_env.unload_luarocks()
5local new_version = require("luarocks.new_version")
6
7local extra_rocks = {
8 "/abelhas-1.0-1.rockspec"
9}
10
11expose("LuaRocks new_version tests #blackbox #b_new_version", function()
12
13 before_each(function()
14 test_env.setup_specs(extra_rocks)
15 testing_paths = test_env.testing_paths
16 run = test_env.run
17 end)
18
19 describe("LuaRocks new_version basic tests", function()
20 it("LuaRocks new version with no flags/arguments", function()
21 lfs.chdir("test")
22 assert.is_false(run.luarocks_bool("new_version"))
23 lfs.chdir(testing_paths.luarocks_dir)
24 end)
25
26 it("LuaRocks new version invalid", function()
27 assert.is_false(run.luarocks_bool("new_version invalid"))
28 end)
29 end)
30
31 describe("LuaRocks new_version more complex tests", function()
32 it("LuaRocks new_version of luacov", function()
33 assert.is_true(run.luarocks_bool("download --rockspec luacov 0.11.0"))
34 assert.is_true(run.luarocks_bool("new_version luacov-0.11.0-1.rockspec 0.2"))
35 assert.is.truthy(lfs.attributes("luacov-0.2-1.rockspec"))
36 test_env.remove_files(lfs.currentdir(), "luacov--")
37 end)
38
39 it("LuaRocks new_version url of abelhas", function()
40 assert.is_true(run.luarocks_bool("download --rockspec abelhas 1.0"))
41 assert.is_true(run.luarocks_bool("new_version abelhas-1.0-1.rockspec 1.1 http://luaforge.net/frs/download.php/2658/abelhas-1.0.tar.gz"))
42 assert.is.truthy(lfs.attributes("abelhas-1.1-1.rockspec"))
43 test_env.remove_files(lfs.currentdir(), "abelhas--")
44 end)
45
46 it("LuaRocks new_version of luacov with tag", function()
47 assert.is_true(run.luarocks_bool("download --rockspec luacov 0.11.0"))
48 assert.is_true(run.luarocks_bool("new_version luacov-0.11.0-1.rockspec --tag v0.3"))
49 assert.is.truthy(lfs.attributes("luacov-0.3-1.rockspec"))
50 test_env.remove_files(lfs.currentdir(), "luacov--")
51 end)
52 end)
53end) \ No newline at end of file