summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/create_test_repo.sh1
-rw-r--r--test/lorries-broken.tarbin0 -> 81920 bytes
-rw-r--r--test/test-gall.repository.lua16
-rw-r--r--test/test_repo.tarbin92160 -> 92160 bytes
-rw-r--r--test/withrepo.lua9
5 files changed, 23 insertions, 3 deletions
diff --git a/test/create_test_repo.sh b/test/create_test_repo.sh
index 7eedefa..8e01b4d 100644
--- a/test/create_test_repo.sh
+++ b/test/create_test_repo.sh
@@ -3,3 +3,4 @@
cd test
tar xf test_repo.tar
+tar xf lorries-broken.tar
diff --git a/test/lorries-broken.tar b/test/lorries-broken.tar
new file mode 100644
index 0000000..074d1cf
--- /dev/null
+++ b/test/lorries-broken.tar
Binary files differ
diff --git a/test/test-gall.repository.lua b/test/test-gall.repository.lua
index 8fb6ab9..0f59993 100644
--- a/test/test-gall.repository.lua
+++ b/test/test-gall.repository.lua
@@ -214,6 +214,22 @@ function suite.merge_base_nobase()
assert(ok == true)
end
+function suite.merge_base_annotated_tags()
+ local repo = test_repo()
+ local sha_1 = "annotated-1"
+ local sha_2 = "annotated-2"
+ local sha_b = "b972b3345490a898f46df143a7285cb7840b9845"
+ assert(repo:merge_base(sha_1, sha_2) == sha_b)
+end
+
+function suite.merge_base_lorries_regression()
+ local repo = test_repo("lorries.git")
+ local sha_1 = "738022ab867407fc9e906e89268043f72179730a"
+ local sha_2 = "2f0995c6c852c9b9d6ce584f3b9f38a981a40cf3"
+ local sha_b = "738022ab867407fc9e906e89268043f72179730a"
+ assert(repo:merge_base(sha_1, sha_2) == sha_b)
+end
+
function suite.rev_list()
local repo = test_repo()
local sha_new = "0b65c32b6a5277ff0e75ddad9e3914148914042d"
diff --git a/test/test_repo.tar b/test/test_repo.tar
index 614b8aa..dcfc172 100644
--- a/test/test_repo.tar
+++ b/test/test_repo.tar
Binary files differ
diff --git a/test/withrepo.lua b/test/withrepo.lua
index bf90b0c..0795993 100644
--- a/test/withrepo.lua
+++ b/test/withrepo.lua
@@ -7,12 +7,15 @@ 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()
+function test_repo(reponame)
+ reponame = reponame or "test_repo"
os.execute("sh test/create_test_repo.sh")
- return assert(require("gall.repository").new "test/test_repo")
-end \ No newline at end of file
+ return assert(require("gall.repository").new("test/" .. reponame))
+end