aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorroboo <robo.karasek@gmail.com>2016-08-22 13:50:53 +0200
committerroboo <robo.karasek@gmail.com>2016-08-22 13:50:53 +0200
commit1026d63ba37b8a1074c49797ce737edb5726ed2f (patch)
tree1ca8841c6f9ac01b033b046d69f7c6ed10ae522c /spec
parentf1c9fd4895fe107683488c501bc07d4e22f46a4f (diff)
downloadluarocks-1026d63ba37b8a1074c49797ce737edb5726ed2f.tar.gz
luarocks-1026d63ba37b8a1074c49797ce737edb5726ed2f.tar.bz2
luarocks-1026d63ba37b8a1074c49797ce737edb5726ed2f.zip
Fix of config test
Diffstat (limited to 'spec')
-rw-r--r--spec/config_spec.lua35
1 files changed, 16 insertions, 19 deletions
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()
61 end) 61 end)
62 end) 62 end)
63 63
64 describe("LuaRocks config - more complex tests #special", function() 64 describe("LuaRocks config - more complex tests", function()
65 local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks" 65 local scdir = testing_paths.testing_lrprefix .. "/etc/luarocks"
66 local versioned_scname = scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua" 66 local versioned_scname = scdir .. "/config-" .. env_variables.LUA_VERSION .. ".lua"
67 local scname = scdir .. "/config.lua" 67 local scname = scdir .. "/config.lua"
@@ -84,20 +84,18 @@ describe("LuaRocks config tests #blackbox #b_config", function()
84 lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") 84 lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/")
85 lfs.mkdir(scdir) 85 lfs.mkdir(scdir)
86 86
87 -- if test_env.TEST_TARGET_OS == "windows" then 87 if test_env.TEST_TARGET_OS == "windows" then
88 -- local output = run.luarocks("config --system-config") 88 local output = run.luarocks("config --system-config")
89 -- assert.are.same(output, versioned_scname) 89 assert.are.same(output, configfile)
90 -- else 90 else
91 local sysconfig = io.open(configfile, "w+") 91 local sysconfig = io.open(configfile, "w+")
92 test_env.copy(configfile, "configfile_temp")
93 sysconfig:write(" ") 92 sysconfig:write(" ")
94 sysconfig:close() 93 sysconfig:close()
95 94
96 local output = run.luarocks("config --system-config") 95 local output = run.luarocks("config --system-config")
97 assert.are.same(output, configfile) 96 assert.are.same(output, configfile)
98 test_env.copy("configfile_temp", configfile) 97 os.remove(configfile)
99 os.remove("configfile_temp") 98 end
100 -- end
101 end) 99 end)
102 100
103 it("LuaRocks fail system config invalid", function() 101 it("LuaRocks fail system config invalid", function()
@@ -105,21 +103,20 @@ describe("LuaRocks config tests #blackbox #b_config", function()
105 lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") 103 lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/")
106 lfs.mkdir(scdir) 104 lfs.mkdir(scdir)
107 105
108 -- if test_env.TEST_TARGET_OS == "windows" then 106 if test_env.TEST_TARGET_OS == "windows" then
109 sysconfig = io.open(configfile, "w+")
110 test_env.copy(configfile, "configfile_temp") 107 test_env.copy(configfile, "configfile_temp")
108 local sysconfig = io.open(configfile, "w+")
111 sysconfig:write("if if if") 109 sysconfig:write("if if if")
112 sysconfig:close() 110 sysconfig:close()
113 assert.is_false(run.luarocks_bool("config --system-config")) 111 assert.is_false(run.luarocks_bool("config --system-config"))
114 test_env.copy("configfile_temp", configfile) 112 test_env.copy("configfile_temp", configfile)
115 os.remove("configfile_temp") 113 else
116 -- else 114 local sysconfig = io.open(configfile, "w+")
117 -- sysconfig = io.open(scname, "w+") 115 sysconfig:write("if if if")
118 -- sysconfig:write("if if if") 116 sysconfig:close()
119 -- sysconfig:close() 117 assert.is_false(run.luarocks_bool("config --system-config"))
120 -- assert.is_false(run.luarocks_bool("config --system-config")) 118 os.remove(configfile)
121 -- os.remove(scname) 119 end
122 -- end
123 end) 120 end)
124 end) 121 end)
125end) 122end)