diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2021-11-16 23:29:22 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2022-02-22 22:07:45 -0500 |
| commit | 3344fddc97bbdea9c1b6ebb6f7fb6dbd70b41dfb (patch) | |
| tree | fd6368a72944571c51627b40c592e7d58e0036e1 /tests/notes/notesref.c | |
| parent | 91ba089663f5efc3bd4ba14a5099372cf5ce57a6 (diff) | |
| download | libgit2-3344fddc97bbdea9c1b6ebb6f7fb6dbd70b41dfb.tar.gz | |
refactor: `tests` is now `tests/libgit2`
Like we want to separate libgit2 and utility source code, we want to
separate libgit2 and utility tests. Start by moving all the tests into
libgit2.
Diffstat (limited to 'tests/notes/notesref.c')
| -rw-r--r-- | tests/notes/notesref.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/tests/notes/notesref.c b/tests/notes/notesref.c deleted file mode 100644 index 6ba324c76..000000000 --- a/tests/notes/notesref.c +++ /dev/null @@ -1,67 +0,0 @@ -#include "clar_libgit2.h" - -#include "notes.h" - -static git_repository *_repo; -static git_note *_note; -static git_signature *_sig; -static git_config *_cfg; - -void test_notes_notesref__initialize(void) -{ - cl_fixture_sandbox("testrepo.git"); - cl_git_pass(git_repository_open(&_repo, "testrepo.git")); -} - -void test_notes_notesref__cleanup(void) -{ - git_note_free(_note); - _note = NULL; - - git_signature_free(_sig); - _sig = NULL; - - git_config_free(_cfg); - _cfg = NULL; - - git_repository_free(_repo); - _repo = NULL; - - cl_fixture_cleanup("testrepo.git"); -} - -void test_notes_notesref__config_corenotesref(void) -{ - git_oid oid, note_oid; - git_buf default_ref = GIT_BUF_INIT; - - cl_git_pass(git_signature_now(&_sig, "alice", "alice@example.com")); - cl_git_pass(git_oid_fromstr(&oid, "8496071c1b46c854b31185ea97743be6a8774479")); - - cl_git_pass(git_repository_config(&_cfg, _repo)); - - cl_git_pass(git_config_set_string(_cfg, "core.notesRef", "refs/notes/mydefaultnotesref")); - - cl_git_pass(git_note_create(¬e_oid, _repo, NULL, _sig, _sig, &oid, "test123test\n", 0)); - - cl_git_pass(git_note_read(&_note, _repo, NULL, &oid)); - cl_assert_equal_s("test123test\n", git_note_message(_note)); - cl_assert_equal_oid(git_note_id(_note), ¬e_oid); - - git_note_free(_note); - - cl_git_pass(git_note_read(&_note, _repo, "refs/notes/mydefaultnotesref", &oid)); - cl_assert_equal_s("test123test\n", git_note_message(_note)); - cl_assert_equal_oid(git_note_id(_note), ¬e_oid); - - cl_git_pass(git_note_default_ref(&default_ref, _repo)); - cl_assert_equal_s("refs/notes/mydefaultnotesref", default_ref.ptr); - git_buf_dispose(&default_ref); - - cl_git_pass(git_config_delete_entry(_cfg, "core.notesRef")); - - cl_git_pass(git_note_default_ref(&default_ref, _repo)); - cl_assert_equal_s(GIT_NOTES_DEFAULT_REF, default_ref.ptr); - - git_buf_dispose(&default_ref); -} |
