diff options
author | Tom Gundersen <teg@jklm.no> | 2016-01-19 01:44:20 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2016-01-19 01:44:20 +0100 |
commit | bcbd1d0cd5a1e6ff068f251c99ed7905223fed67 (patch) | |
tree | aa39418fafed272f9c13e91e8a9383351cd91d9b /src/test/test-dns-domain.c | |
parent | 6228dc518f13f189a68144ab46bf055469615e3b (diff) | |
parent | cc450722a02ab9c59bca1d9a5b5012f356336a8c (diff) |
Merge pull request #2358 from poettering/dnssec16
sixteenth DNSSEC patch set
Diffstat (limited to 'src/test/test-dns-domain.c')
-rw-r--r-- | src/test/test-dns-domain.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/test-dns-domain.c b/src/test/test-dns-domain.c index 987f1fc887..3b260ee75d 100644 --- a/src/test/test-dns-domain.c +++ b/src/test/test-dns-domain.c @@ -598,6 +598,26 @@ static void test_dns_name_common_suffix(void) { test_dns_name_common_suffix_one("FOO.BAR", "tEST.bAR", "BAR"); } +static void test_dns_name_apply_idna_one(const char *s, const char *result) { +#ifdef HAVE_LIBIDN + _cleanup_free_ char *buf = NULL; + assert_se(dns_name_apply_idna(s, &buf) >= 0); + assert_se(dns_name_equal(buf, result) > 0); +#endif +} + +static void test_dns_name_apply_idna(void) { + test_dns_name_apply_idna_one("", ""); + test_dns_name_apply_idna_one("foo", "foo"); + test_dns_name_apply_idna_one("foo.", "foo"); + test_dns_name_apply_idna_one("foo.bar", "foo.bar"); + test_dns_name_apply_idna_one("foo.bar.", "foo.bar"); + test_dns_name_apply_idna_one("föö", "xn--f-1gaa"); + test_dns_name_apply_idna_one("föö.", "xn--f-1gaa"); + test_dns_name_apply_idna_one("föö.bär", "xn--f-1gaa.xn--br-via"); + test_dns_name_apply_idna_one("föö.bär.", "xn--f-1gaa.xn--br-via"); +} + int main(int argc, char *argv[]) { test_dns_label_unescape(); @@ -624,6 +644,7 @@ int main(int argc, char *argv[]) { test_dns_name_equal_skip(); test_dns_name_compare_func(); test_dns_name_common_suffix(); + test_dns_name_apply_idna(); return 0; } |