From 1026d63ba37b8a1074c49797ce737edb5726ed2f Mon Sep 17 00:00:00 2001 From: roboo Date: Mon, 22 Aug 2016 13:50:53 +0200 Subject: Fix of config test --- spec/config_spec.lua | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'spec') diff --git a/spec/config_spec.lua b/spec/config_spec.lua index 807b077a..4a7f4aea 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 #special", function() + describe("LuaRocks config - more complex tests", function() local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks" local versioned_scname = scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua" local scname = scdir .. "/config.lua" @@ -84,20 +84,18 @@ 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 + if test_env.TEST_TARGET_OS == "windows" then + local output = run.luarocks("config --system-config") + assert.are.same(output, configfile) + 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, configfile) - test_env.copy("configfile_temp", configfile) - os.remove("configfile_temp") - -- end + os.remove(configfile) + end end) it("LuaRocks fail system config invalid", function() @@ -105,21 +103,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 - sysconfig = io.open(configfile, "w+") + if test_env.TEST_TARGET_OS == "windows" then test_env.copy(configfile, "configfile_temp") + local sysconfig = io.open(configfile, "w+") sysconfig:write("if if if") sysconfig:close() assert.is_false(run.luarocks_bool("config --system-config")) 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 + else + local sysconfig = io.open(configfile, "w+") + sysconfig:write("if if if") + sysconfig:close() + assert.is_false(run.luarocks_bool("config --system-config")) + os.remove(configfile) + end end) end) end) -- cgit v1.2.3-55-g6feb