From 8d7fbb1ec57236c4352b1544d8cd8250bf3bb038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sat, 30 Mar 2013 15:11:29 +0100 Subject: [PATCH] Add a couple more tests --- test/repo_test.erl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/repo_test.erl diff --git a/test/repo_test.erl b/test/repo_test.erl new file mode 100644 index 0000000..d647fa4 --- /dev/null +++ b/test/repo_test.erl @@ -0,0 +1,26 @@ +-module(repo_test). +-compile([export_all]). +-include_lib("eunit/include/eunit.hrl"). + +repo_test_() -> + {foreach, fun start/0, fun stop/1, [fun bare_test/1, fun odb_write_test/1]}. + +start() -> + {A, B, C} = now(), + N = node(), + TmpDir = io_lib:format("/tmp/geef-~p~p~p~p.git", [N, A, B, C]), + {ok, Repo} = geef_repo:init(TmpDir, true), + Repo. + +bare_test(Repo) -> + [?_assertEqual(geef_repo:is_bare(Repo), true)]. + +odb_write_test(Repo) -> + Data = <<"This is some text that will go in a file">>, + {ok, Odb} = geef_repo:odb(Repo), + {ok, Actual} = geef_odb:write(Odb, Data, blob), + Expected = geef_oid:parse("c300118399f01fe52b316061b5d32beb27e0adfd"), + [?_assertEqual(Actual, Expected)]. + +stop(_Repo) -> + ok.