2013-02-08 09:14:09 -08:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Test::More;
|
2016-05-16 06:07:57 -07:00
|
|
|
use Test::Deep;
|
2013-02-08 09:14:09 -08:00
|
|
|
use DDG::Test::Goodie;
|
|
|
|
use utf8;
|
|
|
|
|
|
|
|
zci answer_type => 'idn';
|
|
|
|
zci is_cached => 1;
|
|
|
|
|
2017-08-23 16:23:50 -07:00
|
|
|
sub build_answer {
|
|
|
|
my($string_answer, $title, $subtitle) = @_;
|
|
|
|
return $string_answer,
|
|
|
|
structured_answer => {
|
|
|
|
data => {
|
|
|
|
title => $title,
|
|
|
|
subtitle => $subtitle,
|
|
|
|
},
|
|
|
|
templates => {
|
|
|
|
group => 'text',
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
sub build_test { test_zci(build_answer(@_)) }
|
|
|
|
|
2013-02-08 09:14:09 -08:00
|
|
|
ddg_goodie_test(
|
2017-08-23 16:23:50 -07:00
|
|
|
[qw(
|
|
|
|
DDG::Goodie::IDN
|
|
|
|
)],
|
|
|
|
'idn exämple.com' => build_test('Encoded IDN: xn--exmple-cua.com', 'xn--exmple-cua.com', 'exämple.com encoded'),
|
|
|
|
'internationalize domain exämple.com' => build_test('Encoded internationalized domain: xn--exmple-cua.com', 'xn--exmple-cua.com', 'exämple.com encoded'),
|
|
|
|
'idn xn--exmple-cua.com' => build_test('Decoded IDN: exämple.com', 'exämple.com', 'xn--exmple-cua.com decoded'),
|
|
|
|
'international domain xn--exmple-cua.com' => build_test('Decoded international domain: exämple.com', 'exämple.com', 'xn--exmple-cua.com decoded'),
|
|
|
|
'internationalized domain xn--exmple-cua.com' => build_test('Decoded internationalized domain: exämple.com', 'exämple.com', 'xn--exmple-cua.com decoded'),
|
2013-02-08 09:14:09 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
done_testing;
|