diff options
Diffstat (limited to 'test/test-gall.repository.lua')
-rw-r--r-- | test/test-gall.repository.lua | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/test/test-gall.repository.lua b/test/test-gall.repository.lua index 88be480..8fb6ab9 100644 --- a/test/test-gall.repository.lua +++ b/test/test-gall.repository.lua @@ -34,11 +34,13 @@ end local suite = setmetatable({}, {__newindex = add_test}) function suite.find_current_dot_git() - assert(gall.repository.new("./.git")) + os.execute("sh test/create_test_repo.sh") + assert(gall.repository.new("test/test_repo/.git")) end function suite.find_current() - assert(gall.repository.new(".")) + os.execute("sh test/create_test_repo.sh") + assert(gall.repository.new("test/test_repo")) end function suite.fail_to_find() @@ -62,10 +64,11 @@ function suite.make_fail() end function suite.repo_tostring() - local repo = assert(gall.repository.new(".")) + os.execute("sh test/create_test_repo.sh") + local repo = assert(gall.repository.new("test/test_repo")) local repstr = tostring(repo) assert(repstr:find("GitRepository")) - assert(repstr:find("%./%.git")) + assert(repstr:find("test/test_repo/%.git")) end function suite.repo_hash_blob() @@ -92,42 +95,42 @@ function suite.repo_create_retrieve_blob() end function suite.normalise_bad_ref() - local repo = assert(gall.repository.new(".")) + local repo = test_repo() local ok, msg = repo:normalise("PANTS") assert(not ok) assert(msg:find("PANTS")) end function suite.normalise_good_ref() - local repo = assert(gall.repository.new(".")) + local repo = test_repo() assert(repo:normalise("refs/heads/master")) end function suite.normalise_short_sha() - local repo = assert(gall.repository.new(".")) - assert(repo:normalise("988de21")) + local repo = test_repo() + assert(repo:normalise("8b50f4e")) end function suite.error_normalise() - local repo = assert(gall.repository.new(".")) + local repo = test_repo() repo.path = "/DOES_NOT_EXIST" assert(not xpcall(function()repo:normalise("PANTS")end)) end function suite.get_bad() - local repo = assert(gall.repository.new(".")) + local repo = test_repo() local ok, msg = repo:get("PANTS") assert(not ok) assert(msg:find("PANTS")) end function suite.get_ref() - local repo = assert(gall.repository.new(".")) + local repo = test_repo() assert(repo:get_ref("refs/heads/master")) end function suite.all_refs() - local repo = assert(gall.repository.new(".")) + local repo = test_repo() local refs, msg = repo:all_refs() assert(refs, msg) assert(refs["refs/heads/master"]) |