From f1c9fd4895fe107683488c501bc07d4e22f46a4f Mon Sep 17 00:00:00 2001 From: roboo Date: Mon, 22 Aug 2016 13:40:03 +0200 Subject: Fix of config test --- spec/config_spec.lua | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'spec') diff --git a/spec/config_spec.lua b/spec/config_spec.lua index 439d0493..807b077a 100644 --- a/spec/config_spec.lua +++ b/spec/config_spec.lua @@ -61,7 +61,7 @@ describe("LuaRocks config tests #blackbox #b_config", function() end) end) - describe("LuaRocks config - more complex tests", function() + describe("LuaRocks config - more complex tests #special", function() local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks" local versioned_scname = scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua" local scname = scdir .. "/config.lua" @@ -74,9 +74,9 @@ describe("LuaRocks config tests #blackbox #b_config", function() end it("LuaRocks fail system config", function() - os.rename(versioned_scname, versioned_scname .. ".bak") + os.rename(configfile, configfile .. ".bak") assert.is_false(run.luarocks_bool("config --system-config")) - os.rename(versioned_scname .. ".bak", versioned_scname) + os.rename(configfile .. ".bak", configfile) end) it("LuaRocks system config", function() @@ -84,18 +84,20 @@ describe("LuaRocks config tests #blackbox #b_config", function() lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") lfs.mkdir(scdir) - if test_env.TEST_TARGET_OS == "windows" then - local output = run.luarocks("config --system-config") - assert.are.same(output, versioned_scname) - else - sysconfig = io.open(scname, "w+") + -- if test_env.TEST_TARGET_OS == "windows" then + -- local output = run.luarocks("config --system-config") + -- assert.are.same(output, versioned_scname) + -- else + local sysconfig = io.open(configfile, "w+") + test_env.copy(configfile, "configfile_temp") sysconfig:write(" ") sysconfig:close() local output = run.luarocks("config --system-config") - assert.are.same(output, scname) - os.remove(scname) - end + assert.are.same(output, configfile) + test_env.copy("configfile_temp", configfile) + os.remove("configfile_temp") + -- end end) it("LuaRocks fail system config invalid", function() @@ -103,20 +105,21 @@ describe("LuaRocks config tests #blackbox #b_config", function() lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") lfs.mkdir(scdir) - if test_env.TEST_TARGET_OS == "windows" then - test_env.copy(versioned_scname, "versioned_scname_temp") - sysconfig = io.open(versioned_scname, "w+") + -- if test_env.TEST_TARGET_OS == "windows" then + sysconfig = io.open(configfile, "w+") + test_env.copy(configfile, "configfile_temp") sysconfig:write("if if if") sysconfig:close() assert.is_false(run.luarocks_bool("config --system-config")) - test_env.copy("versioned_scname_temp", versioned_scname) - else - sysconfig = io.open(scname, "w+") - sysconfig:write("if if if") - sysconfig:close() - assert.is_false(run.luarocks_bool("config --system-config")) - os.remove(scname) - end + test_env.copy("configfile_temp", configfile) + os.remove("configfile_temp") + -- else + -- sysconfig = io.open(scname, "w+") + -- sysconfig:write("if if if") + -- sysconfig:close() + -- assert.is_false(run.luarocks_bool("config --system-config")) + -- os.remove(scname) + -- end end) end) end) -- cgit v1.2.3-55-g6feb