aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-07-31 16:34:17 -0300
committerEuAndreh <eu@euandre.org>2021-07-31 17:08:00 -0300
commitf8eae5c79dab178277732dab802e4011f7fb716b (patch)
treea44dd91d3d81f1afab504f5adf783e74beebcc77
parentTODOs.md: Add #task-5b4b46b6-b1e8-6ba0-4f26-fab9de6a0e75 (diff)
downloadgistatic-f8eae5c79dab178277732dab802e4011f7fb716b.tar.gz
gistatic-f8eae5c79dab178277732dab802e4011f7fb716b.tar.xz
tests/submodules/: Add submodule repositories for unit and (future) integration tests
-rw-r--r--.gitmodules6
-rw-r--r--src/gistatic.c23
m---------tests/submodules/repo-10
m---------tests/submodules/repo-20
4 files changed, 26 insertions, 3 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..0c070fa
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "tests/submodules/repo-2"]
+ path = tests/submodules/repo-2
+ url = https://euandreh.xyz/gistatic-repo-2.git/
+[submodule "tests/submodules/repo-1"]
+ path = tests/submodules/repo-1
+ url = https://euandreh.xyz/gistatic-repo-1.git/
diff --git a/src/gistatic.c b/src/gistatic.c
index 92bcf7d..3464e89 100644
--- a/src/gistatic.c
+++ b/src/gistatic.c
@@ -911,18 +911,35 @@ cleanup:
static void test_last_commit_date() {
test_start("test_last_commit_date");
{
- testing("embedded Git repository");
+ testing("embedded Git repository tests/submodules/repo-1");
struct git_repository *repo;
const int e = git_repository_open_ext(
&repo,
- "tests/resources/embedded-repo",
+ "tests/submodules/repo-1",
GIT_REPOSITORY_OPEN_NO_SEARCH,
NULL
);
assert(e == 0);
char *const date = last_commit_date(repo);
assert(date);
- assert(strcmp(date, "2021-07-30 14:18") == 0);
+ assert(strcmp(date, "2021-07-31 19:24") == 0);
+ free(date);
+ git_repository_free(repo);
+ test_ok();
+ }
+ {
+ testing("embedded Git repository tests/submodules/repo-2");
+ struct git_repository *repo;
+ const int e = git_repository_open_ext(
+ &repo,
+ "tests/submodules/repo-2",
+ GIT_REPOSITORY_OPEN_NO_SEARCH,
+ NULL
+ );
+ assert(e == 0);
+ char *const date = last_commit_date(repo);
+ assert(date);
+ assert(strcmp(date, "2021-07-31 19:27") == 0);
free(date);
git_repository_free(repo);
test_ok();
diff --git a/tests/submodules/repo-1 b/tests/submodules/repo-1
new file mode 160000
+Subproject cd361fd9443d04c4563df5ca35689a639aad945
diff --git a/tests/submodules/repo-2 b/tests/submodules/repo-2
new file mode 160000
+Subproject 4e63a2b00ec7e4d4a25262c97bb5d698cd72e3d