]> sjero.net Git - wget/blob - tests/Test-idn-robots.px
Remove useless "gettext" advertisement.
[wget] / tests / Test-idn-robots.px
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use HTTPTest;
7
8 # " Kon'nichiwa <dot> Japan
9 my $euc_jp_hostname = "\272\243\306\374\244\317.\306\374\313\334";
10 my $punycoded_hostname = 'xn--v9ju72g90p.xn--wgv71a';
11
12 ###############################################################################
13
14 my $starter_file = <<EOF;
15 <a href="http://$euc_jp_hostname/foo.txt">The link</a>
16 EOF
17
18 my $result_file = <<EOF;
19 Found me!
20 EOF
21
22 # code, msg, headers, content
23 my %urls = (
24     "http://$punycoded_hostname/index.html" => {
25         code => "200",
26         msg => "Yes, please",
27         headers => {
28             'Content-Type' => 'text/html; charset=EUC-JP',
29         },
30         content => $starter_file,
31     },
32     "http://$punycoded_hostname/foo.txt" => {
33         code => "200",
34         msg => "Uh-huh",
35         headers => {
36             'Content-Type' => 'text/plain',
37         },
38         content => $result_file,
39     },
40     "http://$punycoded_hostname/robots.txt" => {
41         code => "200",
42         msg => "Uh-huh",
43         headers => {
44             'Content-Type' => 'text/plain',
45         },
46         content => '',
47     },
48 );
49
50 my $cmdline = $WgetTest::WGETPATH . " --debug --iri -rH"
51     . " -e http_proxy=localhost:{{port}} --local-encoding=EUC-JP"
52     . " http://$euc_jp_hostname/";
53
54 my $expected_error_code = 0;
55
56 my %expected_downloaded_files = (
57     "$punycoded_hostname/index.html" => {
58         content => $starter_file,
59     },
60     "$punycoded_hostname/foo.txt" => {
61         content => $result_file,
62     },
63     "$punycoded_hostname/robots.txt" => {
64         content => '',
65     },
66 );
67
68 ###############################################################################
69
70 my $the_test = HTTPTest->new (name => "Test-idn-robots",
71                               input => \%urls, 
72                               cmdline => $cmdline, 
73                               errcode => $expected_error_code, 
74                               output => \%expected_downloaded_files);
75 exit $the_test->run();
76
77 # vim: et ts=4 sw=4
78