aboutsummaryrefslogtreecommitdiff
path: root/spec/util
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2024-02-26 14:11:37 -0300
committerHisham Muhammad <hisham@gobolinux.org>2024-02-27 13:28:33 -0300
commit6bc6ede826843c3692971c14c27c3d27714b2126 (patch)
treea15196f6617c6cd6d683b69c51a26f57940d55bd /spec/util
parente0aa47df12c9b9beb05d380aac7d90a28a081a7b (diff)
downloadluarocks-6bc6ede826843c3692971c14c27c3d27714b2126.tar.gz
luarocks-6bc6ede826843c3692971c14c27c3d27714b2126.tar.bz2
luarocks-6bc6ede826843c3692971c14c27c3d27714b2126.zip
tests(fetch): do not use restserver
Diffstat (limited to 'spec/util')
-rw-r--r--spec/util/quick.lua2
-rw-r--r--spec/util/test_env.lua15
2 files changed, 16 insertions, 1 deletions
diff --git a/spec/util/quick.lua b/spec/util/quick.lua
index 6b86bfa9..cb4bb4cf 100644
--- a/spec/util/quick.lua
+++ b/spec/util/quick.lua
@@ -429,7 +429,7 @@ function quick.compile(filename, env)
429 end 429 end
430 end 430 end
431 end 431 end
432 write([=[ end) ]=]) 432 write([=[ end, finally) ]=])
433 write([=[ end ]=]) 433 write([=[ end ]=])
434 434
435 local program = table.concat(code, "\n") 435 local program = table.concat(code, "\n")
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua
index 41787cb7..f311a370 100644
--- a/spec/util/test_env.lua
+++ b/spec/util/test_env.lua
@@ -193,10 +193,25 @@ function test_env.run_in_tmp(f, finally)
193 lfs.mkdir(tmpdir) 193 lfs.mkdir(tmpdir)
194 lfs.chdir(tmpdir) 194 lfs.chdir(tmpdir)
195 195
196 if not finally then
197 error("run_in_tmp needs a finally argument")
198 end
199
200 -- for unit tests, so that current dir known by luarocks.fs (when running with non-lfs)
201 -- is synchronized with actual lfs (system) current dir
202 local fs = require("luarocks.fs")
203 if not fs.change_dir then
204 local cfg = require("luarocks.core.cfg")
205 cfg.init()
206 fs.init()
207 end
208 fs.change_dir(tmpdir)
209
196 if finally then 210 if finally then
197 finally(function() 211 finally(function()
198 lfs.chdir(olddir) 212 lfs.chdir(olddir)
199 lfs.rmdir(tmpdir) 213 lfs.rmdir(tmpdir)
214 fs.change_dir(olddir)
200 end) 215 end)
201 end 216 end
202 217