aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2016-07-14 14:43:42 -0300
committerGitHub <noreply@github.com>2016-07-14 14:43:42 -0300
commit36388709d628a76c450eed20b67f008faefc36cb (patch)
treee9e8a6959ecafcd8355b8b9614f65a613fe6ddb4 /test
parent0f63a95e991435c769584abd01b16bd748a1434b (diff)
parent48b98f0c099dc621e1f93cccf9a9e03ff75649b6 (diff)
downloadluarocks-36388709d628a76c450eed20b67f008faefc36cb.tar.gz
luarocks-36388709d628a76c450eed20b67f008faefc36cb.tar.bz2
luarocks-36388709d628a76c450eed20b67f008faefc36cb.zip
Merge pull request #588 from robooo/new-tests
New tests
Diffstat (limited to 'test')
-rw-r--r--test/test_environment.lua23
-rw-r--r--test/testfiles/invalid_validate-args-1.5.4-1.rockspec35
2 files changed, 47 insertions, 11 deletions
diff --git a/test/test_environment.lua b/test/test_environment.lua
index 6de7a4e2..eb545a47 100644
--- a/test/test_environment.lua
+++ b/test/test_environment.lua
@@ -14,6 +14,7 @@ USAGE
14ARGUMENTS 14ARGUMENTS
15 env=<type> Set type of environment to use ("minimal" or "full", 15 env=<type> Set type of environment to use ("minimal" or "full",
16 default: "minimal"). 16 default: "minimal").
17 noreset Don't reset environment after each test
17 clean Remove existing testing environment. 18 clean Remove existing testing environment.
18 travis Add if running on TravisCI. 19 travis Add if running on TravisCI.
19 os=<type> Set OS ("linux", "osx", or "windows"). 20 os=<type> Set OS ("linux", "osx", or "windows").
@@ -96,10 +97,13 @@ end
96function test_env.set_args() 97function test_env.set_args()
97 -- if at least Lua/LuaJIT version argument was found on input start to parse other arguments to env. variables 98 -- if at least Lua/LuaJIT version argument was found on input start to parse other arguments to env. variables
98 test_env.TYPE_TEST_ENV = "minimal" 99 test_env.TYPE_TEST_ENV = "minimal"
100 test_env.RESET_ENV = true
99 101
100 for _, argument in ipairs(arg) do 102 for _, argument in ipairs(arg) do
101 if argument:find("^env=") then 103 if argument:find("^env=") then
102 test_env.TYPE_TEST_ENV = argument:match("^env=(.*)$") 104 test_env.TYPE_TEST_ENV = argument:match("^env=(.*)$")
105 elseif argument == "noreset" then
106 test_env.RESET_ENV = false
103 elseif argument == "clean" then 107 elseif argument == "clean" then
104 test_env.TEST_ENV_CLEAN = true 108 test_env.TEST_ENV_CLEAN = true
105 elseif argument == "travis" then 109 elseif argument == "travis" then
@@ -333,6 +337,7 @@ local function reset_environment(testing_paths, md5sums)
333 test_env.remove_dir(testing_paths.testing_tree) 337 test_env.remove_dir(testing_paths.testing_tree)
334 execute_bool("cp -a " .. testing_paths.testing_tree_copy .. "/. " .. testing_paths.testing_tree) 338 execute_bool("cp -a " .. testing_paths.testing_tree_copy .. "/. " .. testing_paths.testing_tree)
335 end 339 end
340
336 if testing_sys_tree_md5 ~= md5sums.testing_sys_tree_copy_md5 then 341 if testing_sys_tree_md5 ~= md5sums.testing_sys_tree_copy_md5 then
337 test_env.remove_dir(testing_paths.testing_sys_tree) 342 test_env.remove_dir(testing_paths.testing_sys_tree)
338 execute_bool("cp -a " .. testing_paths.testing_sys_tree_copy .. "/. " .. testing_paths.testing_sys_tree) 343 execute_bool("cp -a " .. testing_paths.testing_sys_tree_copy .. "/. " .. testing_paths.testing_sys_tree)
@@ -403,21 +408,17 @@ function test_env.setup_specs(extra_rocks)
403 end 408 end
404 end 409 end
405 410
406 reset_environment(test_env.testing_paths, test_env.md5sums, test_env.env_variables) 411 if test_env.RESET_ENV then
412 reset_environment(test_env.testing_paths, test_env.md5sums, test_env.env_variables)
413 end
407end 414end
408 415
409--- Helper function for tests which needs luasocket installed 416--- Test if required rock is installed if not, install it
410function test_env.need_luasocket() 417function test_env.need_rock(rock)
411 if test_env.run.luarocks_nocov("show luasocket") then 418 if test_env.run.luarocks_nocov("show " .. rock) then
412 return true 419 return true
413 else 420 else
414 local testing_cache = test_env.testing_paths.testing_cache .. "/" 421 return test_env.run.luarocks_nocov("install " .. rock)
415 local luasocket_rock = "luasocket-3.0rc1-1." .. test_env.platform .. ".rock"
416 if not exists(testing_cache .. luasocket_rock) then
417 test_env.run.luarocks_nocov("build --pack-binary-rock luasocket 3.0rc1-1")
418 os.rename(luasocket_rock, testing_cache .. luasocket_rock)
419 end
420 return test_env.run.luarocks_nocov("install " .. testing_cache .. luasocket_rock)
421 end 422 end
422end 423end
423 424
diff --git a/test/testfiles/invalid_validate-args-1.5.4-1.rockspec b/test/testfiles/invalid_validate-args-1.5.4-1.rockspec
new file mode 100644
index 00000000..0b4d807d
--- /dev/null
+++ b/test/testfiles/invalid_validate-args-1.5.4-1.rockspec
@@ -0,0 +1,35 @@
1package = 'validate-args'
2version = '1.5.4-1'
3source = {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{++{
4 url = "https://bitbucket.org/djerius/validate.args/downloads/validate-args-1.5.4.tar.gz"
5}
6
7description = {
8 summary = "Function argument validation",
9 detailed = [[
10 validate.args is a Lua module that provides a framework for
11 validation of arguments to Lua functions as well as complex data
12 structures. The included validate.inplace module provides "live"
13 validation during assignment of values to elements in tables. ]],
14 license = "GPL-3",
15
16}
17
18dependencies = {
19 "lua >= 5.1"
20}
21
22build = {
23
24 type = "builtin",
25
26 modules = {
27 ["validate.args"] = "validate/args.lua",
28 ["validate.inplace"] = "validate/inplace.lua",
29 },
30
31 copy_directories = {
32 "doc", "tests"
33 }
34
35}