]> sjero.net Git - wget/blob - tests/Test-idn-cmd-utf8.px
NEWS: cite --start-pos
[wget] / tests / Test-idn-cmd-utf8.px
1 #!/usr/bin/env perl
2
3 use strict;
4 use warnings;
5
6 use WgetFeature qw(iri);
7 use HTTPTest;
8
9 # " Kon'nichiwa <dot> Japan
10 my $utf8_hostname = "\344\273\212\346\227\245\343\201\257.\346\227\245\346\234\254";
11 my $punycoded_hostname = 'xn--v9ju72g90p.xn--wgv71a';
12
13 ###############################################################################
14
15 my $result_file = <<EOF;
16 Found me!
17 EOF
18
19 # code, msg, headers, content
20 my %urls = (
21     "http://$punycoded_hostname/index.html" => {
22         code => "200",
23         msg => "Yes, please",
24         headers => {
25             'Content-Type' => 'text/plain',
26         },
27         content => $result_file,
28     },
29 );
30
31 my $cmdline = $WgetTest::WGETPATH . " --iri -r"
32     . " -e http_proxy=localhost:{{port}} --local-encoding=UTF-8 $utf8_hostname";
33
34 my $expected_error_code = 0;
35
36 my %expected_downloaded_files = (
37     "$punycoded_hostname/index.html" => {
38         content => $result_file,
39     },
40 );
41
42 ###############################################################################
43
44 my $the_test = HTTPTest->new (name => "Test-idn-cmd-utf8",
45                               input => \%urls,
46                               cmdline => $cmdline,
47                               errcode => $expected_error_code,
48                               output => \%expected_downloaded_files);
49 exit $the_test->run();
50
51 # vim: et ts=4 sw=4
52