diff options
author | roboo <robo.karasek@gmail.com> | 2016-08-22 13:40:03 +0200 |
---|---|---|
committer | roboo <robo.karasek@gmail.com> | 2016-08-22 13:40:03 +0200 |
commit | f1c9fd4895fe107683488c501bc07d4e22f46a4f (patch) | |
tree | ce7402db6b9854a81090ab6f02e6607c9bb56461 /spec | |
parent | beaecdbccb9fa244bbc0253aedd26d372aa312aa (diff) | |
download | luarocks-f1c9fd4895fe107683488c501bc07d4e22f46a4f.tar.gz luarocks-f1c9fd4895fe107683488c501bc07d4e22f46a4f.tar.bz2 luarocks-f1c9fd4895fe107683488c501bc07d4e22f46a4f.zip |
Fix of config test
Diffstat (limited to 'spec')
-rw-r--r-- | spec/config_spec.lua | 47 |
1 files changed, 25 insertions, 22 deletions
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() | |||
61 | end) | 61 | end) |
62 | end) | 62 | end) |
63 | 63 | ||
64 | describe("LuaRocks config - more complex tests", function() | 64 | describe("LuaRocks config - more complex tests #special", 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" |
@@ -74,9 +74,9 @@ describe("LuaRocks config tests #blackbox #b_config", function() | |||
74 | end | 74 | end |
75 | 75 | ||
76 | it("LuaRocks fail system config", function() | 76 | it("LuaRocks fail system config", function() |
77 | os.rename(versioned_scname, versioned_scname .. ".bak") | 77 | os.rename(configfile, configfile .. ".bak") |
78 | assert.is_false(run.luarocks_bool("config --system-config")) | 78 | assert.is_false(run.luarocks_bool("config --system-config")) |
79 | os.rename(versioned_scname .. ".bak", versioned_scname) | 79 | os.rename(configfile .. ".bak", configfile) |
80 | end) | 80 | end) |
81 | 81 | ||
82 | it("LuaRocks system config", function() | 82 | it("LuaRocks system config", function() |
@@ -84,18 +84,20 @@ 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, versioned_scname) |
90 | else | 90 | -- else |
91 | sysconfig = io.open(scname, "w+") | 91 | local sysconfig = io.open(configfile, "w+") |
92 | test_env.copy(configfile, "configfile_temp") | ||
92 | sysconfig:write(" ") | 93 | sysconfig:write(" ") |
93 | sysconfig:close() | 94 | sysconfig:close() |
94 | 95 | ||
95 | local output = run.luarocks("config --system-config") | 96 | local output = run.luarocks("config --system-config") |
96 | assert.are.same(output, scname) | 97 | assert.are.same(output, configfile) |
97 | os.remove(scname) | 98 | test_env.copy("configfile_temp", configfile) |
98 | end | 99 | os.remove("configfile_temp") |
100 | -- end | ||
99 | end) | 101 | end) |
100 | 102 | ||
101 | it("LuaRocks fail system config invalid", function() | 103 | it("LuaRocks fail system config invalid", function() |
@@ -103,20 +105,21 @@ describe("LuaRocks config tests #blackbox #b_config", function() | |||
103 | lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") | 105 | lfs.mkdir(testing_paths.testing_lrprefix .. "/etc/") |
104 | lfs.mkdir(scdir) | 106 | lfs.mkdir(scdir) |
105 | 107 | ||
106 | if test_env.TEST_TARGET_OS == "windows" then | 108 | -- if test_env.TEST_TARGET_OS == "windows" then |
107 | test_env.copy(versioned_scname, "versioned_scname_temp") | 109 | sysconfig = io.open(configfile, "w+") |
108 | sysconfig = io.open(versioned_scname, "w+") | 110 | test_env.copy(configfile, "configfile_temp") |
109 | sysconfig:write("if if if") | 111 | sysconfig:write("if if if") |
110 | sysconfig:close() | 112 | sysconfig:close() |
111 | assert.is_false(run.luarocks_bool("config --system-config")) | 113 | assert.is_false(run.luarocks_bool("config --system-config")) |
112 | test_env.copy("versioned_scname_temp", versioned_scname) | 114 | test_env.copy("configfile_temp", configfile) |
113 | else | 115 | os.remove("configfile_temp") |
114 | sysconfig = io.open(scname, "w+") | 116 | -- else |
115 | sysconfig:write("if if if") | 117 | -- sysconfig = io.open(scname, "w+") |
116 | sysconfig:close() | 118 | -- sysconfig:write("if if if") |
117 | assert.is_false(run.luarocks_bool("config --system-config")) | 119 | -- sysconfig:close() |
118 | os.remove(scname) | 120 | -- assert.is_false(run.luarocks_bool("config --system-config")) |
119 | end | 121 | -- os.remove(scname) |
122 | -- end | ||
120 | end) | 123 | end) |
121 | end) | 124 | end) |
122 | end) | 125 | end) |