diff options
author | Vicent Marti <tanoku@gmail.com> | 2013-11-01 20:07:44 +0400 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2013-11-01 20:36:09 +0400 |
commit | 0bfa73234263de03e5f797c2f4c514def145433a (patch) | |
tree | 229fc54b09b13cd6283a513edfd0174f4d12641f /tests-clar | |
parent | 95352b7058fe3166689e5af0b3b0a38e7c6f63a0 (diff) |
iconv: Do not fake an API when iconv is not available
Diffstat (limited to 'tests-clar')
-rw-r--r-- | tests-clar/core/iconv.c | 14 | ||||
-rw-r--r-- | tests-clar/repo/init.c | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/tests-clar/core/iconv.c b/tests-clar/core/iconv.c index 73bc99a23..8aedab206 100644 --- a/tests-clar/core/iconv.c +++ b/tests-clar/core/iconv.c @@ -1,22 +1,29 @@ #include "clar_libgit2.h" #include "path.h" +#ifdef GIT_USE_ICONV static git_path_iconv_t ic; static char *nfc = "\xC3\x85\x73\x74\x72\xC3\xB6\x6D"; static char *nfd = "\x41\xCC\x8A\x73\x74\x72\x6F\xCC\x88\x6D"; +#endif void test_core_iconv__initialize(void) { +#ifdef GIT_USE_ICONV cl_git_pass(git_path_iconv_init_precompose(&ic)); +#endif } void test_core_iconv__cleanup(void) { +#ifdef GIT_USE_ICONV git_path_iconv_clear(&ic); +#endif } void test_core_iconv__unchanged(void) { +#ifdef GIT_USE_ICONV char *data = "Ascii data", *original = data; size_t datalen = strlen(data); @@ -25,10 +32,12 @@ void test_core_iconv__unchanged(void) /* There are no high bits set, so this should leave data untouched */ cl_assert(data == original); +#endif } void test_core_iconv__decomposed_to_precomposed(void) { +#ifdef GIT_USE_ICONV char *data = nfd; size_t datalen = strlen(nfd); @@ -38,15 +47,13 @@ void test_core_iconv__decomposed_to_precomposed(void) /* The decomposed nfd string should be transformed to the nfc form * (on platforms where iconv is enabled, of course). */ -#ifdef GIT_USE_ICONV cl_assert_equal_s(nfc, data); -#else - cl_assert_equal_s(nfd, data); #endif } void test_core_iconv__precomposed_is_unmodified(void) { +#ifdef GIT_USE_ICONV char *data = nfc; size_t datalen = strlen(nfc); @@ -57,4 +64,5 @@ void test_core_iconv__precomposed_is_unmodified(void) * the high-bit set, the iconv transform should result in no change. */ cl_assert_equal_s(nfc, data); +#endif } diff --git a/tests-clar/repo/init.c b/tests-clar/repo/init.c index 617fdf879..aea383c64 100644 --- a/tests-clar/repo/init.c +++ b/tests-clar/repo/init.c @@ -232,6 +232,7 @@ void test_repo_init__detect_ignorecase(void) void test_repo_init__detect_precompose_unicode_required(void) { +#ifdef GIT_USE_ICONV char *composed = "ḱṷṓn", *decomposed = "ḱṷṓn"; struct stat st; bool found_with_nfd; @@ -240,7 +241,6 @@ void test_repo_init__detect_precompose_unicode_required(void) found_with_nfd = (p_stat(decomposed, &st) == 0); cl_must_pass(p_unlink(composed)); -#ifdef GIT_USE_ICONV assert_config_entry_on_init("core.precomposeunicode", found_with_nfd); #else assert_config_entry_on_init("core.precomposeunicode", GIT_ENOTFOUND); |