Work towards elixir 14
While here, make the object be an elixir struct instead of delegating to the erlang code. As part of this, geef_nif:commit_tree() has been fixed to return the id, insted of the type, as we know it's going to be a tree, but not then id.
This commit is contained in:
@@ -1,21 +1,15 @@
|
||||
Code.require_file "../test_helper.exs", __FILE__
|
||||
|
||||
defmodule ObjectTest do
|
||||
use ExUnit.Case
|
||||
use Geef
|
||||
import RepoHelpers
|
||||
|
||||
setup do
|
||||
{{:ok, repo}, path} = tmp_bare()
|
||||
{repo, path} = tmp_bare()
|
||||
Process.link(repo)
|
||||
on_exit(fn -> File.rm_rf!(path) end)
|
||||
{:ok, [repo: repo, path: path]}
|
||||
end
|
||||
|
||||
teardown meta do
|
||||
Repository.stop(meta[:repo])
|
||||
File.rm_rf!(meta[:path])
|
||||
:ok
|
||||
end
|
||||
|
||||
test "object OO helpers", meta do
|
||||
repo = meta[:repo]
|
||||
{ :ok, odb } = Repository.odb(repo)
|
||||
@@ -23,5 +17,7 @@ defmodule ObjectTest do
|
||||
|
||||
content = "I'm some content"
|
||||
Odb.write(odb, content, :blob)
|
||||
|
||||
Repository.stop(repo)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,21 +1,14 @@
|
||||
Code.require_file "../test_helper.exs", __FILE__
|
||||
|
||||
defmodule ReferenceTest do
|
||||
use ExUnit.Case
|
||||
use Geef
|
||||
import RepoHelpers
|
||||
|
||||
setup do
|
||||
{{:ok, repo}, path} = tmp_bare()
|
||||
{repo, path} = tmp_bare()
|
||||
on_exit(fn -> File.rm_rf!(path) end)
|
||||
{:ok, [repo: repo, path: path]}
|
||||
end
|
||||
|
||||
teardown meta do
|
||||
Repository.stop(meta[:repo])
|
||||
File.rm_rf!(meta[:path])
|
||||
:ok
|
||||
end
|
||||
|
||||
test "creating and looking up", meta do
|
||||
repo = meta[:repo]
|
||||
{ :ok, odb } = Repository.odb(repo)
|
||||
@@ -25,12 +18,14 @@ defmodule ReferenceTest do
|
||||
refname = "refs/tags/foo"
|
||||
{:ok, ref} = Reference.create(repo, refname, id)
|
||||
{:ok, looked_up} = Reference.lookup(repo, refname)
|
||||
ref == looked_up
|
||||
assert ref == looked_up
|
||||
|
||||
refname = "refs/tags/foo2"
|
||||
{:ok, ref} = Reference.create_symbolic(repo, refname, id)
|
||||
{:ok, looked_up} = Reference.lookup(repo, refname)
|
||||
ref == looked_up
|
||||
assert ref == looked_up
|
||||
|
||||
Repository.stop(repo)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -6,6 +6,7 @@ defmodule RepoHelpers do
|
||||
n = node()
|
||||
dir = :io_lib.format("geef-~p~p~p~p.git", [n, a, b, c])
|
||||
path = Path.join(System.tmp_dir!, dir)
|
||||
{Geef.Repository.init(path, true), path}
|
||||
{:ok, repo} = Geef.Repository.init(path, true)
|
||||
{repo, path}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user