From 2f3c8648289bb4e22eee5f8ff8d27afca6592fa4 Mon Sep 17 00:00:00 2001 From: roboo Date: Sun, 21 Aug 2016 21:50:38 +0200 Subject: Windows and appveyor support for tests --- spec/make_spec.lua | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'spec/make_spec.lua') diff --git a/spec/make_spec.lua b/spec/make_spec.lua index e684033a..624badff 100644 --- a/spec/make_spec.lua +++ b/spec/make_spec.lua @@ -6,9 +6,9 @@ local testing_paths = test_env.testing_paths test_env.unload_luarocks() local extra_rocks = { - "/lpeg-0.12-1.src.rock", - "/luasocket-3.0rc1-1.src.rock", - "/luasocket-3.0rc1-1.rockspec", + "lpeg-1.0.0-1.rockspec", + "/luasocket-3.0rc1-2.src.rock", + "/luasocket-3.0rc1-2.rockspec", "/lxsh-0.8.6-2.src.rock", "/lxsh-0.8.6-2.rockspec" } @@ -27,19 +27,19 @@ describe("LuaRocks make tests #blackbox #b_make", function() it("LuaRocks make with rockspec", function() -- make luasocket - assert.is_true(run.luarocks_bool("download --source luasocket 3.0rc1-1")) - assert.is_true(run.luarocks_bool("unpack luasocket-3.0rc1-1.src.rock")) - lfs.chdir("luasocket-3.0rc1-1/luasocket-3.0-rc1/") - assert.is_true(run.luarocks_bool(test_env.quiet("make luasocket-3.0rc1-1.rockspec"))) + assert.is_true(run.luarocks_bool("download --source luasocket 3.0rc1-2")) + assert.is_true(run.luarocks_bool("unpack luasocket-3.0rc1-2.src.rock")) + lfs.chdir("luasocket-3.0rc1-2/luasocket-3.0-rc1/") + assert.is_true(run.luarocks_bool(test_env.quiet("make luasocket-3.0rc1-2.rockspec"))) -- test it assert.is_true(run.luarocks_bool(test_env.quiet("show luasocket"))) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket/3.0rc1-2/luasocket-3.0rc1-2.rockspec")) -- delete downloaded and unpacked files lfs.chdir(testing_paths.luarocks_dir) - test_env.remove_dir("luasocket-3.0rc1-1") - assert.is_true(os.remove("luasocket-3.0rc1-1.src.rock")) + test_env.remove_dir("luasocket-3.0rc1-2") + assert.is_true(os.remove("luasocket-3.0rc1-2.src.rock")) end) describe("LuaRocks making rockspecs (using lxsh)", function() @@ -61,33 +61,36 @@ describe("LuaRocks make tests #blackbox #b_make", function() assert.is_true(run.luarocks_bool("new_version lxsh-0.8.6-2.rockspec")) assert.is_true(run.luarocks_bool("make")) - assert.is_true(run.luarocks_bool(test_env.quiet("show lxsh"))) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) + assert.is_true(run.luarocks_bool("show lxsh")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-3/lxsh-0.8.6-3.rockspec")) end) it("LuaRocks make unnamed rockspec", function() - os.execute("cp lxsh-0.8.6-2.rockspec rockspec") --rewrite with lfs + test_env.copy("lxsh-0.8.6-2.rockspec", "rockspec") assert.is_true(run.luarocks_bool("make")) assert.is_true(run.luarocks_bool(test_env.quiet("show lxsh"))) - assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) + assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) + os.remove("rockspec") end) it("LuaRocks make ambiguous rockspec", function() assert.is.truthy(os.rename("lxsh-0.8.6-2.rockspec", "lxsh2-0.8.6-2.rockspec")) - assert.is_false(run.luarocks_bool("make")) + local output = run.luarocks("make") + assert.is.truthy(output:match("Error: Inconsistency between rockspec filename")) assert.is_false(run.luarocks_bool("show lxsh")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) end) - + it("LuaRocks make ambiguous unnamed rockspec", function() assert.is.truthy(os.rename("lxsh-0.8.6-2.rockspec", "1_rockspec")) - os.execute("cp 1_rockspec 2_rockspec") --rewrite with lfs - assert.is_false(run.luarocks_bool("make")) + test_env.copy("1_rockspec", "2_rockspec") + local output = run.luarocks("make") + assert.is.truthy(output:match("Error: Please specify which rockspec file to use")) assert.is_false(run.luarocks_bool("show lxsh")) - assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh")) + assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) end) it("LuaRocks make pack binary rock", function() -- cgit v1.2.3-55-g6feb