summaryrefslogtreecommitdiff
path: root/test/withrepo.lua
blob: 079599382eb22c7ad4d4602efdb5d870f14e165a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-- test/withrepo.lua
--
-- Gall -- Test utilities for when you have repositories
--

local _xpcall = xpcall

function xpcall(fn, tb)
   os.execute("rm -rf test/test_repo")
   os.execute("rm -rf test/lorries.git")
   local ok, msg = _xpcall(fn, tb)
   os.execute("rm -rf test/test_repo")
   os.execute("rm -rf test/lorries.git")
   return ok, msg
end

function test_repo(reponame)
   reponame = reponame or "test_repo"
   os.execute("sh test/create_test_repo.sh")
   return assert(require("gall.repository").new("test/" .. reponame))
end