diff options
| author | Vicent Martà <tanoku@gmail.com> | 2012-04-11 12:38:45 +0200 |
|---|---|---|
| committer | Vicent Martà <tanoku@gmail.com> | 2012-04-11 12:38:45 +0200 |
| commit | dcfdb958e2033aa59beb624da4263ce031fbb21e (patch) | |
| tree | f17365bd6314e8318d143a8f2e57659b31037519 /tests-clar/refs/unicode.c | |
| parent | 73fe6a8e20ffbc18ad667ff519c0fb8adf85fc3e (diff) | |
| parent | efef3795a2d29f6b99bb9575585bb3fc19c3ed79 (diff) | |
| download | libgit2-dcfdb958e2033aa59beb624da4263ce031fbb21e.tar.gz | |
Merge branch 'new-error-handling' of github.com:libgit2/libgit2 into new-error-handling
Diffstat (limited to 'tests-clar/refs/unicode.c')
| -rw-r--r-- | tests-clar/refs/unicode.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests-clar/refs/unicode.c b/tests-clar/refs/unicode.c new file mode 100644 index 000000000..889c85666 --- /dev/null +++ b/tests-clar/refs/unicode.c @@ -0,0 +1,42 @@ +#include "clar_libgit2.h" + +static git_repository *repo; + +void test_refs_unicode__initialize(void) +{ + cl_fixture_sandbox("testrepo.git"); + + cl_git_pass(git_repository_open(&repo, "testrepo.git")); +} + +void test_refs_unicode__cleanup(void) +{ + git_repository_free(repo); + cl_fixture_cleanup("testrepo.git"); +} + +void test_refs_unicode__create_and_lookup(void) +{ + git_reference *ref0, *ref1, *ref2; + git_repository *repo2; + + const char *REFNAME = "refs/heads/" "\305" "ngstr" "\366" "m"; + const char *master = "refs/heads/master"; + + /* Create the reference */ + cl_git_pass(git_reference_lookup(&ref0, repo, master)); + cl_git_pass(git_reference_create_oid(&ref1, repo, REFNAME, git_reference_oid(ref0), 0)); + cl_assert(strcmp(REFNAME, git_reference_name(ref1)) == 0); + + /* Lookup the reference in a different instance of the repository */ + cl_git_pass(git_repository_open(&repo2, "testrepo.git")); + cl_git_pass(git_reference_lookup(&ref2, repo2, REFNAME)); + + cl_assert(git_oid_cmp(git_reference_oid(ref1), git_reference_oid(ref2)) == 0); + cl_assert(strcmp(REFNAME, git_reference_name(ref2)) == 0); + + git_reference_free(ref0); + git_reference_free(ref1); + git_reference_free(ref2); + git_repository_free(repo2); +} |
